예제 #1
0
        public void Can_create_configuration_report()
        {
            var sut = ConfigurationReporter.CreateDefault();

            new ConfigurationBuilder(ConfigurationKeys("key1", "key2"), None)
            .WithConfigurationSource(new ConfigurationSourceStub(
                                         ("KEY2", "value")
                                         ))
            .WithConfigurations(new Dictionary <string, string>
            {
                { "key3", "value" }
            })
            .WithNamingConventions(NamingConvention.Default, NamingConvention.UseCustom(x => x.ToUpper()))
            .WithConfigurationReporter(sut)
            .Build();

            var report = sut.Report();

            _output.WriteLine(report);

            Assert.Equal(expected:
                         $"{NL}" +
                         $"key  source                  value   keys{NL}" +
                         $"-----------------------------------------------{NL}" +
                         $"key3 MANUAL                  value   {NL}" +
                         $"key1 ConfigurationSourceStub MISSING key1, KEY1{NL}" +
                         $"key2 ConfigurationSourceStub value   KEY2{NL}",
                         report);
        }
예제 #2
0
        public void Can_print_report()
        {
            var sut = ConfigurationReporter.CreateDefault();

            sut.AddMissing("key", "source", "key1", "key2");
            sut.AddValue("another key", "some other source", "value", "key1");
            sut.AddManual("group.id", "value");

            var report = sut.Report();

            _output.WriteLine(report);

            Assert.Equal(expected:
                         $"{NL}" +
                         $"key         source            value   keys{NL}" +
                         $"------------------------------------------------{NL}" +
                         $"key         source            MISSING key1, key2{NL}" +
                         $"another key some other source value   key1{NL}" +
                         $"group.id    MANUAL            value   {NL}",
                         report);
        }