Ejemplo n.º 1
0
        public void It_Should_Join_String_With_A_String()
        {
            // Arrange

            var filter = new JoinFilter(LiquidString.Create(", "));

            // Act
            var result = filter.Apply(new TemplateContext(), LiquidString.Create("Hello World")).SuccessValue <LiquidString>();

            // Assert
            Assert.That(result.Value, Is.EqualTo("H, e, l, l, o,  , W, o, r, l, d"));
        }
Ejemplo n.º 2
0
        public void It_Should_Join_String_With_A_String()
        {
            // Arrange
                
            var filter = new JoinFilter(new StringValue(", "));

            // Act
            var result = filter.Apply(new TemplateContext(), new StringValue("Hello World")).SuccessValue<StringValue>();

            // Assert
            Assert.That(result.Value, Is.EqualTo("H, e, l, l, o,  , W, o, r, l, d"));

        }
Ejemplo n.º 3
0
        public void It_Should_Join_An_Array_With_A_String()
        {
            // Arrange
            LiquidCollection liquidCollection = new LiquidCollection {
                LiquidString.Create("a string"),
                LiquidNumeric.Create(123),
                LiquidNumeric.Create(456m),
                new LiquidBoolean(false)
            };
            var filter = new JoinFilter(LiquidString.Create(", "));

            // Act
            var result = filter.Apply(new TemplateContext(), liquidCollection).SuccessValue <LiquidString>();

            //Logger.Log(result.ToString());

            // Assert
            Assert.That(result.StringVal, Is.EqualTo("a string, 123, 456.0, false"));
        }
Ejemplo n.º 4
0
        public void It_Should_Join_An_Array_With_A_String()
        {
            // Arrange
            IList<IExpressionConstant> objlist = new List<IExpressionConstant>
            {
                new StringValue("a string"), 
                NumericValue.Create(123), 
                NumericValue.Create(456m),
                new BooleanValue(false)
            };
            ArrayValue arrayValue = new ArrayValue(objlist);
            var filter = new JoinFilter(new StringValue(", "));

            // Act
            var result = filter.Apply(new TemplateContext(), arrayValue).SuccessValue<StringValue>();
            //Logger.Log(result.ToString());

            // Assert
            Assert.That(result.StringVal, Is.EqualTo("a string, 123, 456.0, false"));
     
        }