Typemock are offering their new product for unit testing SharePoint called Isolator For SharePoint, for a special introduction price. it is the only tool that allows you to unit test SharePoint without a SharePoint server. To learn more click here.
The first 50 bloggers who blog this text in their blog and tell us about it, will get a Full Isolator license, Free. for rules and info click here.
Here’s an example taken from their introduction article:
[TestMethod] [Isolated] public void RepositoryAdd_FakeSPServer_PropertiesAreSetWithCorrectArguments() { var fakeWeb = Isolate.Fake.Instance(Members.ReturnRecursiveFakes); var fakeUser = fakeWeb.SiteUsers.GetByID(1); var fakeItem = fakeWeb.Lists[""].Items.Add(); Isolate.WhenCalled(() => fakeItem[0]).WillReturn(1); Registration registration = new Registration(){ CourseId=1234, RegistrationStatus = "Pending", Title="UnitTest", UserId = 100 }; RegistrationRepository repository = new RegistrationRepository(); int id = repository.Add(registration, false, fakeWeb); Assert.AreEqual(1, id); Isolate.Verify.WasCalledWithExactArguments(()=> fakeItem[Fields.Title] = "UnitTest"); Isolate.Verify.WasCalledWithExactArguments(()=> fakeItem[Fields.UserId]= 100); Isolate.Verify.WasCalledWithExactArguments(()=> fakeItem[Fields.User]= fakeUser); Isolate.Verify.WasCalledWithExactArguments(()=> fakeItem[Fields.Status]= "Pending"); }