コード例 #1
0
ファイル: MirrorTests.cs プロジェクト: wangzq/autorest
        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);
                }
            }
        }
コード例 #2
0
ファイル: MirrorTests.cs プロジェクト: jhancock93/autorest
        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);
                }
            }
        }