Exemple #1
0
        public void SetFormatterMethod1SadPath()
        {
            var options = new TestFormattableLogProviderOptions();

            Action act = () => options.SetFormatter(null);

            act.Should().ThrowExactly <ArgumentNullException>().WithMessage("*formatter*");
        }
Exemple #2
0
        public void SetFormatterMethod2HappyPath()
        {
            var options = new TestFormattableLogProviderOptions();

            options.SetFormatter <TestLogFormatter>(123);

            var formatter = options.FormatterRegistration.Invoke(_emptyServiceProvider);

            formatter.Should().BeOfType <TestLogFormatter>()
            .Which.Foo.Should().Be(123);
        }
Exemple #3
0
        public void SetFormatterMethod1HappyPath()
        {
            var formatter = new Mock <ILogFormatter>().Object;

            var options = new TestFormattableLogProviderOptions();

            options.SetFormatter(formatter);

            var actualFormatter = options.FormatterRegistration.Invoke(_emptyServiceProvider);

            actualFormatter.Should().BeSameAs(formatter);
        }