Пример #1
0
            private void GenerateAndCompareNextLink(EntitySetInstance payloadElement, int expectedPageSize)
            {
                var currentPageValues = this.queryValueStack.Peek() as QueryCollectionValue;

                ExceptionUtilities.CheckObjectNotNull(currentPageValues, "Current value was not a collection");
                var lastEntityValue = currentPageValues.Elements.Cast <QueryStructuralValue>().Last();

                // build the expected next link and the message to used based on whether we are in an expanded feed or top-level feed
                string expectedNextLink = null;

                if (this.navigationStack.Count == 0)
                {
                    expectedNextLink = this.parent.ExpectedNextLinkGenerator.GenerateNextLink(this.requestUri, expectedPageSize, lastEntityValue);
                }
                else
                {
                    expectedNextLink = this.parent.ExpectedNextLinkGenerator.GenerateExpandedNextLink(this.entityStack.Peek(), this.navigationStack.Peek(), lastEntityValue);
                }

                var xmlBaseSegments = this.xmlBaseStack.Reverse().Select(x => x.Value);
                var expected        = UriHelpers.CreateAbsoluteLink(expectedNextLink, xmlBaseSegments);

                this.parent.AssertHandler.AreEqual(expected.OriginalString, payloadElement.NextLink, "Next link did not match expectation");
            }