Mehfuz's WebLog

Live crazy, think different!

Sponsors

Browse by Tags

All Tags » Telerik (RSS)
Future mocking with #IgnoreInstance
In my previous post, i showed how JustMock picks mock expectations based on current context without the instance being injected. Based on feedback we found that It’s sometimes confusing and often does not work as intended. However, the context of this...
Posted: Dec 02 2011, 05:36 PM by mehfuzh | with no comments
Filed under: , , ,
Mocking MsCorlib members
In this post , I will show how you can mock  members from MsCorlib. This is more of an introductory post and shows what you need to do in order to successfully mock an MsCorlib member. If you are planning to mock File or DateTime then the process...
Mocking constructor
While unit testing a target type, it is likely that the test is failing during object creation because we forgot to include a mandatory configuration file or a line in the constructor is throwing exception because it is making call to some external service...
Posted: Mar 22 2011, 09:35 PM by mehfuzh | with 1 comment(s)
Filed under: , , , ,
Adding custom interfaces to your mock instance.
Previously, i made a post  showing how you can leverage the dependent interfaces that is implemented by JustMock during the creation of mock instance. It could be a informative post that let you understand how JustMock behaves internally for classes...
Mocking successive calls of similar type via sequential mocking
In this post , i show how you can benefit from sequential mocking feature[In JustMock] for setting up expectations with successive calls of same type. To start let’s first consider the following dummy database and entity class. public class Person { public...
Posted: May 31 2010, 09:35 PM by mehfuzh | with no comments
Filed under: , , ,
Mocking property sets
In this post, i will be showing how you can mock property sets with your expected values or even action using JustMock. To begin, we have a sample interface: public interface IFoo { int Value { get ; set ; } } Now,  we can create a mock that will...
Posted: May 14 2010, 07:42 PM by mehfuzh | with no comments
Filed under: , , ,
Playing with aspx page cycle using JustMock
In this post , I will cover a test code that will mock the various elements needed to complete a HTTP page request and  assert the expected page cycle steps. To begin, i have a simple enumeration that has my predefined page steps: public enum PageStep...
Posted: Apr 29 2010, 11:23 PM by mehfuzh | with 2 comment(s)
Filed under: , , ,
Working with multiple interfaces on a single mock.
Today , I will cover a very simple topic, which can be useful in cases we want to mock different interfaces on our expected mock object.  Our target interface is simple and it looks like: public interface IFoo : IDisposable { void Do(); } Our target...
Posted: Apr 26 2010, 10:35 PM by mehfuzh | with 3 comment(s)
Filed under: , , ,
Asserting with JustMock
In this post, i will be digging in a bit deep on Mock.Assert . This is the continuation from previous post and covers up the ways you can use assert for your mock expectations. I have used another traditional sample of Talisker that has a warehouse [Collaborator...
Posted: Apr 19 2010, 03:57 PM by mehfuzh | with 1 comment(s)
Filed under: , , ,
Doing your first mock with JustMock
In this post, i will start with a  more traditional mocking example that  includes a fund transfer scenario between two different currency account using JustMock.Our target interface that we will be mocking looks similar to: public interface...
Posted: Apr 13 2010, 10:43 PM by mehfuzh | with 8 comment(s)
Filed under: , , ,
More Posts Next page »