Ejemplo n.º 1
0
        public void TimesWithDecimalPointFromObject(string input, string argument, decimal expectedResult)
        {
            var inputA  = NumberValue.Create(input);
            var inputB  = new FilterArguments(NumberValue.Create(argument));
            var context = new TemplateContext();

            var result = NumberFilters.Times(inputA, inputB, context);

            Assert.Equal(expectedResult, result.Result.ToNumberValue());
        }
Ejemplo n.º 2
0
        public void Times()
        {
            var input = new NumberValue(6);

            var arguments = new FilterArguments(3);
            var context   = new TemplateContext();

            var result = NumberFilters.Times(input, arguments, context);

            Assert.Equal(18, result.ToNumberValue());
        }
Ejemplo n.º 3
0
        public void OperationMaintainsScale()
        {
            var input = NumberValue.Create(6);

            var arguments = new FilterArguments(NumberValue.Create(3));
            var context   = new TemplateContext();

            var result = NumberFilters.Times(input, arguments, context);

            Assert.Equal("18", result.Result.ToStringValue());
        }
Ejemplo n.º 4
0
        public void TimesCanChangeToFloat()
        {
            var input = NumberValue.Create(6, true);

            var arguments = new FilterArguments(1.0);
            var context   = new TemplateContext();

            var result = NumberFilters.Times(input, arguments, context);

            Assert.Equal(6, result.ToNumberValue());
            Assert.False(((NumberValue)result).IsIntegral);
        }
Ejemplo n.º 5
0
        public void TimesMaintainsScale()
        {
            var input = NumberValue.Create(6);

            var arguments = new FilterArguments(1.0M);
            var context   = new TemplateContext();

            var result = NumberFilters.Times(input, arguments, context);

            Assert.Equal(6, result.ToNumberValue());
            Assert.Equal("6.0", result.ToStringValue());
        }