Mocking

May 22, 2009 14:33 by bryan

In object-oriented programming, mock objectsare simulated objects that mimic the behavior of real objects in controlled ways. A computer programmer typically creates a mock object to test the behavior of some other object, in much the same way that a car designer uses a crash test dummy to simulate the dynamic behavior of a human in vehicle impacts.

It is possible to perform integration testing on the Membership Provider, take a look at this blog entry to find out more Integration testing the MembershipProvider

Within the Project we are using Rhino MocksOren Eini is doing a great job with this framework, and I think it's the only one that seems to be keeping up with the latest features in .NET, other than TypeMock. Plus, it's totally free to use. It's also the only one other than TypeMock which does not require you to input strings for method names you'd like to mock, which is cool. It's compelling to use it but the project is currently maintained by just one person. If Oren decides to drop it, or for any reason stop working on it, the book might turn out outdated quite quickly. Plus, it's not very widely used, though it seems to be gaining in popularity.

References

Introduction to Mocking with Rhino Mocks

Mocking

Code Samples


Integration Test using the MembershipProvider

May 7, 2009 09:24 by bryan

Creating tests is a very important part of the development cycle, one of the import part of creating tests is to make sure the tests have as little dependencies as possible, this is where Intergration testing comes in to play.

One area to Integration test is the Membership Provider and Role Provider, this is quite simple as the interfaces ofr both providers are very well defined.

I have attached two Integration test Providers, one for the Membership and the other for Roles, So as to keep Visual Basic alive I've written this source in VB.NET

IntegrationTest MembershipProvider.vb (6.24 kb)

IntegrationTestRoleProvider.vb (4.36 kb)

Of course the next step would be to Mock these objects