public void TestEquality() { var a = new DocumentNode(@"C:\dir\solution\.localhistory", @"C:\dir\solution\folder", @"file.txt", new DateTime(2019, 11, 15, 14, 26, 33)); var b = new DocumentNode(@"C:\dir\solution\.localhistory", @"C:\dir\solution\folder", @"file.txt", new DateTime(2019, 11, 15, 14, 26, 33)); (a == b).Should().BeTrue(); (a != b).Should().BeFalse(); a.Should().Equals(b); a.GetHashCode().Should().Be(b.GetHashCode()); a = new DocumentNode(@"C:\dir\solution\.localhistory", @"C:\dir\solution\folder", @"file.txt", "1572363632", "aaa"); b = new DocumentNode(@"C:\dir\solution\.localhistory", @"C:\dir\solution\folder", @"file.txt", "1572363632", "bbb"); (a == b).Should().BeTrue(); (a != b).Should().BeFalse(); a.Should().Equals(b); a.GetHashCode().Should().Be(b.GetHashCode()); a = new DocumentNode(@"C:\dir\solution\.localhistory", @"C:\dir\solution\folder", @"aaa.txt", "1572363632"); b = new DocumentNode(@"C:\dir\solution\.localhistory", @"C:\dir\solution\folder", @"bbv.txt", "1572363632"); (a == b).Should().BeFalse(); (a != b).Should().BeTrue(); a.Should().NotBeEquivalentTo(b); a.GetHashCode().Should().NotBe(b.GetHashCode()); a = new DocumentNode(@"C:\dir\solution\.localhistory", @"C:\dir\solution\aaa", @"file.txt", "1572363632"); b = new DocumentNode(@"C:\dir\solution\.localhistory", @"C:\dir\solution\bbb", @"file.txt", "1572363632"); (a == b).Should().BeFalse(); (a != b).Should().BeTrue(); a.Should().NotBeEquivalentTo(b); a.GetHashCode().Should().NotBe(b.GetHashCode()); a = new DocumentNode(@"C:\dir\aaa\.localhistory", @"C:\dir\solution\folder", @"file.txt", "1572363632"); b = new DocumentNode(@"C:\dir\bbb\.localhistory", @"C:\dir\solution\folder", @"file.txt", "1572363632"); (a == b).Should().BeTrue(); (a != b).Should().BeFalse(); a.Should().Equals(b); a.GetHashCode().Should().Be(b.GetHashCode()); a = new DocumentNode(@"C:\dir\solution\.localhistory", @"C:\dir\solution\folder", @"FILE.txt", new DateTime(2019, 11, 15, 14, 26, 33)); b = new DocumentNode(@"C:\dir\solution\.localhistory", @"C:\dir\solution\folder", @"file.txt", new DateTime(2019, 11, 15, 14, 26, 33)); (a == b).Should().BeTrue(); (a != b).Should().BeFalse(); a.Should().Equals(b); a.GetHashCode().Should().Be(b.GetHashCode()); a = null; b = null; (a == b).Should().BeTrue(); (a != b).Should().BeFalse(); }