Esempio n. 1
0
        public void SetFormatterMethod1SadPath()
        {
            var options = new TestFormattableLogProviderOptions();

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

            act.Should().ThrowExactly <ArgumentNullException>().WithMessage("*formatter*");
        }
Esempio n. 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);
        }
Esempio n. 3
0
        public void SetTemplateMethodHappyPath()
        {
            var options = new TestFormattableLogProviderOptions();

            options.SetTemplate("foo");

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

            formatter.Should().BeOfType <TemplateLogFormatter>()
            .Which.Template.Should().Be("foo");
        }
Esempio n. 4
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);
        }