コード例 #1
0
        public void It_Should_Cast_An_Int_To_A_String_Like_Ruby_Liquid(int input, String expected)
        {
            // Arrange
            var castFilter = new CastFilter <LiquidNumeric, LiquidString>();

            // Act
            var result = castFilter.Apply(new TemplateContext(), LiquidNumeric.Create(input)).SuccessValue <LiquidString>();

            // Assert
            Assert.That(result.StringVal, Is.EqualTo(expected));
        }
コード例 #2
0
        public void It_Should_Cast_A_Decimal_To_A_String_Like_Ruby_Liquid(decimal input, String expected)
        {
            // Arrange
            var castFilter = new CastFilter <LiquidNumeric, LiquidString>();

            // Act
            var result = castFilter.Apply(new TemplateContext(), LiquidNumeric.Create(input)).SuccessValue <LiquidString>();

            // Assert
            Assert.Equal(expected, result.StringVal);
        }
コード例 #3
0
        public void It_Should_Cast_An_Int_To_A_String_Like_Ruby_Liquid(int input, String expected)
        {
            // Arrange
            var castFilter = new CastFilter<NumericValue, StringValue>();

            // Act
            var result = castFilter.Apply(new TemplateContext(), NumericValue.Create(input)).SuccessValue<StringValue>();

            // Assert
            Assert.That(result.StringVal, Is.EqualTo(expected));


        }
コード例 #4
0
        public void It_Should_Cast_The_Value_From_One_Type_To_Another()
        {
            // Arrange
            var castFilter = new CastFilter <LiquidString, LiquidNumeric>();
            var inputObj   = LiquidString.Create("123");

            // Act
            var result = castFilter.Apply(new TemplateContext(), inputObj).SuccessValue <LiquidNumeric>();

            //result.Eval(new SymbolTableStack(new TemplateContext()), new List<ILiquidValue>());

            // Assert
            Assert.That(result, Is.AssignableTo <LiquidNumeric>());
            Assert.That(result.DecimalValue, Is.EqualTo(123m));
        }
コード例 #5
0
        public void It_Should_Cast_The_Value_From_One_Type_To_Another()
        {
            // Arrange
            var castFilter = new CastFilter<StringValue, NumericValue>();
            var inputObj = new StringValue("123");

            // Act
            var result = castFilter.Apply(new TemplateContext(),inputObj).SuccessValue<NumericValue>();
            //result.Eval(new SymbolTableStack(new TemplateContext()), new List<IExpressionConstant>());

            // Assert
            Assert.That(result, Is.AssignableTo<NumericValue>());
            Assert.That(result.DecimalValue, Is.EqualTo(123m));

        }