Created
December 16, 2015 09:54
-
-
Save heemskerkerik/ab0531f45bf61f97fd14 to your computer and use it in GitHub Desktop.
Failing test for FluentAssertions (tested with 4.1.1, but seen in earlier versions as well). When explicitly using Including(), another property with a similar name is also matched, and the match subsequently fails.
This file contains hidden or 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 FluentAssertions; | |
using Xunit; | |
// ReSharper disable InconsistentNaming | |
namespace FluentAssertionsBugProof | |
{ | |
public class ShouldBeEquivalentToTest | |
{ | |
[Fact] | |
public void ShouldBeEquivalent_NoInheritance_SimilarPropertyNames_DoesNotThrow() | |
{ | |
var x = new TestNoInheritance | |
{ | |
DeclaredType = LocalOtherType.NonDefault, | |
Type = LocalType.NonDefault, | |
}; | |
x.ShouldBeEquivalentTo(new TestNoInheritance | |
{ | |
DeclaredType = LocalOtherType.NonDefault, | |
}, | |
config => config.Including(o => o.DeclaredType)); | |
} | |
[Fact] | |
public void ShouldBeEquivalent_NoInheritance_DifferentPropertyNames_DoesNotThrow() | |
{ | |
var x = new TestNoInheritanceDifferentNames | |
{ | |
DeclaredType = LocalOtherType.NonDefault, | |
InheritedType = LocalType.NonDefault, | |
}; | |
x.ShouldBeEquivalentTo(new TestNoInheritanceDifferentNames | |
{ | |
DeclaredType = LocalOtherType.NonDefault, | |
}, | |
config => config.Including(o => o.DeclaredType)); | |
} | |
} | |
public class TestNoInheritance | |
{ | |
public LocalType Type { get; set; } | |
public LocalOtherType DeclaredType { get; set; } | |
} | |
public class TestNoInheritanceDifferentNames | |
{ | |
public LocalType InheritedType { get; set; } | |
public LocalOtherType DeclaredType { get; set; } | |
} | |
public enum LocalOtherType: byte | |
{ | |
Default, | |
NonDefault, | |
} | |
public enum LocalType: byte | |
{ | |
Default, | |
NonDefault, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment