本文整理汇总了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();
}
示例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);
}
示例3: LooseNoCall
public void LooseNoCall()
{
var myMock = new Mock<IEnumerable<int>>(MockBehavior.Loose);
myMock
.Setup(a => a.ToString())
.Returns("Hello");
myMock.Reset();
myMock.VerifyAll();
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}