public static void SendAndComparePolymorphicObjects(Animal expected) { if (expected == null) { throw new ArgumentNullException("expected"); } using (var client = new PolymorphicAnimalStore(new Uri("http://localhost:3000"), new MirroringHandler())) { var createdPet = client.CreateOrUpdatePolymorphicAnimals(expected); Assert.NotNull(expected); Assert.Equal(expected.GetType(), createdPet.GetType()); foreach (var property in expected.GetType().GetProperties()) { var expectedValue = property.GetValue(expected, null); var actualValue = property.GetValue(createdPet, null); Assert.Equal(expectedValue, actualValue); } } }