public void Initialize_WithNullConfiguration_ThrowsException()
        {
            // Arrange
            var provider = new FakeConsoleLoggingProvider();
            NameValueCollection invalidConfiguration = null;

            // Act
            provider.Initialize("Valid provider name", invalidConfiguration);
        }
        public void Initialize_WithValidArguments_Succeeds()
        {
            // Arrange
            var provider           = new FakeConsoleLoggingProvider();
            var validConfiguration = CreateValidConfiguration();

            // Act
            provider.Initialize("Valid provider name", validConfiguration);
        }
        public void Log_CorrectlyInitializedProvider_Succeeds()
        {
            // Arrange
            var provider = new FakeConsoleLoggingProvider();

            provider.Initialize("Valid name", CreateValidConfiguration());

            // Act
            provider.Log("Some message");
        }
        public void Initialize_ConfigurationWithUnrecognizedAttributes_ThrowsException()
        {
            // Arrange
            var provider = new FakeConsoleLoggingProvider();
            var configurationWithUnrecognizedAttribute = CreateValidConfiguration();

            configurationWithUnrecognizedAttribute.Add("unknown attribute", "some value");

            // Act
            provider.Initialize("Valid provider name", configurationWithUnrecognizedAttribute);
        }
        public void Log_WithValidEntry_WritesExpectedTextToConsole()
        {
            // Arrange
            var provider           = new FakeConsoleLoggingProvider();
            var validConfiguration = new NameValueCollection();

            provider.Initialize("Valid provider name", validConfiguration);
            var expectedText =
                "LoggingEvent:\r\n" +
                "Severity:\tError\r\n" +
                "Message:\tValid message\r\n";

            // Act
            provider.Log(LoggingEventType.Error, "Valid message");

            // Assert
            string actualText = provider.TextWrittenToConsole;

            Assert.AreEqual(expectedText, actualText);
        }