public void ThrowIfNoStepInVeryStrictMode() { var methodMock = new FuncMethodMock <string>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.VeryStrict); var ex = Assert.Throws <MockMissingException>(() => methodMock.Call()); Assert.Equal(MockType.Method, ex.MemberType); }
public void ReturnDefaultIfNoStepInLenientMode() { var methodMock = new FuncMethodMock <string>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient); string result = methodMock.Call(); Assert.Null(result); }
public void ThrowIfClearedInVeryStrictMode() { var methodMock = new FuncMethodMock <string>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.VeryStrict); var nextStep = NextStepFor(methodMock, "5"); methodMock.Clear(); var ex = Assert.Throws <MockMissingException>(() => methodMock.Call()); Assert.Equal(MockType.Method, ex.MemberType); Assert.Equal(0, nextStep.Count); }
public void ReturnDefaultIfClearedInLenientMode() { var methodMock = new FuncMethodMock <string>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient); var nextStep = NextStepFor(methodMock, "5"); methodMock.Clear(); string result = methodMock.Call(); Assert.Equal(0, nextStep.Count); Assert.Null(result); }
public void SendMockInformationToStepAndGetResultBack() { var methodMock = new FuncMethodMock <string>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient); var nextStep = NextStepFor(methodMock, "5"); string result = methodMock.Call(); Assert.Equal(1, nextStep.Count); Assert.Same(methodMock, nextStep.LastMockInfo); Assert.Equal("5", result); }
public FuncMethodMockSetNextStepTests() { _parameterLessFuncMock = new FuncMethodMock <string>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient); _funcMock = new FuncMethodMock <int, string>(new object(), "ClassName", "InterfaceName", "MemberName", "MockName", Strictness.Lenient); }