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" } }; Assert.AreEqual(reference1, reference2); reference2 = new FeedReference { Source = FeedTest.Test1Uri, Architecture = new Architecture(OS.Windows, Cpu.I586), Languages = { "de-DE" } }; Assert.AreNotEqual(reference1, reference2); reference2 = new FeedReference { Source = FeedTest.Test1Uri, Languages = { "en-US" } }; Assert.AreNotEqual(reference1, reference2); }
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 Assert.AreEqual(reference1, reference2, "Cloned objects should be equal."); Assert.AreEqual(reference1.GetHashCode(), reference2.GetHashCode(), "Cloned objects' hashes should be equal."); Assert.IsFalse(ReferenceEquals(reference1, reference2), "Cloning should not return the same reference."); }