public void ImplementsICruncherAutomator(CruncherAutomator cruncher) { // -- Arrange // -- Act // -- Assert Assert.IsAssignableFrom <ICruncherAutomator>(cruncher); }
public void ImplementsICruncherAutomator(CruncherAutomator cruncher) { // -- Arrange // -- Act // -- Assert Assert.IsAssignableFrom<ICruncherAutomator>(cruncher); }
public void GetResultThrowsInvalidCastExceptionWhenApplyIsNotCalled(CruncherAutomator automator) { // -- Arrange // -- Act var automator2 = automator.Process(new ParserResult("MULTIPLY", 4)) .Process(new ParserResult("SUBTRACT", 5)) .Process(new ParserResult("DIVIDE", 2)) .Process(new ParserResult("ADD", 8)); // -- Assert Assert.ThrowsAny<InvalidCastException>(() => automator2.GetResult()); }
public void GetResultThrowsInvalidCastExceptionWhenApplyIsNotCalled(CruncherAutomator automator) { // -- Arrange // -- Act var automator2 = automator.Process(new ParserResult("MULTIPLY", 4)) .Process(new ParserResult("SUBTRACT", 5)) .Process(new ParserResult("DIVIDE", 2)) .Process(new ParserResult("ADD", 8)); // -- Assert Assert.ThrowsAny <InvalidCastException>(() => automator2.GetResult()); }
public void CalculatesASimpleEquation( string[] input, decimal expected, [Frozen] Mock <IFile> fileMock, [Frozen(Matching.ImplementedInterfaces)] FileParser parser, [Frozen(Matching.ImplementedInterfaces)] CruncherAutomator cruncher, CalculatorService calculator) { // -- Arrange fileMock.Setup(m => m.ReadAllLines(It.IsAny <string>())).Returns(input); // -- Act var actual = calculator.Process(@"C:\fakePath.input"); // -- Assert Assert.Equal(expected, actual); }
public void CalculatesASimpleEquation( int applyValue, int multiplyValue, int subtractValue, int divideValue, int addValue, decimal expected, CruncherAutomator automator) { // -- Arrange // -- Act var actual = automator.Process(new ParserResult("MULTIPLY", multiplyValue)) .Process(new ParserResult("SUBTRACT", subtractValue)) .Process(new ParserResult("DIVIDE", divideValue)) .Process(new ParserResult("ADD", addValue)) .Process(new ParserResult("APPLY", applyValue)) .GetResult(); // -- Assert Assert.Equal(expected, actual); }