コード例 #1
0
        public void SharedDataSourceWithTwoParams_Next_Invoked_With_Wrapped_Up_SessionTwice()
        {
            SimpleMethodClass target = new SimpleMethodClass();
            mDoubleArgAction.Enact(mContext, target);

            mSourceMock.Verify(x => x.Next(It.Is<IGenerationContext>(y => y.Node is TypeMethodGenerationContextNode && y.Node.Parent == mParentNode)), Times.Exactly(2));
        }
コード例 #2
0
        public void Enact_SetsPropertyWithValue()
        {
            ObjectMethodInvokeActionAction<SimpleMethodClass> action = new ObjectMethodInvokeActionAction<SimpleMethodClass>(x => x.SetSomething("Something"));
            SimpleMethodClass target = new SimpleMethodClass();
            action.Enact(null, target);

            Assert.AreEqual("Something", target.Value);
        }
コード例 #3
0
        public void Enact_CallsFunc()
        {
            ObjectMethodInvokeFuncAction<SimpleMethodClass, String> action = new ObjectMethodInvokeFuncAction<SimpleMethodClass, String>(x => x.ReturnSomething());

            SimpleMethodClass target = new SimpleMethodClass();
            action.Enact(null, target);

            Assert.True(target.ReturnSomethingCalled);
        }
コード例 #4
0
        public void SharedDataSourceWithTwoParams_SecondParamPassedCorrectly()
        {
            SimpleMethodClass target = new SimpleMethodClass();
            int callCount = 0;
            mSourceMock.Setup(x => x.Next(It.IsAny<IGenerationContext>())).Returns(() =>
            {
                callCount++;
                return callCount.ToString();
            });

            mDoubleArgAction.Enact(mContext, target);

            Assert.AreEqual("2", target.OtherValue);
        }