예제 #1
0
        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);
        }
예제 #2
0
        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");
        }