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)); }
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); }
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); }
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); }