Posts

Showing posts from November, 2010

The Great Rhino Mocks

What is Rhino Mocks? Rhino Mocks allows you to easily create mock objects and setup a wide range of expectations on them using strongly typed notation instead of compiler-opaque strings. It's as simple as: IProjectView projectView = mocks.StrictMock (); Expect.Call(projectView.Title).Return("Project's Title"); Definitions: Mock Object - an object that pretends to be another object and allows you to set expectations on its interactions with another object. Interaction Based Testing - you specify a certain sequence of interactions between objects, initiate an action, and then verify that the sequence of interactions happened as you specified it. State Based Testing - you initiate an action and then check for the expected results (return value, property, created object, etc). Expectation - general name for validation that a particular method call is the expected one. Record & Replay model - a model that allows for recording actions on a mock object and then replay...

Windows Communication Foundation (WCF) - Instance Context Mode

Introduction This article illustrates the use of the InstanceContextMode property used in the ServiceBehaviour attribute and how it can be so handy in the latest communication technology Windows Communication Foundation (WCF), introduced by Microsoft as a part of the .NET framework SDK 3.0 and later versions. I will be creating a demo application which will make use of the various instance context modes available in WCF, along with the explanation. Why WCF? I thought of providing a little information about why Windows Communication Foundation (WCF) is required in the .NET framework when there are already communication technologies like web services, enterprise services and remoting. WCF is introduced by Microsoft to achieve a Single Unified API for.NET services, so that in the future if any one speaks about service communication in .NET it would be only Windows Communication Foundation (WCF). Even though web service has proved to be stable it has a lot of limitations like statelessness...