Skip to content

Commit

Permalink
Update examples in README
Browse files Browse the repository at this point in the history
Update the examples in the README to reference the changes from #7.
  • Loading branch information
martincostello committed Aug 20, 2018
1 parent c959799 commit 5b45b9b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ namespace MyApp.Calculator
}
```

See [here](https://github.com/martincostello/xunit-logging/blob/master/tests/Logging.XUnit.Tests/Example.cs "Example test") for more examples.
See below for links to more examples:
1. [Unit tests](https://github.com/martincostello/xunit-logging/blob/master/tests/Logging.XUnit.Tests/Examples.cs "Unit test examples")
1. [Integration tests for an ASP.NET Core HTTP application](https://github.com/martincostello/xunit-logging/blob/master/tests/Logging.XUnit.Tests/Integration/HttpApplicationTests.cs "Integration test examples")

## Feedback

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,32 @@

namespace MartinCostello.Logging.XUnit
{
public class Example
public class Examples
{
public Example(ITestOutputHelper outputHelper)
public Examples(ITestOutputHelper outputHelper)
{
OutputHelper = outputHelper;
}

private ITestOutputHelper OutputHelper { get; }

[Fact]
public void Calculator_Sums_Two_Equal_Integers()
{
// Arrange using conversion to a logger
var calculator = new Calculator(OutputHelper.ToLogger<Calculator>());

// Act
int actual = calculator.Sum(2, 2);

// Assert
actual.ShouldBe(4);
}

[Fact]
public void Calculator_Sums_Two_Different_Integers()
{
// Arrange
// Arrange using the logging provider
var services = new ServiceCollection()
.AddLogging((builder) => builder.AddXUnit(OutputHelper))
.AddSingleton<Calculator>();
Expand All @@ -38,19 +51,6 @@ public void Calculator_Sums_Two_Different_Integers()
actual.ShouldBe(3);
}

[Fact]
public void Calculator_Sums_Two_Equal_Integers()
{
// Arrange
var calculator = new Calculator(OutputHelper.ToLogger<Calculator>());

// Act
int actual = calculator.Sum(2, 2);

// Assert
actual.ShouldBe(4);
}

private sealed class Calculator
{
private readonly ILogger _logger;
Expand Down

0 comments on commit 5b45b9b

Please sign in to comment.