public void ZeroCustomInstanceAnnotationsOnErrorShouldRoundtrip() { ODataError error = this.WriteThenReadErrorWithInstanceAnnotation(new KeyValuePair <string, ODataValue>[] { }); error.Should().NotBeNull(); ((ODataAnnotatable)error).GetAnnotation <object>().Should().BeNull(); }
private static ODataValue RunBasicVerificationAndGetAnnotationValue(string name, ODataError error) { error.Should().NotBeNull(); var instanceAnnotations = error.InstanceAnnotations; instanceAnnotations.Should().NotBeNull("there was an instance annotation in the payload."); instanceAnnotations.Should().NotBeEmpty("there was an instance annotation in the payload."); var annotation = instanceAnnotations.Where(instanceAnnotation => instanceAnnotation.Name.Equals(name)).FirstOrDefault(); annotation.Should().NotBeNull("an instance annotation with the requested name was in the payload."); return(annotation.Value); }
private static ODataValue RunBasicVerificationAndGetAnnotationValue(string name, ODataError error) { error.Should().NotBeNull(); var instanceAnnotations = error.InstanceAnnotations; instanceAnnotations.Should().NotBeNull("there was an instance annotation in the payload."); instanceAnnotations.Should().NotBeEmpty("there was an instance annotation in the payload."); var annotation = instanceAnnotations.Where(instanceAnnotation => instanceAnnotation.Name.Equals(name)).FirstOrDefault(); annotation.Should().NotBeNull("an instance annotation with the requested name was in the payload."); return annotation.Value; }