Exemple #1
0
        public void WhenInitializedWithoutConfiguration_ThenLoggingFilterIsEmpty()
        {
            var loggingConfiguration = new LoggingConfiguration();

            loggingConfiguration.ExcludeQueuesFromLogging().Should().BeEmpty();
            loggingConfiguration.ExcludeQueuesFromLogging().Count.Should().Be(0);
            loggingConfiguration.ExcludeTopicsFromLogging().Should().BeEmpty();
            loggingConfiguration.ExcludeTopicsFromLogging().Count.Should().Be(0);
        }
Exemple #2
0
        public void WhenInitializedWithEmptyConfiguration_ThenLoggingFilterIsEmpty()
        {
            var fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ConfigFileName);

            using (File.Create(Path.Combine(fileName)))
            {
            }

            var loggingConfiguration = new LoggingConfiguration();

            loggingConfiguration.ExcludeQueuesFromLogging().Should().BeEmpty();
            loggingConfiguration.ExcludeQueuesFromLogging().Count.Should().Be(0);
            loggingConfiguration.ExcludeTopicsFromLogging().Should().BeEmpty();
            loggingConfiguration.ExcludeTopicsFromLogging().Count.Should().Be(0);
        }
Exemple #3
0
        public void WhenInitializedWithCorrentKeyConfiguration_WithInvalidData_ThenLoggingFilterIsEmpty()
        {
            var fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ConfigFileName);

            using (FileStream fs = File.Create(Path.Combine(fileName)))
            {
                var content = new UTF8Encoding(true).GetBytes("{\"Exclude\": {\"Queues\": \"invalid\", \"Topics\": \"invalid\"}}");
                fs.Write(content, 0, content.Length);
            }

            var loggingConfiguration = new LoggingConfiguration();

            loggingConfiguration.ExcludeQueuesFromLogging().Should().BeEmpty();
            loggingConfiguration.ExcludeQueuesFromLogging().Count.Should().Be(0);
            loggingConfiguration.ExcludeTopicsFromLogging().Should().BeEmpty();
            loggingConfiguration.ExcludeTopicsFromLogging().Count.Should().Be(0);
        }
Exemple #4
0
        public void WhenInitializedWithCorrentKeyConfiguration_WithMixedValues_ThenLoggingFilterIsSet()
        {
            var fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ConfigFileName);

            using (FileStream fs = File.Create(Path.Combine(fileName)))
            {
                var content = new UTF8Encoding(true).GetBytes("{\"Exclude\": {\"Invalid\": \"Values\",\"Queues\": [\"\", \"testqueue\", \"       \", \"anothertestqueue\"], \"Topics\": [\"\", \"testtopic\", \"       \", \"anothertesttopic\"]}}");
                fs.Write(content, 0, content.Length);
            }

            var loggingConfiguration = new LoggingConfiguration();

            loggingConfiguration.ExcludeQueuesFromLogging().Should().BeEquivalentTo("testqueue", "anothertestqueue");
            loggingConfiguration.ExcludeQueuesFromLogging().Count.Should().Be(2);
            loggingConfiguration.ExcludeTopicsFromLogging().Should().BeEquivalentTo("testtopic", "anothertesttopic");
            loggingConfiguration.ExcludeTopicsFromLogging().Count.Should().Be(2);
        }