[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。似乎因为我正在设置返回值,真正在测试什么,这是一个笑话还是我遗漏了什么?