public void For_Func2_ExpectReturns() { var expectText = "__ExpectText2__"; staticMock.For(() => Tests.StaticClass.FuncMethod(1)).Returns(expectText); var text = StaticClass.FuncMethod1(1); Assert.That(text, Is.EqualTo(expectText)); }
public void ThrowsForAll_Default_ExpectException() { var specifiedText = "__NORMAL__"; var exceptionMessage = "Boom!"; staticMock.For(() => Tests.StaticClass.FuncMethod(0)).Returns(specifiedText); staticMock.ThrowsForAll(new Exception(exceptionMessage)); var ex = Assert.Throws <Exception>(() => StaticClass.FuncMethod1(1)); Assert.That(ex.Message, Is.EqualTo(exceptionMessage)); }
public void ReturnsForAll_Default_ExpectNormal() { var specifiedText = "__NORMAL__"; var defaultText = "__DEFAULT__"; staticMock.For(() => Tests.StaticClass.FuncMethod(0)).Returns(specifiedText); staticMock.ReturnsForAll(defaultText); var text = StaticClass.FuncMethod1(0); Assert.That(text, Is.EqualTo(specifiedText)); }