Aspects.Logging.Tests.Configuration.Concrete.ConfigFileConfigurationProviderTests.WhenPassingInAConfigurationWithAnInvalidLoggerShouldThrowException C# (CSharp) Méthode

WhenPassingInAConfigurationWithAnInvalidLoggerShouldThrowException() private méthode

        public void WhenPassingInAConfigurationWithAnInvalidLoggerShouldThrowException()
        {
            ConfigFileConfigurationProvider sut = new ConfigFileConfigurationProvider();
            Mock<IConfigFileSource> mock = new Mock<IConfigFileSource>();
            mock.Setup(source => source.Logger).Returns("NonViableType");
            mock.Setup(source => source.UseConsoleLogger).Returns(false);
            mock.Setup(source => source.IsEnabled).Returns(true);
            sut.ConfigFileSource = mock.Object;

            ILogger result = null;
            try
            {
                result = sut.GetLogger();
            }
            catch (Exception e)
            {
                e.Should().BeOfType<ConfigurationErrorsException>();
            }

            result.Should().BeNull("Because an exception has been thrown");
        }