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 SimpleMethodClass_Invoke_CallsMethodWithoutParams() { SimpleMethodClass target = mSession.Single <SimpleMethodClass>() .Invoke(x => x.ReturnSomething()) .Get(); Assert.AreEqual(true, target.ReturnSomethingCalled); }
public void SimpleMethodClass_Invoke_CallsMethodWithParams() { SimpleMethodClass target = mSession.Single <SimpleMethodClass>() .Invoke(x => x.SetSomething("Something")) .Get(); Assert.AreEqual("Something", target.Value); }
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); }
public void Single_SimpleMethodClass_SetSomething_SetsOtherValueCorrectlyFromSource() { SimpleMethodClass result = mSession.Single <SimpleMethodClass>().Get(); Assert.IsTrue(result.OtherValue.Length >= 2); }
public void Single_SimpleMethodClass_ReturnSomething_Invoked() { SimpleMethodClass result = mSession.Single <SimpleMethodClass>().Get(); Assert.True(result.ReturnSomethingCalled); }