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


C# Mock.Reset方法代码示例

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


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

示例1: CalculateFrequencyTest

        public void CalculateFrequencyTest()
        {
            var view = new Mock<IMainGameView>();

            var controller = new MainGameController(view.Object);
            controller.LoadKeysResources(TestKeyFileResource);

            view.Setup(x => x.PlaySound(It.Is<int>(f => f == 110), 100));
            controller.ProcessKey(Keys.Q); //key#0
            view.VerifyAll();

            view.Reset();
            view.Setup(x => x.PlaySound(It.Is<int>(f => f == 117), 100));
            controller.ProcessKey(Keys.W); //key#0
            view.VerifyAll();

            view.Reset();
            view.Setup(x => x.PlaySound(It.Is<int>(f => f == 175), 100));
            controller.ProcessKey(Keys.O); //key#8
            view.VerifyAll();

            view.Reset();
            view.Setup(x => x.PlaySound(It.Is<int>(f => f == 185), 100));
            controller.ProcessKey(Keys.P); //key#9
            view.VerifyAll();
        }
开发者ID:chulup,项目名称:EgorkaGame,代码行数:26,代码来源:EgorkaUnitTest.cs

示例2: SetupDoesNotApplyAfterMockWasReset

        public void SetupDoesNotApplyAfterMockWasReset()
        {
            var mock = new Mock<IFooReset>();
            mock.Setup(foo => foo.Execute("ping")).Returns("ack");
            mock.Reset();

            var result = mock.Object.Execute("ping");
            Assert.Null(result);
        }
开发者ID:CharlieBP,项目名称:moq4,代码行数:9,代码来源:ExtensionsFixture.cs

示例3: LooseNoCall

 public void LooseNoCall()
 {
     var myMock = new Mock<IEnumerable<int>>(MockBehavior.Loose);
     myMock
         .Setup(a => a.ToString())
         .Returns("Hello");
     myMock.Reset();
     myMock.VerifyAll();
 }
开发者ID:moq,项目名称:moq4,代码行数:9,代码来源:ExtensionsFixture.cs

示例4: Strict

 public void Strict()
 {
     var myMock = new Mock<IEnumerable<int>>(MockBehavior.Strict);
     myMock
         .Setup(a => a.ToString())
         .Returns("Hello");
     myMock.Reset();
     Assert.NotEqual("Hello", myMock.Object.ToString());
     myMock.VerifyAll();
 }
开发者ID:moq,项目名称:moq4,代码行数:10,代码来源:ExtensionsFixture.cs

示例5: SetupSuspensionManager

        public void SetupSuspensionManager()
        {
            _plugin = new Mock<IAdapterPlugin>();

            var state = new StateManager(new Mock<ISettings>().Object, _plugin.Object);
            state.ClearState(_fixtureId);
            state.ClearState(TestHelper.GetFixtureFromResource("rugbydata_snapshot_2").Id);

            _settings = new Mock<ISettings>();
            _settings.Reset();
            _settings.Setup(x => x.ProcessingLockTimeOutInSecs).Returns(10);
        }
开发者ID:luxbet,项目名称:SS.Integration.Adapter,代码行数:12,代码来源:StreamListenerTests.cs

示例6: ExecuteMethodCancelIsCalledWhenElementIsAlreadyExecuting

        public void ExecuteMethodCancelIsCalledWhenElementIsAlreadyExecuting()
        {
            var mockInPortMgr = new Mock<IInputPortMgr>();
            var mockOutPortMgr = new Mock<IOutputPortMgr>();
            var mockFx = new Mock<IIdentNodeCoresFx>();

            using (RecordExpectations recorder = RecorderManager.StartRecording())
            {
                recorder.ExpectAndReturn(_element.Status, ElementStatus.Executing).RepeatAlways();
                recorder.ExpectAndReturn(_element.InPortMgr, mockInPortMgr).RepeatAlways();
                recorder.ExpectAndReturn(mockInPortMgr.PortStatuses, null).RepeatAlways();
                recorder.ExpectAndReturn(_element.OutPortMgr, mockOutPortMgr).RepeatAlways();
                recorder.ExpectAndReturn(mockOutPortMgr.PortStatuses, null).RepeatAlways();
                recorder.ExpectAndReturn(_element.Fx, mockFx).RepeatAlways();
                mockOutPortMgr.Reset();
                mockFx.Reset();

                _element.Cancel();
            }

            _element.Execute();
            MockManager.Verify();
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:23,代码来源:IdentNodeCores_As_ISimpleElementFixture.cs

示例7: Reset_MethodCallsBagToResetAllItems

        public void Reset_MethodCallsBagToResetAllItems()
        {
            var mockBag = new Mock<IParamBag>();
            ISetParamBag setter = _mgr as ISetParamBag;

            using (RecordExpectations recorder = RecorderManager.StartRecording())
            {
                recorder.DefaultBehavior.Strict = StrictFlags.ArbitraryMethodsAllowed;
                recorder.ExpectAndReturn(_mgr.Bag, mockBag);
                mockBag.Reset();
            }

            setter.SetBag(mockBag);
            _mgr.Reset();
            MockManager.Verify();
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:16,代码来源:IdentNodeCoresParamMgrFixture.cs


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