public void It_Should_Compose_Functions_Together()
        {
            // Arrange
            var removeFilter = new RemoveFilter(new StringValue("123"));
            var upCase = new UpCaseFilter();
            var filterList = new List<IFilterExpression> {removeFilter, upCase};
            var compositeFilterFn = FilterChain.CreateChain(new TemplateContext(), filterList);

            // Act
            var result = compositeFilterFn(new StringValue("test123")).SuccessValue<StringValue>();

            // Assert
            Assert.That(result.Value, Is.EqualTo("TEST"));

        }
Exemple #2
0
        public void It_Should_Compose_Functions_Together()
        {
            // Arrange
            var removeFilter = new RemoveFilter(LiquidString.Create("123"));
            var upCase       = new UpCaseFilter();
            var filterList   = new List <IFilterExpression> {
                removeFilter, upCase
            };
            var compositeFilterFn = FilterChain.CreateChain(new TemplateContext(), filterList);

            // Act
            var result = compositeFilterFn(LiquidString.Create("test123")).SuccessValue <LiquidString>();

            // Assert
            Assert.That(result.Value, Is.EqualTo("TEST"));
        }