示例#1
0
        public void It_Should_Cast_A_String_To_An_Int(String input, int expected)
        {
            // Arrange
            var toIntFilter = new ToIntFilter();

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

            // Assert
            Assert.That(result.DecimalValue, Is.EqualTo((decimal)expected));
            Assert.That(result.IntValue, Is.EqualTo(expected));
        }
示例#2
0
        public void It_Should_Cast_A_Bool_To_An_Int(bool val, int expected)
        {
            // Arrange
            var toIntFilter = new ToIntFilter();

            // Act
            var result = toIntFilter.Apply(new TemplateContext(), new LiquidBoolean(val)).SuccessValue <LiquidNumeric>();

            // Assert
            Assert.That(result.DecimalValue, Is.EqualTo((decimal)expected));
            Assert.That(result.IntValue, Is.EqualTo(expected));
        }
        public void It_Should_Cast_A_String_To_An_Int(String input, int expected)
        {
            // Arrange
            var toIntFilter = new ToIntFilter();

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

            // Assert
            Assert.That(result.DecimalValue, Is.EqualTo((decimal) expected));
            Assert.That(result.IntValue, Is.EqualTo(expected));
        }