Here are the examples of the csharp api MartinCostello.Logging.XUnit.IntegrationTests.BootstrapBuilder(Action) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
4 Examples
19
Source : IntegrationTests.cs
with Apache License 2.0
from martincostello
with Apache License 2.0
from martincostello
[Fact]
public static void Can_Configure_xunit_For_ILoggerBuilder_TestOutputHelper()
{
// Arrange
var mock = new Mock<ITestOutputHelper>();
var logger = BootstrapBuilder((builder) => builder.AddXUnit(mock.Object));
// Act
logger.LogError("This is a brand new problem, a problem without any clues.");
logger.LogInformation("If you know the clues, it's easy to get through.");
// replacedert
mock.Verify((p) => p.WriteLine(It.IsNotNull<string>()), Times.Exactly(2));
}
19
Source : IntegrationTests.cs
with Apache License 2.0
from martincostello
with Apache License 2.0
from martincostello
[Fact]
public static void Can_Configure_xunit_For_ILoggerBuilder_TestOutputHelper_With_Configuration()
{
// Arrange
var mock = new Mock<ITestOutputHelper>();
var logger = BootstrapBuilder(
(builder) =>
{
builder.AddXUnit(
mock.Object,
(options) => options.Filter = (_, level) => level >= LogLevel.Error);
});
// Act
logger.LogError("This is a brand new problem, a problem without any clues.");
logger.LogTrace("If you know the clues, it's easy to get through.");
// replacedert
mock.Verify((p) => p.WriteLine(It.IsNotNull<string>()), Times.Once());
}
19
Source : IntegrationTests.cs
with Apache License 2.0
from martincostello
with Apache License 2.0
from martincostello
[Fact]
public static void Can_Configure_xunit_For_ILoggerBuilderAccessor_TestOutputHelper()
{
// Arrange
var mockOutputHelper = new Mock<ITestOutputHelper>();
var outputHelper = mockOutputHelper.Object;
var mockAccessor = new Mock<ITestOutputHelperAccessor>();
mockAccessor
.Setup((p) => p.OutputHelper)
.Returns(outputHelper);
var accessor = mockAccessor.Object;
var logger = BootstrapBuilder((builder) => builder.AddXUnit(accessor));
// Act
logger.LogError("This is a brand new problem, a problem without any clues.");
logger.LogInformation("If you know the clues, it's easy to get through.");
// replacedert
mockOutputHelper.Verify((p) => p.WriteLine(It.IsNotNull<string>()), Times.Exactly(2));
}
19
Source : IntegrationTests.cs
with Apache License 2.0
from martincostello
with Apache License 2.0
from martincostello
[Fact]
public static void Can_Configure_xunit_For_ILoggerBuilder_TestOutputHelperAccessor_With_Configuration()
{
// Arrange
var mockOutputHelper = new Mock<ITestOutputHelper>();
var outputHelper = mockOutputHelper.Object;
var mockAccessor = new Mock<ITestOutputHelperAccessor>();
mockAccessor
.Setup((p) => p.OutputHelper)
.Returns(outputHelper);
var accessor = mockAccessor.Object;
var logger = BootstrapBuilder(
(builder) =>
{
builder.AddXUnit(
mockOutputHelper.Object,
(options) => options.Filter = (_, level) => level >= LogLevel.Error);
});
// Act
logger.LogError("This is a brand new problem, a problem without any clues.");
logger.LogTrace("If you know the clues, it's easy to get through.");
// replacedert
mockOutputHelper.Verify((p) => p.WriteLine(It.IsNotNull<string>()), Times.Once());
}