public void Hashes_should_be_equal()
        {
            var hash1 = ConversionPattern.Parse("%l %m").GetHashCode();
            var hash2 = ConversionPattern.Create().AddLevel().AddText(" ").AddMessage().Build().GetHashCode();

            hash1.Should().Be(hash2);
        }
        public void Should_parse_multiple_values_pattern()
        {
            const string pattern           = "start %d %D(yyyy-MM-dd) %l %P %p(prop)%p(prop2:format) message: %M%N %e%n end";
            var          conversionPattern = ConversionPatternParser.Parse(pattern);

            conversionPattern.ToString().Should().Be("start %d %d(yyyy-MM-dd) %l %p %p(prop)%p(prop2:format) message: %m%n %e%n end");

            conversionPattern.Should()
            .BeEquivalentTo(
                ConversionPattern.Create()
                .AddText("start ")
                .AddDateTime()
                .AddText(" ")
                .AddDateTime("yyyy-MM-dd")
                .AddText(" ")
                .AddLevel()
                .AddText(" ")
                .AddProperties()
                .AddText(" ")
                .AddProperty("prop")
                .AddProperty("prop2", "format")
                .AddText(" message: ")
                .AddMessage()
                .AddNewLine()
                .AddText(" ")
                .AddException()
                .AddNewLine()
                .AddText(" end")
                .Build());
        }
        public void Should_be_equal_by_values()
        {
            var pattern1 = ConversionPattern.Parse("%l %m");
            var pattern2 = ConversionPattern.Create().AddLevel().AddText(" ").AddMessage().Build();

            pattern1.Equals(pattern2).Should().BeTrue();
            pattern2.Equals(pattern1).Should().BeTrue();
        }
        public void ToString_should_return_right_string()
        {
            ConversionPattern.Create().AddDateTime().Build().ToString().Should().Be("%d");

            ConversionPattern.Create()
            .AddText("test: ")
            .AddDateTime()
            .AddText(" ")
            .AddLevel()
            .AddText(" ")
            .AddProperty("logging.prefix")
            .AddText(" ")
            .AddMessage()
            .AddNewLine()
            .AddException()
            .AddNewLine()
            .Build().ToString().Should().Be("test: %d %l %p(logging.prefix) %m%n%e%n");
        }
 public void AddText_should_add_TextFragment()
 {
     ConversionPattern.Create().AddText("text").Build()
     .Should().Be(ConversionPattern.Parse("text"));
 }
 public void AddProperty_should_add_PropertyFragment_with_format()
 {
     ConversionPattern.Create().AddProperty("name", "format").Build()
     .Should().Be(ConversionPattern.Parse("%p(name:format)"));
 }
 public void AddProperty_should_add_PropertyFragment()
 {
     ConversionPattern.Create().AddProperty("name").Build()
     .Should().Be(ConversionPattern.Parse("%p(name)"));
 }
 public void AddProperties_should_add_PropertiesFragment()
 {
     ConversionPattern.Create().AddProperties().Build()
     .Should().Be(ConversionPattern.Parse("%p"));
 }
 public void AddNewLine_should_add_NewLineFragment()
 {
     ConversionPattern.Create().AddNewLine().Build()
     .Should().Be(ConversionPattern.Parse("%n"));
 }
 public void AddMessage_should_add_MessageFragment()
 {
     ConversionPattern.Create().AddMessage().Build()
     .Should().Be(ConversionPattern.Parse("%m"));
 }
 public void AddLevel_should_add_LevelFragment()
 {
     ConversionPattern.Create().AddLevel().Build()
     .Should().Be(ConversionPattern.Parse("%l"));
 }
 public void AddException_should_add_ExceptionFragment()
 {
     ConversionPattern.Create().AddException().Build()
     .Should().Be(ConversionPattern.Parse("%e"));
 }
 public void AddDateTime_should_add_DateTimeFragment_with_format()
 {
     ConversionPattern.Create().AddDateTime("yyyy").Build()
     .Should().Be(ConversionPattern.Parse("%d(yyyy)"));
 }
 public void AddDateTime_should_add_DateTimeFragment()
 {
     ConversionPattern.Create().AddDateTime().Build()
     .Should().Be(ConversionPattern.Parse("%d"));
 }
 public void Shuld_parse_empty_pattern_to_empty_result()
 {
     ConversionPatternParser.Parse(string.Empty).Should()
     .BeEquivalentTo(ConversionPattern.Create().Build());
 }