public void TestEquals() { var reference1 = new FeedReference { Source = FeedTest.Test1Uri, Architecture = new Architecture(OS.Windows, Cpu.I586), Languages = { "en-US" } }; var reference2 = new FeedReference { Source = FeedTest.Test1Uri, Architecture = new Architecture(OS.Windows, Cpu.I586), Languages = { "en-US" } }; reference2.Should().Be(reference1); reference2 = new FeedReference { Source = FeedTest.Test1Uri, Architecture = new Architecture(OS.Windows, Cpu.I586), Languages = { "de-DE" } }; reference2.Should().NotBe(reference1); reference2 = new FeedReference { Source = FeedTest.Test1Uri, Languages = { "en-US" } }; reference2.Should().NotBe(reference1); }
public void TestClone() { var reference1 = new FeedReference { Source = FeedTest.Test1Uri, Architecture = new Architecture(OS.Windows, Cpu.I586), Languages = { "en-US" } }; var reference2 = reference1.Clone(); // Ensure data stayed the same reference2.Should().Be(reference1, because: "Cloned objects should be equal."); reference2.GetHashCode().Should().Be(reference1.GetHashCode(), because: "Cloned objects' hashes should be equal."); ReferenceEquals(reference1, reference2).Should().BeFalse(because: "Cloning should not return the same reference."); }