public void DifferentPropertyInBetweenInnerFeedShouldThrow() { const string entryText = @" ""NavProp"" : [], ""*****@*****.**"" : ""http://nextLink"", ""PrimitiveProp"" : 1, ""*****@*****.**"" : 2"; var entryReader = GetEntryReader(entryText, isResponse: true); entryReader.Read(); entryReader.State.Should().Be(ODataReaderState.EntryStart); entryReader.Read(); entryReader.State.Should().Be(ODataReaderState.NavigationLinkStart); entryReader.Read(); entryReader.State.Should().Be(ODataReaderState.FeedStart); entryReader.Read(); entryReader.State.Should().Be(ODataReaderState.FeedEnd); entryReader.Item.As <ODataFeed>().NextPageLink.Should().Be(new Uri("http://nextLink")); entryReader.Item.As <ODataFeed>().Count.Should().Be(null); entryReader.Read(); entryReader.State.Should().Be(ODataReaderState.NavigationLinkEnd); Action read = () => entryReader.Read(); read.ShouldThrow <ODataException>().WithMessage(ErrorStrings.DuplicatePropertyNamesChecker_PropertyAnnotationAfterTheProperty("odata.count", "NavProp")); }
public void MarkPropertyAsProcessedWithNoPropertyShouldWork() { DuplicatePropertyNamesChecker duplicateChecker = new DuplicatePropertyNamesChecker(false, true); duplicateChecker.MarkPropertyAsProcessed("property"); Action odataAction = () => duplicateChecker.AddODataPropertyAnnotation("property", JsonLightConstants.ODataAnnotationNamespacePrefix + "name", null); odataAction.ShouldThrow <ODataException>().WithMessage(ErrorStrings.DuplicatePropertyNamesChecker_PropertyAnnotationAfterTheProperty(JsonLightConstants.ODataAnnotationNamespacePrefix + "name", "property")); Action customAction = () => duplicateChecker.AddCustomPropertyAnnotation("property", "custom.name"); customAction.ShouldThrow <ODataException>().WithMessage(ErrorStrings.DuplicatePropertyNamesChecker_PropertyAnnotationAfterTheProperty("custom.name", "property")); }