[Test]
public void TestUserProfileInsert()
{
using (new TestBindingsWrapper("TestBindings", "", new TestModule()))
{
// Setup the mock the dataprovider
MyMocks.MockDataProvider.Setup(x => x.InsertUserProfile(It.IsAny<IUserProfile>())).Returns(1);
IUserProfile up = new UserProfile();
IUserProfileManager manager = new UserProfileManager();
int result = manager.Insert(up);
Assert.AreEqual(1, result);
MyMocks.MockDataProvider.Verify(x => x.InsertUserProfile(up), Times.Once());
}
}
我也在用ninject。看起来,因为我设置了返回值,真正被测试的是这个笑话还是我错过了什么?这个mbunit测试真的有意义吗?
你为什么不调用Ninject'Get'方法来激活你的对象? – 2009-10-28 14:52:59