public void StringTestStrDollarNeedsOneParameters(int count, bool throwsException) { var sut = new StrDollar(); var parameters = new List <Accumulator> { new Accumulator(4.4), new Accumulator(3.0), }; var result = Test.Throws <SyntaxErrorException, Accumulator>( () => sut.Execute(parameters.Take(count).ToArray()), throwsException); }
public void StringTestStrDollar(object parameter, string expectedResult, bool throwsTypeMismatch) { var mismatchTypeExceptionThrown = false; var sut = new StrDollar(); string result; try { result = sut.Execute(new List <Accumulator> { new Accumulator(parameter) }).ValueAsString(); Assert.AreEqual(expectedResult, result); } catch (ClassicBasic.Interpreter.Exceptions.TypeMismatchException) { mismatchTypeExceptionThrown = true; } Assert.AreEqual(throwsTypeMismatch, mismatchTypeExceptionThrown, "Mismatch"); }