Created
September 9, 2016 23:04
-
-
Save cmellongoempyrean/bdb3c63a3755d7f27c0751919cbc93ea to your computer and use it in GitHub Desktop.
ExcludingNestedObjects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Run-time exception (line 35): Expected member Nested to be | |
Obj | |
{ | |
Nested = <null> | |
Str = "test" | |
}, but found <null>. | |
With configuration: | |
- Use declared types and members | |
- Compare enums by value | |
- Match member by name (or throw) | |
- Be strict about the order of items in byte arrays | |
Stack Trace: | |
[NUnit.Framework.AssertionException: Expected member Nested to be | |
Obj | |
{ | |
Nested = <null> | |
Str = "test" | |
}, but found <null>. | |
With configuration: | |
- Use declared types and members | |
- Compare enums by value | |
- Match member by name (or throw) | |
- Be strict about the order of items in byte arrays | |
] | |
at Program.Main(): line 35 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using FluentAssertions; | |
public class Obj | |
{ | |
public string Str | |
{ | |
get; | |
set; | |
} | |
public Obj Nested | |
{ | |
get; | |
set; | |
} | |
} | |
public class Program | |
{ | |
public static void Main() | |
{ | |
var first = new Obj() | |
{ | |
Nested = null, Str = "test" | |
} | |
; | |
var second = new Obj() | |
{ | |
Nested = first, Str = "test" | |
} | |
; | |
first.ShouldBeEquivalentTo(second, o => o.ExcludingNestedObjects()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment