public void StringTestRightDollar(object parameter1, object parameter2, string expectedResult, bool throwsIllegalQuantity, bool throwsTypeMismatch) { var mismatchTypeExceptionThrown = false; var illegalQuantExceptionThrown = false; var sut = new RightDollar(); string result; try { result = sut.Execute(new List <Accumulator> { new Accumulator(parameter1), new Accumulator(parameter2) }) .ValueAsString(); Assert.AreEqual(expectedResult, result); } catch (ClassicBasic.Interpreter.Exceptions.IllegalQuantityException) { illegalQuantExceptionThrown = true; } catch (ClassicBasic.Interpreter.Exceptions.TypeMismatchException) { mismatchTypeExceptionThrown = true; } Assert.AreEqual(throwsIllegalQuantity, illegalQuantExceptionThrown, "Illegal quant"); Assert.AreEqual(throwsTypeMismatch, mismatchTypeExceptionThrown, "Mismatch"); }
public void StringTestRightDollarNeedsTwoParameters(int count, bool throwsException) { var sut = new RightDollar(); var parameters = new List <Accumulator> { new Accumulator("ABCDEF"), new Accumulator(3.0), new Accumulator(2.0), new Accumulator(3.0) }; var result = Test.Throws <SyntaxErrorException, Accumulator>( () => sut.Execute(parameters.Take(count).ToArray()), throwsException); }