static void Main(string[] args) { var object1 = new MyClass1(); int myInt = object1.calculate(); Console.WriteLine(myInt); Console.ReadLine(); object1.X = 5; object1.Y = 6; Console.WriteLine(object1.calculate()); Console.ReadLine(); int a = 219; string b = "Chesapeake"; int c = 63109; Address john = new Address(a, b, c); Address joyride = new Address(221, "B Baker St", 63109); Console.WriteLine("Sherlock Holmes is at {0} {1} {2}, {3} {4}", joyride.Number, joyride.Street, joyride.City, joyride.State, joyride.Zip); Console.ReadLine(); MyClass3 haystack = new MyClass3(); Console.WriteLine("Sherlock Holmes is at {0} {1} {2}, {3} {4}", haystack.cornstalk.Number, haystack.cornstalk.Street, haystack.cornstalk.City, haystack.cornstalk.State, haystack.cornstalk.Zip); Console.ReadLine(); Address tim = new Address(); tim.Number = 2281; tim.Street = "Broadway St."; }
public void MapTo_Existing_Object_Tests() { var obj1 = new MyClass1 { TestProp = "Test value" }; var obj2 = new MyClass2(); obj1.MapTo(obj2); obj2.TestProp.ShouldBe("Test value"); var obj3 = new MyClass3(); obj2.MapTo(obj3); obj3.TestProp.ShouldBe("Test value"); }
public void Should_match_the_last_case( MyClass3 instance) { int result = Switch.Match<object, int>(instance) .Case((MyClass c) => 1) .Case((MyClass2 c) => 2) .Case((MyClass3 c) => 3); Assert.Equal(3, result); }
public MyClass2(MyClass3 obj) { }