public void StringTestAsc(object parameter, short expectedResult, bool throwsIllegalQuantity, bool throwsTypeMismatch) { var mismatchTypeExceptionThrown = false; var illegalQuantExceptionThrown = false; var sut = new Asc(); short result; try { result = sut.Execute(new List <Accumulator> { new Accumulator(parameter) }).ValueAsShort(); 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 StringTestAscNeedsOneParameter(int count, bool throwsException) { var sut = new Asc(); var parameters = new List <Accumulator> { }; for (int i = 0; i < count; i++) { parameters.Add(new Accumulator("A")); } var result = Test.Throws <SyntaxErrorException, Accumulator>( () => sut.Execute(parameters), throwsException); }