コード例 #1
0
        public void It_Should_Derefence_A_Variable_Missing_Variable_As_None()
        {
            // Arrange
            var variableReference = new VariableReference("myvar");
            var templateContext   = new TemplateContext();

            // Act
            var result = variableReference.Eval(templateContext, new List <Option <ILiquidValue> >());

            // Assert
            Assert.That(result.SuccessResult.HasValue, Is.False);
        }
コード例 #2
0
        public void It_Should_Derefence_A_Variable()
        {
            // Arrange
            var variableReference = new VariableReference("myvar");
            var templateContext   = new TemplateContext();

            templateContext.DefineLocalVariable("myvar", LiquidString.Create("HELLO"));

            // Act
            var result = variableReference.Eval(templateContext, new List <Option <ILiquidValue> >()).SuccessValue <LiquidString>();

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