@@ -18,12 +18,14 @@ Diffract is a .NET library that displays a readable diff between two objects. It
18
18
Here is an example:
19
19
20
20
``` csharp
21
+ using DEdge .Diffract ;
22
+
21
23
record User (string Name , int Age , string [] Pets );
22
24
23
25
var expected = new User (" Emma" , 42 , new [] { " Oscar" , " Fluffy" , " Tibbles" });
24
26
var actual = new User (" Andy" , 42 , new [] { " Oscar" , " Sparky" });
25
27
26
- Diffract .Assert (expected , actual );
28
+ Differ .Assert (expected , actual );
27
29
```
28
30
29
31
The above throws an ` AssertionFailedException ` with the following message:
@@ -145,28 +147,28 @@ Value dictionary differs:
145
147
146
148
## API
147
149
148
- Diffract provides the following methods:
150
+ Diffract lives in the namespace ` DEdge.Diffract ` . Its main API is the class ` Differ ` , which provides the following methods:
149
151
150
152
``` csharp
151
- void Diffract . Assert <T >(T expected , T actual , IDiffer < T > differ = null , PrintParams param = null )
153
+ void Assert <T >(T expected , T actual , IDiffer < T > differ = null , PrintParams param = null )
152
154
```
153
155
154
156
Computes the diff between two objects and, if it is not empty, throws an ` AssertionFailedException ` with the diff as message.
155
157
156
158
``` csharp
157
- string Diffract . ToString <T >(T expected , T actual , IDiffer < T > differ = null , PrintParams param = null )
159
+ string ToString <T >(T expected , T actual , IDiffer < T > differ = null , PrintParams param = null )
158
160
```
159
161
160
162
Prints the diff between two objects to a string.
161
163
162
164
``` csharp
163
- void Diffract . Write <T >(T expected , T actual , TextWriter writer = null , IDiffer < T > differ = null , PrintParams param = null )
165
+ void Write <T >(T expected , T actual , TextWriter writer = null , IDiffer < T > differ = null , PrintParams param = null )
164
166
```
165
167
166
168
Prints the diff between two objects to the given TextWriter (or to standard output if not provided).
167
169
168
170
``` csharp
169
- FSharpOption < Diff > Diffract . Diff <T >(T expected , T actual , IDiffer < T > differ = null )
171
+ FSharpOption < Diff > Diff <T >(T expected , T actual , IDiffer < T > differ = null )
170
172
```
171
173
172
174
Computes the diff between two objects. Returns ` None ` if the objects are found to be equal.
0 commit comments