Browse by Tags

All Tags » Agile (RSS)

Fake a member without worrying about passing the dependency by Mehfuz's WebLog

I have came across this several times in forum (telerik) on how I can really fake an item yet I don’t want to pass the instance as an argument. Ideally, this is not a best design but there are third- partly libraries that you have little control over...
Filed under: , ,

Mocking constructor by Mehfuz's WebLog

Often we end up in a situation where constructor call on the target type requires us to include  a config file in our test project or requires firing up some external process. To better illustrate this if we create an entity framework data container...
Filed under: , , ,

How to raise event for a mocked call. by Mehfuz's WebLog

Recently, while i was working with a support issue , i found this interesting piece of test code that i would like to share here. This is actually written by Stefan Lieser (clean code developer from Germany forwarded to me by Jan from Telerik Germany...
Filed under: , ,

Back to school : Getting to know F# by Mehfuz's WebLog

This post starts with a basic introduction of F# and finally ends up writing a simple unit test for an F# member. For those who don’t know what F# is all about, Its a product from Microsoft research and now part of VS 2010 family. Actually from Wikipedia...
Filed under: , , ,

Hands on mocking of ASPNETMVC controller action by Mehfuz's WebLog

In this post, i will start with a MVC sample created from the default template project that is bundled with ASPNET MVC2 installation. This template provides not just a dummy project with folder organized but rather a full running app.The target of this...

Adding custom interfaces to your mock instance. by Mehfuz's WebLog

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...
Filed under: , , ,

Mocking successive calls of similar type via sequential mocking by Mehfuz's WebLog

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...
Filed under: , ,

Is your test method self-validating ? by Mehfuz's WebLog

Writing state of art unit tests that can validate your every part of the framework is challenging and interesting at the same time, its like becoming a samurai. One of the key concept in this is to keep our test synced all the time as underlying code...
Filed under: , , ,

Mocking property sets by Mehfuz's WebLog

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...
Filed under: , , ,

Playing with aspx page cycle using JustMock by Mehfuz's WebLog

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...
Filed under: , , ,

Working with multiple interfaces on a single mock. by Mehfuz's WebLog

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...
Filed under: , , ,

Asserting with JustMock by Mehfuz's WebLog

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...
Filed under: , , ,

Doing your first mock with JustMock by Mehfuz's WebLog

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...
Filed under: , , ,

JustMock is here !! by Mehfuz's WebLog

As announced earlier by Hristo Kosev at Telerik blogs , we have started giving out JustMock builds from today. This is the first of early builds before the official Q2 release and we are pretty excited to get your feedbacks. Its pretty early to say anything...
Filed under: , , ,

Do you Encode your interface ? by Mehfuz's WebLog

Yesterday , i was reading Clean Code by Uncle Bob. While i was doing so , i came across a line that really stuck my thought patterns and i would like to share it with my readers as well. The line looks something like, provided that there is a shape factory...
Filed under: , , ,
Powered by Community Server (Non-Commercial Edition), by Telligent Systems