コード例 #1
0
        public static void Equal(ApiObject expected, ApiObject actual)
        {
            if (expected == null)
            {
                Assert.Null(actual);
                return;
            }

            Assert.NotNull(actual);

            var expectedCollection = expected.ToList();
            var actualCollection   = actual.ToList();

            Assert.Equal(expectedCollection.Count, actualCollection.Count);

            var count = expectedCollection.Count;

            for (var index = 0; index < count; ++index)
            {
                var expectedObjectProperty = expectedCollection[index];
                var actualObjectProperty   = actualCollection[index];

                ApiPropertyAssert.Equal(expectedObjectProperty, actualObjectProperty);
            }
        }
コード例 #2
0
        public static void Equal(IReadOnlyList <ApiProperty> expectedCollection, JToken actualJToken)
        {
            // Handle when 'expected' is null.
            if (expectedCollection == null)
            {
                ClrObjectAssert.IsNull(actualJToken);
                return;
            }

            // Handle when 'expected' is not null.
            Assert.NotNull(actualJToken);

            var actualJTokenType = actualJToken.Type;

            Assert.Equal(JTokenType.Array, actualJTokenType);

            var actualJArray = (JArray)actualJToken;

            Assert.Equal(expectedCollection.Count, actualJArray.Count);
            var count = expectedCollection.Count;

            for (var index = 0; index < count; ++index)
            {
                var expectedObjectProperty     = expectedCollection[index];
                var actualObjectPropertyJToken = actualJArray[index];

                Assert.NotNull(actualObjectPropertyJToken);
                Assert.Equal(JTokenType.Object, actualObjectPropertyJToken.Type);

                var actualObjectPropertyJObject = (JObject)actualObjectPropertyJToken;
                ApiPropertyAssert.Equal(expectedObjectProperty, actualObjectPropertyJObject);
            }
        }
コード例 #3
0
        public static void Equal(ApiObject expected, JToken actualJToken)
        {
            // Handle when 'expected' is null.
            if (expected == null)
            {
                ClrObjectAssert.IsNull(actualJToken);
                return;
            }

            // Handle when 'expected' is not null.
            Assert.NotNull(actualJToken);

            var actualJTokenType = actualJToken.Type;

            Assert.Equal(JTokenType.Object, actualJTokenType);

            var actualJObject = (JObject)actualJToken;

            var expectedCollection = expected.ToList();
            var actualCollection   = actualJObject.Properties().ToList();

            Assert.Equal(expectedCollection.Count, actualCollection.Count);

            var count = expectedCollection.Count;

            for (var index = 0; index < count; ++index)
            {
                var expectedObjectProperty = expectedCollection[index];
                var actualJProperty        = actualCollection[index];

                ApiPropertyAssert.Equal(expectedObjectProperty, actualJProperty);
            }
        }
コード例 #4
0
        public static void Equal(IReadOnlyList <ApiProperty> expectedCollection, IReadOnlyList <ApiProperty> actualCollection)
        {
            if (expectedCollection == null)
            {
                Assert.Null(actualCollection);
                return;
            }

            Assert.Equal(expectedCollection.Count, actualCollection.Count);

            var count = expectedCollection.Count;

            for (var index = 0; index < count; ++index)
            {
                var expected = expectedCollection[index];
                var actual   = actualCollection[index];

                ApiPropertyAssert.Equal(expected, actual);
            }
        }