예제 #1
0
        public static void Equal(IEnumerable <ResourceIdentifier> expected, DomNode actual)
        {
            Assert.NotNull(actual);
            Assert.Equal(DomNodeType.DataCollection, actual.NodeType);

            var actualDomDataCollection      = (DomDataCollection)actual;
            var actualDomResourceIdentifiers = actualDomDataCollection.Nodes()
                                               .ToArray();
            var actualCount = actualDomResourceIdentifiers.Count();

            var expectedCollection = expected.SafeToReadOnlyList();

            if (expectedCollection.Any() == false)
            {
                Assert.Equal(0, actualCount);
                return;
            }

            var expectedCount = expectedCollection.Count();

            Assert.Equal(expectedCount, actualCount);

            var count = expectedCount;

            for (var i = 0; i < count; ++i)
            {
                var expectedApiResourceIdentifier = expectedCollection[i];
                var actualDomResourceIdentifier   = actualDomResourceIdentifiers[i];

                DomResourceIdentifierAssert.Equal(expectedApiResourceIdentifier, actualDomResourceIdentifier);
            }
        }
예제 #2
0
        public static void Equal(ResourceIdentifier expected, DomNode actual)
        {
            Assert.NotNull(actual);
            Assert.Equal(DomNodeType.Data, actual.NodeType);

            if (expected == null)
            {
                Assert.True(((DomNodeContainer)actual).Node == null);
                return;
            }
            Assert.NotNull(actual);

            var actualDomData     = (DomData)actual;
            var actualDomDataNode = actualDomData.Node;

            DomResourceIdentifierAssert.Equal(expected, actualDomDataNode);
        }