Skip to content

Commit

Permalink
Rename namespace and class in README
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarmil committed Feb 10, 2022
1 parent eadbac7 commit 4809555
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ Diffract is a .NET library that displays a readable diff between two objects. It
Here is an example:

```csharp
using DEdge.Diffract;

record User(string Name, int Age, string[] Pets);

var expected = new User("Emma", 42, new[] { "Oscar", "Fluffy", "Tibbles" });
var actual = new User("Andy", 42, new[] { "Oscar", "Sparky" });

Diffract.Assert(expected, actual);
Differ.Assert(expected, actual);
```

The above throws an `AssertionFailedException` with the following message:
Expand Down Expand Up @@ -145,28 +147,28 @@ Value dictionary differs:

## API

Diffract provides the following methods:
Diffract lives in the namespace `DEdge.Diffract`. Its main API is the class `Differ`, which provides the following methods:

```csharp
void Diffract.Assert<T>(T expected, T actual, IDiffer<T> differ = null, PrintParams param = null)
void Assert<T>(T expected, T actual, IDiffer<T> differ = null, PrintParams param = null)
```

Computes the diff between two objects and, if it is not empty, throws an `AssertionFailedException` with the diff as message.

```csharp
string Diffract.ToString<T>(T expected, T actual, IDiffer<T> differ = null, PrintParams param = null)
string ToString<T>(T expected, T actual, IDiffer<T> differ = null, PrintParams param = null)
```

Prints the diff between two objects to a string.

```csharp
void Diffract.Write<T>(T expected, T actual, TextWriter writer = null, IDiffer<T> differ = null, PrintParams param = null)
void Write<T>(T expected, T actual, TextWriter writer = null, IDiffer<T> differ = null, PrintParams param = null)
```

Prints the diff between two objects to the given TextWriter (or to standard output if not provided).

```csharp
FSharpOption<Diff> Diffract.Diff<T>(T expected, T actual, IDiffer<T> differ = null)
FSharpOption<Diff> Diff<T>(T expected, T actual, IDiffer<T> differ = null)
```

Computes the diff between two objects. Returns `None` if the objects are found to be equal.

0 comments on commit 4809555

Please sign in to comment.