public void Utility_MemberwiseEquals_3() { object first = new MyClass6 { X = new MyClass5 { X = 1 } }; object second = new MyClass6 { X = new MyClass5 { X = 1 } }; Assert.IsTrue(Utility.MemberwiseEquals(first, second)); Assert.IsTrue(Utility.MemberwiseEquals(second, first)); Assert.IsTrue(Utility.MemberwiseEquals(first, first)); Assert.IsTrue(Utility.MemberwiseEquals(second, second)); second = new MyClass6 { X = new MyClass5 { X = 2 } }; Assert.IsFalse(Utility.MemberwiseEquals(first, second)); Assert.IsFalse(Utility.MemberwiseEquals(second, first)); }
public void Should_use_ToString() { var settings = new MyClass6 { Str = "asdf" }; var result = PrintAndParse(settings); result.Should().Be(@"""!!! asdf"""); }
static void Main() { // Construct a MyClass object by using object initializers. MyClass6 obj = new MyClass6 { Count = 100, Str = "Testing" }; Console.WriteLine(obj.Count + " " + obj.Str); }