Tag: unit-test
-
Equals, ==, and MSTest
public class SampleClass { public int X { get; set; } public override bool Equals(object obj) { if (obj == null) return false; if (obj.GetType() != typeof(SampleClass)) return false; var s = obj as SampleClass; return this.X == s.X; } } Tests: [TestMethod()] public void EqualsTest() { var sc = new SampleClass { X = […]