コード例 #1
0
        public void SetFormatterMethod1SadPath()
        {
            var options = new TestFormattableLogProviderOptions();

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

            act.Should().ThrowExactly <ArgumentNullException>().WithMessage("*formatter*");
        }
コード例 #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);
        }
コード例 #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);
        }