public void It_Should_Return_The_First_Char_Of_A_String() { // Arrange var filter = new FirstFilter(); // Act var result = filter.Apply(new TemplateContext(), LiquidString.Create("Hello World")).SuccessValue <LiquidString>(); // Assert Assert.Equal("H", result.Value); }
public void It_Should_Return_An_Error_If_String_Is_Null() // TODO: Check if this is the case { // Arrange var filter = new FirstFilter(); // Act var result = filter.Apply(new TemplateContext(), LiquidString.Create(null)); // Assert Assert.True(result.IsError); }
public void It_Should_Return_An_Error_If_Array_Is_Empty() // TODO: Check if this is the case { // Arrange LiquidCollection liquidCollection = new LiquidCollection(); var filter = new FirstFilter(); // Act var result = filter.Apply(new TemplateContext(), liquidCollection); // Assert Assert.True(result.IsError); }
public void It_Should_Return_An_Error_If_String_Is_Empty() // TODO: Check if this is the case { // Arrange var filter = new FirstFilter(); // Act var result = filter.Apply(new TemplateContext(), new StringValue("")); // Assert Assert.That(result.IsError, Is.True); }
public void It_Should_Return_The_First_Char_Of_A_String() { // Arrange var filter = new FirstFilter(); // Act var result = filter.Apply(new TemplateContext(), new StringValue("Hello World")).SuccessValue<StringValue>(); // Assert Assert.That(result.Value, Is.EqualTo("H")); }
public void It_Should_Return_An_Error_If_Array_Is_Empty() // TODO: Check if this is the case { // Arrange ArrayValue arrayValue = new ArrayValue(new List<IExpressionConstant>()); var filter = new FirstFilter(); // Act var result = filter.Apply(new TemplateContext(), arrayValue); // Assert Assert.That(result.IsError, Is.True); }
public void It_Should_Return_The_First_Element() { // Arrange LiquidCollection liquidCollection = new LiquidCollection { LiquidString.Create("a string"), LiquidNumeric.Create(123), LiquidNumeric.Create(456m), new LiquidBoolean(false) }; var filter = new FirstFilter(); // Act var result = filter.Apply(new TemplateContext(), liquidCollection).SuccessValue <LiquidString>(); // Assert Assert.Equal(liquidCollection[0], result); }
public void It_Should_Return_The_First_Element() { // 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 FirstFilter(); // Act var result = filter.Apply(new TemplateContext(), arrayValue).SuccessValue<StringValue>(); // Assert Assert.That(result, Is.EqualTo(objlist[0])); }