当前位置: 首页>>代码示例>>C#>>正文


C# MockRepository.Verify方法代码示例

本文整理汇总了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);
 }
开发者ID:nkmajeti,项目名称:rhino-tools,代码行数:10,代码来源:FieldProblem_Daniel.cs

示例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);
        }
开发者ID:bcraytor,项目名称:rhino-mocks,代码行数:16,代码来源:FieldProblem_RepeatsWithGenerate.cs

示例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);
        }
开发者ID:guesshoo,项目名称:rhino-mocks,代码行数:17,代码来源:FieldProblem_RepeatsWithGenerate.cs

示例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()));
			}
		}
开发者ID:ouyh18,项目名称:LtePlatform,代码行数:19,代码来源:MockRepositoryFixture.cs

示例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);
 }
开发者ID:guesshoo,项目名称:rhino-mocks,代码行数:6,代码来源:MockRepositoryTests.cs

示例6: CallingVerifyOnNonMockThrows

 public void CallingVerifyOnNonMockThrows()
 {
     MockRepository mocks = new MockRepository();
     mocks.Verify(new object());
 }
开发者ID:nkmajeti,项目名称:rhino-tools,代码行数:5,代码来源:MockRepositoryTests.cs


注:本文中的MockRepository.Verify方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。