public void TrimStringHelper1Arg()
        {
            var template = HandlebarsDotNet.Handlebars.Compile("{{substring $Level}}");
            var data     = Some.LogEvent();
            var result   = EmailApp.FormatTemplate(template, data, Some.Host());

            Assert.Equal("Fatal", result);
        }
        public void IfEqHelperDetectsInequality()
        {
            var template = HandlebarsDotNet.Handlebars.Compile("{{#if_eq $Level \"Warning\"}}True{{/if_eq}}");
            var data     = Some.LogEvent();
            var result   = EmailApp.FormatTemplate(template, data, Some.Host());

            Assert.Equal("", result);
        }
        public void BuiltInPropertiesAreRenderedInTemplates()
        {
            var template = HandlebarsDotNet.Handlebars.Compile("{{$Level}}");
            var data     = Some.LogEvent();
            var result   = EmailApp.FormatTemplate(template, data, Some.Host());

            Assert.Equal(data.Data.Level.ToString(), result);
        }
        public void PayloadPropertiesAreRenderedInTemplates()
        {
            var template = HandlebarsDotNet.Handlebars.Compile("See {{What}}");
            var data     = Some.LogEvent(new Dictionary <string, object> {
                { "What", 10 }
            });
            var result = EmailApp.FormatTemplate(template, data, Some.Host());

            Assert.Equal("See 10", result);
        }
        public void NoPropertiesAreRequiredOnASourceEvent()
        {
            var template  = HandlebarsDotNet.Handlebars.Compile("No properties");
            var id        = Some.EventId();
            var timestamp = Some.UtcTimestamp();
            var data      = new Event <LogEventData>(id, Some.EventType(), timestamp, new LogEventData
            {
                Exception       = null,
                Id              = id,
                Level           = LogEventLevel.Fatal,
                LocalTimestamp  = new DateTimeOffset(timestamp),
                MessageTemplate = "Some text",
                RenderedMessage = "Some text",
                Properties      = null
            });
            var result = EmailApp.FormatTemplate(template, data, Some.Host());

            Assert.Equal("No properties", result);
        }