public void StringTestCharDollar(object parameter, string expectedResult, bool throwsIllegalQuantity, bool throwsTypeMismatch) { var mismatchTypeExceptionThrown = false; var illegalQuantExceptionThrown = false; var sut = new CharDollar(); string result; try { result = sut.Execute(new List <Accumulator> { new Accumulator(parameter) }).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 StringTestCharDollarNeedsOneParameter(int count, bool throwsException) { var sut = new CharDollar(); var parameters = new List <Accumulator> { }; for (int i = 0; i < count; i++) { parameters.Add(new Accumulator(3.0)); } var result = Test.Throws <SyntaxErrorException, Accumulator>( () => sut.Execute(parameters), throwsException); }