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


C# Mock.Execute方法代码示例

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


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

示例1: ExecuteMethodChangesElementStatusBeforeExecutingTheFxGroup

        public void ExecuteMethodChangesElementStatusBeforeExecutingTheFxGroup()
        {
            ISetParamMgr setterParamMgr = _element as ISetParamMgr;
            ISetPortMgrs setterPortsMgr = _element as ISetPortMgrs;
            ISetSimpleFx setterFx = _element as ISetSimpleFx;

            ValidationResults results1 = null;
            ValidationResults results2 = null;
            var mockParamMgr = new Mock<IIdentNodeCoresParamMgr>();
            var mockInPortMgr = new Mock<IInputPortMgr>();
            var mockOutPortMgr = new Mock<IOutputPortMgr>();
            var mockFx = new Mock<IIdentNodeCoresFx>();

            using (RecordExpectations recorder = RecorderManager.StartRecording())
            {
                recorder.DefaultBehavior.Strict = StrictFlags.ArbitraryMethodsAllowed;
                recorder.ExpectAndReturn(_element.OutPortMgr, mockOutPortMgr).RepeatAlways();
                recorder.ExpectAndReturn(mockOutPortMgr.PortStatuses, null).RepeatAlways();
                recorder.ExpectAndReturn(mockInPortMgr.Validate(out results1), true);
                recorder.ExpectAndReturn(mockParamMgr.Validate(out results2), true);
                mockFx.Execute(null, null, null, null);
                (_element as SimpleElementBase).Log(LogReasons.Start, null, null);
            }

            ElementStatus initialStatus = _element.Status;

            setterPortsMgr.SetInputMgr(mockInPortMgr);
            setterParamMgr.SetMgr(mockParamMgr);
            setterFx.SetFxGroup(mockFx);
            _element.Execute();
            ElementStatus expectedStatus = _element.Status;
            MockManager.Verify();

            Assert.Equal(ElementStatus.Incomplete, initialStatus);
            Assert.Equal(ElementStatus.Executing, expectedStatus);
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:36,代码来源:IdentNodeCores_As_ISimpleElementFixture.cs

示例2: Execute_Func_throws_on_null_parameters

            public void Execute_Func_throws_on_null_parameters()
            {
                var mockExecutionStrategy =
                    new Mock<DbExecutionStrategy>
                        {
                            CallBase = true
                        }.Object;

                Assert.Equal(
                    "operation",
                    Assert.Throws<ArgumentNullException>(() => mockExecutionStrategy.Execute((Func<int>)null)).ParamName);
            }
开发者ID:aspnet,项目名称:EntityFramework6,代码行数:12,代码来源:DbExecutionStrategyTests.cs

示例3: Execute_WhenStatusIsComplete

        public void Execute_WhenStatusIsComplete()
        {
            var mockEl = new Mock<DummyCompoundElement>();

            using (RecordExpectations recorder = RecorderManager.StartRecording())
            {
                recorder.ExpectAndReturn(mockEl.Status, ElementStatus.Complete).Repeat(2);
                mockEl.ResetWithNotification(false);
                mockEl.ExecutionProper();
            }

            mockEl.Execute();
            MockManager.Verify();
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:14,代码来源:Copy+of+CompoundElementBaseFixture.cs

示例4: Execute_Action_throws_on_null_parameters

            public void Execute_Action_throws_on_null_parameters()
            {
                var mockExecutionStrategy =
                    new Mock<ExecutionStrategyBase>
                        {
                            CallBase = true
                        }.Object;

                Assert.Equal(
                    "action",
                    Assert.Throws<ArgumentNullException>(() => mockExecutionStrategy.Execute(null)).ParamName);
            }
开发者ID:christiandpena,项目名称:entityframework,代码行数:12,代码来源:ExecutionStrategyBaseTests.cs

示例5: Execute_WhenStatusIsValidating

        public void Execute_WhenStatusIsValidating()
        {
            var mockEl = new Mock<DummyCompoundElement>();

            using (RecordExpectations recorder = RecorderManager.StartRecording())
            {
                recorder.ExpectAndReturn(mockEl.Status, ElementStatus.Validating).Repeat(4);
                mockEl.Cancel();
                mockEl.ExecutionProper();
            }

            mockEl.Execute();
            MockManager.Verify();
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:14,代码来源:Copy+of+CompoundElementBaseFixture.cs


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