本文整理汇总了C#中MockRepository.Verify方法的典型用法代码示例。如果您正苦于以下问题:C# MockRepository.Verify方法的具体用法?C# MockRepository.Verify怎么用?C# MockRepository.Verify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MockRepository
的用法示例。
在下文中一共展示了MockRepository.Verify方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MockClassWithEquals
public void MockClassWithEquals()
{
MockRepository mocks = new MockRepository();
ClassThatOverrideEquals c = (ClassThatOverrideEquals)mocks.StrictMock(typeof(ClassThatOverrideEquals));
c.Equals(c);
LastCall.Return(false);
mocks.Replay(c);
Assert.IsFalse(c.Equals(c));
mocks.Verify(c);
}
示例2: RepeatTimes_Works_When_Called_Less_Then_Expected
public void RepeatTimes_Works_When_Called_Less_Then_Expected()
{
var mockRepository = new MockRepository();
var interfaceMock = mockRepository.StrictMock<IRepeatsWithGenerate>();
Expect.Call(interfaceMock.GetMyIntValue())
.Repeat.Times(2)
.Return(4);
mockRepository.ReplayAll();
interfaceMock.GetMyIntValue();
mockRepository.Verify(interfaceMock);
}
示例3: RepeatTimes_Works_When_Called_Less_Then_Expected
public void RepeatTimes_Works_When_Called_Less_Then_Expected()
{
var mockRepository = new MockRepository();
var interfaceMock = mockRepository.StrictMock<IRepeatsWithGenerate>();
Expect.Call(interfaceMock.GetMyIntValue())
.Repeat.Times(2)
.Return(4);
mockRepository.ReplayAll();
interfaceMock.GetMyIntValue();
var ex = Assert.Throws<ExpectationViolationException>(() => mockRepository.Verify(interfaceMock));
Assert.Equal("IRepeatsWithGenerate.GetMyIntValue(); Expected #2, Actual #1.", ex.Message);
}
示例4: ShouldVerifyVerifiables
public void ShouldVerifyVerifiables()
{
try
{
var repository = new MockRepository(MockBehavior.Default);
var mock = repository.Create<IFoo>();
mock.Setup(foo => foo.Do());
mock.Setup(foo => foo.Undo()).Verifiable();
repository.Verify();
}
catch (MockException mex)
{
Assert.Equal(MockException.ExceptionReason.VerificationFailed, mex.Reason);
Expression<Action<IFoo>> doExpr = foo => foo.Do();
Assert.False(mex.Message.Contains(doExpr.ToString()));
}
}
示例5: CallingVerifyOnNonMockThrows
public void CallingVerifyOnNonMockThrows()
{
MockRepository mocks = new MockRepository();
var ex = Assert.Throws<ObjectNotMockFromThisRepositoryException>(() => mocks.Verify(new object()));
Assert.Equal("The object is not a mock object that belong to this repository.", ex.Message);
}
示例6: CallingVerifyOnNonMockThrows
public void CallingVerifyOnNonMockThrows()
{
MockRepository mocks = new MockRepository();
mocks.Verify(new object());
}