Sample:

[TestMethod]
public void AutoMockTest_For_Generic_Repo()
{
     // Arrange
     AutoMocker autoMocking = new AutoMocker();
     autoMocking.IsDebugEnabled = false;
     Foo foo = autoMocking.Create<Foo>();

     // Act
     foo.Bar();

     // Assert
     foo.HelloRepo.AssertWasCalled(x => x.Save());
     Assert.IsNull(foo.dict);
}

[TestMethod]
public void AutoMockTest_For_Generic_Repo_With_ConcreteImplementation()
{
       // Arrange
       AutoMocker autoMocking = new AutoMocker();
       autoMocking.AddComponent<IRepository<Hello>>(new HelloRepoImpl());
       Foo foo = autoMocking.Create<Foo>();

       // Act
       foo.Bar();

       // Assert
       //foo.HelloRepo.AssertWasCalled(x => x.Save());
}

Last edited Aug 23, 2011 at 9:01 AM by ronald_odion, version 4