예제 #1
0
        public void Should_Fail_On_Empty_Expression()
        {
            var sut = new ConstantParserPart();

            Assert.Throws <ArgumentException>(() => sut.TryParse(null, 1, out _));
            Assert.Throws <ArgumentException>(() => sut.TryParse(string.Empty, 1, out _));
            Assert.Throws <ArgumentException>(() => sut.TryParse(" ", 1, out _));
        }
예제 #2
0
        public void Should_Parse_Constants(string expression, decimal expectedValue)
        {
            var sut        = new ConstantParserPart();
            var couldParse = sut.TryParse(expression, 0, out var symbol);

            Assert.True(couldParse);

            Assert.Equal(SymbolType.Constant, symbol.Type);
            Assert.Equal(expectedValue, symbol.Value);
        }