[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