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


C# MockRepository.BackToRecord方法代码示例

本文整理汇总了C#中MockRepository.BackToRecord方法的典型用法代码示例。如果您正苦于以下问题:C# MockRepository.BackToRecord方法的具体用法?C# MockRepository.BackToRecord怎么用?C# MockRepository.BackToRecord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MockRepository的用法示例。


在下文中一共展示了MockRepository.BackToRecord方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CanClearOnlyOriginalMethodCalls

        public void CanClearOnlyOriginalMethodCalls()
        {
            MockRepository mocks = new MockRepository();
            AbstractClass abstractClass = mocks.StrictMock<AbstractClass>();
            Expect.Call(abstractClass.Add(0)).CallOriginalMethod(OriginalCallOptions.NoExpectation);
            mocks.BackToRecord(abstractClass, BackToRecordOptions.OriginalMethodsToCall);
            mocks.ReplayAll();

            abstractClass.Add(5);
        }
开发者ID:nkmajeti,项目名称:rhino-tools,代码行数:10,代码来源:BackToRecord.cs

示例2: CanClearOnlyPropertyBehavior

        public void CanClearOnlyPropertyBehavior()
        {
            MockRepository mocks = new MockRepository();
            IDemo mock = mocks.StrictMock<IDemo>();
            Expect.Call(mock.Prop).PropertyBehavior();

            mocks.BackToRecord(mock,BackToRecordOptions.PropertyBehavior);

            mocks.ReplayAll();

            string prop = mock.Prop;
        }
开发者ID:nkmajeti,项目名称:rhino-tools,代码行数:12,代码来源:BackToRecord.cs

示例3: CanClearOnlyOriginalMethodCalls

        public void CanClearOnlyOriginalMethodCalls()
        {
            MockRepository mocks = new MockRepository();
            AbstractClass abstractClass = mocks.StrictMock<AbstractClass>();
            Expect.Call(abstractClass.Add(0)).CallOriginalMethod(OriginalCallOptions.NoExpectation);
            mocks.BackToRecord(abstractClass, BackToRecordOptions.OriginalMethodsToCall);
            mocks.ReplayAll();

            Assert.Throws<ExpectationViolationException>(
                "AbstractClass.Add(5); Expected #0, Actual #1.",
                () => abstractClass.Add(5));
        }
开发者ID:medmondson,项目名称:RhinoMocks,代码行数:12,代码来源:BackToRecord.cs

示例4: CanMoveToRecordAndThenReplay

 public void CanMoveToRecordAndThenReplay()
 {
     MockRepository mocks = new MockRepository();
     IDemo demo = (IDemo)mocks.StrictMock(typeof(IDemo));
     Expect.Call(demo.Prop).Return("ayende");
     mocks.Replay(demo);
     Assert.AreEqual("ayende", demo.Prop);
     mocks.BackToRecord(demo);
     Expect.Call(demo.Prop).Return("rahien");
     mocks.Replay(demo);
     Assert.AreEqual("rahien", demo.Prop);
     mocks.VerifyAll();
 }
开发者ID:nkmajeti,项目名称:rhino-tools,代码行数:13,代码来源:BackToRecord.cs

示例5: UsingBackToRecordWithSetUpResult

 public void UsingBackToRecordWithSetUpResult()
 {
     MockRepository mocks = new MockRepository();
     IDemo demo = (IDemo) mocks.StrictMock(typeof(IDemo));
     SetupResult.For(demo.Prop).Return("Here is 1 sample greeting");
     mocks.Replay(demo);
     Assert.Equal("Here is 1 sample greeting",demo.Prop);
     mocks.BackToRecord(demo);
     SetupResult.For(demo.Prop).Return("Here is another sample greeting");
     mocks.Replay(demo);
     Assert.Equal("Here is another sample greeting", demo.Prop);
     mocks.VerifyAll();
 }
开发者ID:bjornbouetsmith,项目名称:mammock,代码行数:13,代码来源:FieldProblem_BackToMockWithRepeatableMethods.cs

示例6: CanClearOnlyPropertyBehavior

        public void CanClearOnlyPropertyBehavior()
        {
            MockRepository mocks = new MockRepository();
            IDemo mock = mocks.StrictMock<IDemo>();
            Expect.Call(mock.Prop).PropertyBehavior();

            mocks.BackToRecord(mock,BackToRecordOptions.PropertyBehavior);

            mocks.ReplayAll();

            Assert.Throws<ExpectationViolationException>("IDemo.get_Prop(); Expected #0, Actual #1.", delegate
            {
                string prop = mock.Prop;
            });
        }
开发者ID:medmondson,项目名称:RhinoMocks,代码行数:15,代码来源:BackToRecord.cs

示例7: BackToRecordOnADynamicMock

        public void BackToRecordOnADynamicMock()
        {
            MockRepository repository = new MockRepository();
            ITest test = (ITest)repository.DynamicMock(typeof(ITest));

            test.DoSomething(1);

            repository.BackToRecord(test);

            test.DoSomething(2);

            repository.ReplayAll();

            test.DoSomething(2);
            test.DoSomething(3);

            repository.VerifyAll();
        }
开发者ID:bcraytor,项目名称:rhino-mocks,代码行数:18,代码来源:FieldProblem_BackToRecordWithDynamicMocks.cs

示例8: CanMoveToRecordFromReplyWithoutClearingExpectations

        public void CanMoveToRecordFromReplyWithoutClearingExpectations()
        {
            MockRepository mocks = new MockRepository();
            IDemo mock = mocks.StrictMock<IDemo>();

            mock.VoidNoArgs();
            mocks.ReplayAll();

            mocks.BackToRecord(mock, BackToRecordOptions.None);

            mock.VoidNoArgs();
            mocks.ReplayAll();

            mock.VoidNoArgs();

            mocks.VerifyAll();
        }
开发者ID:nkmajeti,项目名称:rhino-tools,代码行数:17,代码来源:BackToRecord.cs

示例9: CanSpecifyClearOnlyEvents

        public void CanSpecifyClearOnlyEvents()
        {
            MockRepository mocks = new MockRepository();
            IWithEvent withEvent = mocks.StrictMock<IWithEvent>();
            bool called = false;
            withEvent.Load += delegate { called = true; };
            IEventRaiser raiser = LastCall.GetEventRaiser();
            mocks.BackToRecord(withEvent, BackToRecordOptions.EventSubscribers);

            raiser.Raise(this, EventArgs.Empty);

            Assert.IsFalse(called);
        }
开发者ID:nkmajeti,项目名称:rhino-tools,代码行数:13,代码来源:BackToRecord.cs

示例10: CanMoveToRecordFromReplyWithoutClearingExpectations

        public void CanMoveToRecordFromReplyWithoutClearingExpectations()
        {
            MockRepository mocks = new MockRepository();
            IDemo mock = mocks.StrictMock<IDemo>();

            mock.VoidNoArgs();
            mocks.ReplayAll();

            mocks.BackToRecord(mock, BackToRecordOptions.None);

            mock.VoidNoArgs();
            mocks.ReplayAll();

            mock.VoidNoArgs();

            string expectedMessage = "IDemo.VoidNoArgs(); Expected #1, Actual #0.";
            ExpectationViolationException ex = Assert.Throws<ExpectationViolationException>(
                            () => mocks.VerifyAll());
            Assert.Equal(expectedMessage, ex.Message);
        }
开发者ID:bjornbouetsmith,项目名称:mammock,代码行数:20,代码来源:BackToRecord.cs


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