public void ODataTypeAnnotationShouldAppearForComplexTypesLikeCollectionAndUserDefinedTypes(string acceptHeader) { //Arrange string requestUrl = BaseAddress.ToLowerInvariant() + "/Complex/EntityWithComplexProperties/"; JObject complexProperty; HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, requestUrl); request.SetAcceptHeader(acceptHeader); //Act HttpResponseMessage response = Client.SendAsync(request).Result; JObject result = response.Content.ReadAsJObject(); //Assert JsonAssert.ContainsProperty("value", result); JArray returnedEntities = (JArray)result["value"]; for (int i = 0; i < returnedEntities.Count; i++) { JObject returnedEntity = (JObject)returnedEntities[i]; if (!acceptHeader.Contains("fullmetadata")) { JsonAssert.DoesNotContainProperty("odata.*", returnedEntity); } else { JsonAssert.Equal("Collection(Edm.String)", "*****@*****.**", returnedEntity); JsonAssert.ContainsProperty("ComplexProperty", returnedEntity); complexProperty = (JObject)returnedEntity["ComplexProperty"]; JsonAssert.Equal("WebStack.QA.Test.OData.Formatter.JsonLight.Metadata.Model.ComplexType", "odata.type", complexProperty); JsonAssert.Equal("Collection(Edm.String)", "*****@*****.**", complexProperty); } } }
public void ODataCountAndNextLinkAnnotationsAppearsOnAllMetadataLevelsWhenSpecified(string acceptHeader) { //Arrange StubEntity[] entities = MetadataTestHelpers.CreateInstances<StubEntity[]>(); HttpRequestMessage message = new HttpRequestMessage(HttpMethod.Post, BaseAddress.ToLowerInvariant() + "/StubEntity/Default.Paged"); message.SetAcceptHeader(acceptHeader); string expectedNextLink = new Uri("http://*****:*****@odata.count", result); JsonAssert.PropertyEquals(expectedNextLink, "@odata.nextLink", result); }
public void NavigationLinksAppearOnlyInFullMetadata(string acceptHeader) { //Arrange OneToOneParent[] entities = MetadataTestHelpers.CreateInstances<OneToOneParent[]>(); var entity = entities.First(); string requestUrl = BaseAddress.ToLowerInvariant() + "/Relationships/OneToOneParent(" + entity.Id + ")"; string expectedNavigationLinkUrl = BaseAddress.ToLowerInvariant() + "/Relationships/OneToOneParent(" + entity.Id + ")/Child"; HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, requestUrl); request.SetAcceptHeader(acceptHeader); //Act HttpResponseMessage response = Client.SendAsync(request).Result; JObject result = response.Content.ReadAsJObject(); //Assert if (acceptHeader.Contains("fullmetadata")) { JsonAssert.Equal(expectedNavigationLinkUrl, "*****@*****.**", result); } else { JsonAssert.DoesNotContainProperty("*****@*****.**", result); } }
public void ODataTypeAnnotationAppearsForAllEntitiesInFullMetadataAndForDerivedEntityTypesInFullAndMinimalMetadata(string acceptHeader) { //Arrange BaseEntity[] baseEntities = new BaseEntity[] { new BaseEntity(1), new BaseEntity(2), new BaseEntity(3), new BaseEntity(4), new BaseEntity(5), new BaseEntity(6), new BaseEntity(7) }; //InstanceCreator.CreateInstanceOf<BaseEntity[]>(new Random(RandomSeedGenerator.GetRandomSeed())); DerivedEntity[] derivedEntities = new DerivedEntity[] { new DerivedEntity(8), new DerivedEntity(9), new DerivedEntity(10), new DerivedEntity(11), new DerivedEntity(12), new DerivedEntity(13), new DerivedEntity(14) }; //InstanceCreator.CreateInstanceOf<DerivedEntity[]>(new Random(RandomSeedGenerator.GetRandomSeed())); BaseEntity[] entities = baseEntities.Union(derivedEntities, new BaseEntity.IdEqualityComparer()).ToArray(); string requestUrl = BaseAddress.ToLowerInvariant() + "/Inheritance/BaseEntity/"; string expectedTypeName; HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, requestUrl); request.SetAcceptHeader(acceptHeader); //Act HttpResponseMessage response = Client.SendAsync(request).Result; JObject result = response.Content.ReadAsJObject(); //Assert JArray returnedEntities = (JArray)result["value"]; for (int i = 0; i < returnedEntities.Count; i++) { JObject returnedEntity = (JObject)returnedEntities[i]; BaseEntity originalEntity = entities.FirstOrDefault(x => x.Id == (int)returnedEntity["Id"]); Assert.NotNull(originalEntity); if (acceptHeader.Contains("nometadata")) { JsonAssert.DoesNotContainProperty("odata.type", returnedEntity); } else if (acceptHeader.Contains("fullmetadata")) { expectedTypeName = originalEntity.GetType().FullName; JsonAssert.Equal(expectedTypeName, "odata.type", returnedEntity); } else { if (originalEntity is DerivedEntity) { expectedTypeName = originalEntity.GetType().FullName; JsonAssert.Equal(expectedTypeName, "odata.type", returnedEntity); } else { JsonAssert.DoesNotContainProperty("odata.type", returnedEntity); } } } }
public void TransientActionsGetAdvertisedForDerivedTypesWhenTheyAreAvailable(string acceptHeader) { //Arrange JObject container; JObject derivedContainer; string requestUrl = BaseAddress.ToLowerInvariant() + "/Actions/BaseEntity(8)/"; string expectedContainerNamePrefix = acceptHeader.Contains("fullmetadata") ? "#Container." : "#"; string expectedTransientActionName = "TransientActionBaseType"; string expectedTransientActionContainer = expectedContainerNamePrefix + expectedTransientActionName; string expectedTargetUrl = BaseAddress.ToLowerInvariant() + "/Actions/BaseEntity(8)/TransientActionBaseType"; string expectedDerivedTypeTransientActionName = "TransientActionDerivedType"; string expectedDerivedTypeTransientActionContainer = expectedContainerNamePrefix + expectedDerivedTypeTransientActionName; string expectedDerivedTypeTargetUrl = BaseAddress.ToLowerInvariant() + "/Actions/BaseEntity(8)/WebStack.QA.Test.OData.Formatter.JsonLight.Metadata.Model.DerivedEntity/TransientActionDerivedType"; HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, requestUrl); request.SetAcceptHeader(acceptHeader); //Act HttpResponseMessage response = Client.SendAsync(request).Result; JObject result = response.Content.ReadAsJObject(); //Assert JsonAssert.ContainsProperty(expectedTransientActionContainer, result); JsonAssert.ContainsProperty(expectedDerivedTypeTransientActionContainer, result); container = (JObject)result[expectedTransientActionContainer]; derivedContainer = (JObject)result[expectedDerivedTypeTransientActionContainer]; if (acceptHeader.Contains("fullmetadata")) { JsonAssert.Equal(expectedTargetUrl, "target", container); JsonAssert.Equal(expectedTransientActionName, "title", container); JsonAssert.Equal(expectedDerivedTypeTargetUrl, "target", derivedContainer); JsonAssert.Equal(expectedDerivedTypeTransientActionName, "title", derivedContainer); } else { JsonAssert.DoesNotContainProperty("target", container); JsonAssert.DoesNotContainProperty("title", container); JsonAssert.DoesNotContainProperty("target", container); JsonAssert.DoesNotContainProperty("title", container); } }
public void TransientActionsDontGetAdvertisedForDerivedTypesWhenTheyArentAvailable(string acceptHeader) { //Arrange string requestUrl = BaseAddress.ToLowerInvariant() + "/Actions/BaseEntity(9)/"; string expectedContainerNamePrefix = acceptHeader.Contains("fullmetadata") ? "#Container." : "#"; string expectedTransientActionName = "TransientActionBaseType"; string expectedTransientActionContainer = expectedContainerNamePrefix + expectedTransientActionName; string expectedDerivedTypeTransientActionName = "TransientActionDerivedType"; string expectedDerivedTypeTransientActionContainer = expectedContainerNamePrefix + expectedDerivedTypeTransientActionName; HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, requestUrl); request.SetAcceptHeader(acceptHeader); //Act HttpResponseMessage response = Client.SendAsync(request).Result; JObject result = response.Content.ReadAsJObject(); //Assert JsonAssert.DoesNotContainProperty(expectedTransientActionContainer, result); JsonAssert.DoesNotContainProperty(expectedDerivedTypeTransientActionContainer, result); }
public void AlwaysAvailableActionsGetAdvertisedOnFullMetadataOnly(string acceptHeader) { //Arrange string requestUrl = BaseAddress.ToLowerInvariant() + "/Actions/BaseEntity(1)/"; string expectedTargetUrl = BaseAddress.ToLowerInvariant() + "/Actions/BaseEntity(1)/AlwaysAvailableActionBaseType"; string expectedContainerNamePrefix = acceptHeader.Contains("fullmetadata") ? "#Container." : "#"; string expectedAlwaysAvailableActionName = "AlwaysAvailableActionBaseType"; string expectedAlwaysAvailableActionContainer = expectedContainerNamePrefix + expectedAlwaysAvailableActionName; JObject container; HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, requestUrl); request.SetAcceptHeader(acceptHeader); //Act HttpResponseMessage response = Client.SendAsync(request).Result; JObject result = response.Content.ReadAsJObject(); //Assert if (acceptHeader.Contains("fullmetadata")) { JsonAssert.ContainsProperty(expectedAlwaysAvailableActionContainer, result); container = (JObject)result[expectedAlwaysAvailableActionContainer]; JsonAssert.Equal(expectedTargetUrl, "target", container); JsonAssert.Equal(expectedAlwaysAvailableActionName, "title", container); } else { JsonAssert.DoesNotContainProperty(expectedAlwaysAvailableActionContainer, result); } }
public void MetadataIsCorrectForAnEntryWithJustPrimitiveTypeProperties(string acceptHeader) { //Arrange EntityWithSimpleProperties[] entities = MetadataTestHelpers.CreateInstances<EntityWithSimpleProperties[]>(); EntityWithSimpleProperties entity = entities.First(); string requestUrl = BaseAddress.ToLowerInvariant() + "/EntityWithSimpleProperties(" + entity.Id + ")"; string expectedMetadataUrl = BaseAddress.ToLowerInvariant() + "/$metadata#EntityWithSimpleProperties/@Element"; HttpRequestMessage message = new HttpRequestMessage(HttpMethod.Get, requestUrl); message.SetAcceptHeader(acceptHeader); //Act HttpResponseMessage response = Client.SendAsync(message).Result; JObject result = response.Content.ReadAsJObject(); //Assert JsonAssert.DoesNotContainProperty("*****@*****.**", result); JsonAssert.DoesNotContainProperty("*****@*****.**", result); JsonAssert.DoesNotContainProperty("*****@*****.**", result); if (!(((string)result["DoubleProperty"]).Equals("Infinity", StringComparison.InvariantCultureIgnoreCase) || ((string)result["DoubleProperty"]).Equals("-Infinity", StringComparison.InvariantCultureIgnoreCase) || ((string)result["DoubleProperty"]).Equals("NaN", StringComparison.InvariantCultureIgnoreCase))) { JsonAssert.DoesNotContainProperty("*****@*****.**", result); } JsonAssert.DoesNotContainProperty("*****@*****.**", result); if (acceptHeader.Contains("nometadata")) { JsonAssert.DoesNotContainProperty("odata.metadata", result); } else { JsonAssert.Equal(expectedMetadataUrl, "odata.metadata", result); } if (acceptHeader.Contains("fullmetadata")) { JsonAssert.Equal(requestUrl, "odata.id", result); JsonAssert.Equal("Edm.Binary", "*****@*****.**", result); JsonAssert.Equal("Edm.DateTime", "*****@*****.**", result); JsonAssert.Equal("Edm.Decimal", "*****@*****.**", result); JsonAssert.Equal("Edm.Single", "*****@*****.**", result); JsonAssert.Equal("Edm.Guid", "*****@*****.**", result); JsonAssert.Equal("Edm.Int16", "*****@*****.**", result); JsonAssert.Equal("Edm.Int64", "*****@*****.**", result); JsonAssert.Equal("Edm.SByte", "*****@*****.**", result); JsonAssert.Equal("Edm.DateTimeOffset", "*****@*****.**", result); } }
public void CanReturnTheWholeResultSetUsingNextLink(string acceptHeader) { //Arrange StubEntity[] entities = MetadataTestHelpers.CreateInstances<StubEntity[]>(); string nextUrlToQuery = BaseAddress.ToLowerInvariant() + "/StubEntity/"; JToken token = null; JArray returnedEntities = new JArray(); JObject result = null; //Act do { HttpRequestMessage message = new HttpRequestMessage(HttpMethod.Get, nextUrlToQuery); message.SetAcceptHeader(acceptHeader); HttpResponseMessage response = Client.SendAsync(message).Result; result = response.Content.ReadAsAsync<JObject>().Result; JArray currentResults = (JArray)result["value"]; for (int i = 0; i < currentResults.Count; i++) { returnedEntities.Add(currentResults[i]); } if (result.TryGetValue("@odata.nextLink", out token)) { nextUrlToQuery = (string)token; } else { nextUrlToQuery = null; } } while (nextUrlToQuery != null); //Assert Assert.Equal(entities.Length, returnedEntities.Count); }
public void MetadataIsCorrectForFeedsOfEntriesWithJustPrimitiveTypeProperties(string acceptHeader) { //Arrange EntityWithSimpleProperties[] entities = MetadataTestHelpers.CreateInstances<EntityWithSimpleProperties[]>(); string requestUrl = BaseAddress.ToLowerInvariant() + "/EntityWithSimpleProperties/"; string expectedMetadataUrl = BaseAddress.ToLowerInvariant() + "/$metadata#EntityWithSimpleProperties"; HttpRequestMessage message = new HttpRequestMessage(HttpMethod.Get, requestUrl); message.SetAcceptHeader(acceptHeader); //Act var response = Client.SendAsync(message).Result; JObject result = response.Content.ReadAsJObject(); //Assert JsonAssert.ArrayLength(entities.Length, "value", result); if (acceptHeader.Contains("nometadata")) { JsonAssert.DoesNotContainProperty("odata.metadata", result); } else { JsonAssert.Equal(expectedMetadataUrl, "odata.metadata", result); } }
public void AlwaysAvailableActionsGetAdvertisedForDerivedTypesOnFullMetadataOnly(string acceptHeader) { //Arrange string requestUrl = BaseAddress.ToLowerInvariant() + "/Actions/BaseEntity(9)/"; string expectedTargetUrl = BaseAddress.ToLowerInvariant() + "/Actions/BaseEntity(9)/Default.AlwaysAvailableActionBaseType"; string expectedAlwaysAvailableActionName = "AlwaysAvailableActionBaseType"; string expectedAlwaysAvailableActionContainer = "#Default." + expectedAlwaysAvailableActionName; string expectedDerivedTypeTargetUrl = BaseAddress.ToLowerInvariant() + "/Actions/BaseEntity(9)/WebStack.QA.Test.OData.Formatter.JsonLight.Metadata.Model.DerivedEntity/Default.AlwaysAvailableActionDerivedType"; string expectedAlwaysAvailableDerivedTypeActionName = "AlwaysAvailableActionDerivedType"; string expectedAlwaysAvailableDerivedTypeActionContainer = "#Default." + expectedAlwaysAvailableDerivedTypeActionName; string expectedContextUrl = BaseAddress.ToLowerInvariant() + "/Actions/$metadata#BaseEntity/$entity"; JObject container; HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, requestUrl); request.SetAcceptHeader(acceptHeader); //Act HttpResponseMessage response = Client.SendAsync(request).Result; JObject result = response.Content.ReadAsAsync<JObject>().Result; //Assert if (acceptHeader.Contains("odata.metadata=full")) { // full metadata JsonAssert.ContainsProperty(expectedAlwaysAvailableActionContainer, result); container = (JObject)result[expectedAlwaysAvailableActionContainer]; JsonAssert.PropertyEquals(expectedTargetUrl, "target", container); JsonAssert.PropertyEquals(expectedAlwaysAvailableActionName, "title", container); JsonAssert.ContainsProperty(expectedAlwaysAvailableDerivedTypeActionContainer, result); container = (JObject)result[expectedAlwaysAvailableDerivedTypeActionContainer]; JsonAssert.PropertyEquals(expectedDerivedTypeTargetUrl, "target", container); JsonAssert.PropertyEquals(expectedAlwaysAvailableDerivedTypeActionName, "title", container); JsonAssert.PropertyEquals(expectedContextUrl, "@odata.context", result); JsonAssert.PropertyEquals("#WebStack.QA.Test.OData.Formatter.JsonLight.Metadata.Model.DerivedEntity", "@odata.type", result); } else if (acceptHeader.Contains("odata.metadata=none")) { // none metadata JsonAssert.DoesNotContainProperty("@odata.context", result); JsonAssert.DoesNotContainProperty(expectedAlwaysAvailableActionContainer, result); JsonAssert.DoesNotContainProperty(expectedAlwaysAvailableDerivedTypeActionContainer, result); } else { // minimal metadata, "application/json" equal to "application/json;odata.metadata=minimal" JsonAssert.PropertyEquals(expectedContextUrl, "@odata.context", result); JsonAssert.PropertyEquals("#WebStack.QA.Test.OData.Formatter.JsonLight.Metadata.Model.DerivedEntity", "@odata.type", result); JsonAssert.DoesNotContainProperty(expectedAlwaysAvailableActionContainer, result); JsonAssert.DoesNotContainProperty(expectedAlwaysAvailableDerivedTypeActionContainer, result); } }
public void TransientActionsDontGetAdvertisedWhenTheyArentAvailable(string acceptHeader) { //Arrange string requestUrl = BaseAddress.ToLowerInvariant() + "/Actions/BaseEntity(1)/"; string expectedTransientActionName = "TransientActionBaseType"; string expectedTransientActionContainer = "#Default." + expectedTransientActionName; HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, requestUrl); request.SetAcceptHeader(acceptHeader); //Act HttpResponseMessage response = Client.SendAsync(request).Result; JObject result = response.Content.ReadAsAsync<JObject>().Result; //Assert if (acceptHeader.Contains("odata.metadata=full")) { JsonAssert.ContainsProperty(expectedTransientActionContainer, result); } else { JsonAssert.DoesNotContainProperty(expectedTransientActionContainer, result); } }
public void MetadataAnnotationAppearsOnlyForFullAndMinimalMetadata(string acceptHeader) { //Arrange StubEntity[] entities = MetadataTestHelpers.CreateInstances<StubEntity[]>(); HttpRequestMessage message = new HttpRequestMessage(HttpMethod.Get, BaseAddress.ToLowerInvariant() + "/StubEntity/"); message.SetAcceptHeader(acceptHeader); string expectedMetadataUrl = BaseAddress.ToLowerInvariant() + "/$metadata#StubEntity"; //Act HttpResponseMessage response = Client.SendAsync(message).Result; JObject result = response.Content.ReadAsAsync<JObject>().Result; //Assert if (acceptHeader.Contains("odata.metadata=none")) { JsonAssert.DoesNotContainProperty("@odata.context", result); } else { JsonAssert.PropertyEquals(expectedMetadataUrl, "@odata.context", result); } }
public void CustomReadLinksAppearInFullAndMinimalMetadata(string acceptHeader) { //Arrange OneToOneParent[] entities = MetadataTestHelpers.CreateInstances<OneToOneParent[]>(); var entity = entities.First(); string requestUrl = BaseAddress.ToLowerInvariant() + "/CustomReadLinkConventions/OneToOneParent(" + entity.Id + ")"; string expectedReadLinkUrl = "http://localhost:5000/CustomReadLink"; HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, BaseAddress + "/CustomReadLinkConventions/OneToOneParent(" + entity.Id + ")"); request.SetAcceptHeader(acceptHeader); //Act HttpResponseMessage response = Client.SendAsync(request).Result; JObject result = response.Content.ReadAsJObject(); //Assert if (!acceptHeader.Contains("nometadata")) { JsonAssert.Equal(expectedReadLinkUrl, "odata.readLink", result); } else { JsonAssert.DoesNotContainProperty("odata.readLink", result); } }
public void MetadataIsCorrectForThePropertiesOfAnEntryWithJustPrimitiveTypeProperties(string acceptHeader, string propertyName, string edmType) { //Arrange EntityWithSimpleProperties[] entities = MetadataTestHelpers.CreateInstances<EntityWithSimpleProperties[]>(); EntityWithSimpleProperties entity = entities.First(); string entryUrl = BaseAddress.ToLowerInvariant() + "/EntityWithSimpleProperties(" + entity.Id + ")/" + propertyName; HttpRequestMessage message = new HttpRequestMessage(HttpMethod.Get, entryUrl); message.SetAcceptHeader(acceptHeader); string expectedMetadataUrl = BaseAddress.ToLowerInvariant() + "/$metadata#" + edmType; string[] inferableTypes = new string[] { "Edm.Int32", "Edm.Double", "Edm.String", "Edm.Boolean" }; bool isODataNull = false; //Act var response = Client.SendAsync(message).Result; JObject result = response.Content.ReadAsJObject(); isODataNull = result.Property("odata.null") != null; //Assert if (isODataNull) { expectedMetadataUrl = BaseAddress.ToLowerInvariant() + "/$metadata#Edm.Null"; } if (acceptHeader.Contains("nometadata")) { if (!isODataNull) { JsonAssert.DoesNotContainProperty("odata.*", result); } else { JsonAssert.Equals(true, (bool)result.Property("odata.null")); } } else { JsonAssert.Equal(expectedMetadataUrl, "odata.metadata", result); if (!acceptHeader.Contains("fullmetadata") || (inferableTypes.Contains(edmType) && !IsSpecialValue(result))) { JsonAssert.DoesNotContainProperty("odata.type", result); } else { JsonAssert.Equal(edmType, "odata.type", result); } } }
public void CanFollowGeneratedNavigationLinks(string acceptHeader) { //Arrange OneToOneParent[] entities = MetadataTestHelpers.CreateInstances<OneToOneParent[]>(); OneToOneChild[] childEntities = entities.Select(x => x.Child).ToArray(); JArray returnedChildEntities = new JArray(); JArray returnedParentEntities; int[] returnedChildrenIdentities; string requestUrl = BaseAddress.ToLowerInvariant() + "/Relationships/OneToOneParent"; HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, requestUrl); request.SetAcceptHeader(acceptHeader); //Act HttpResponseMessage response = Client.SendAsync(request).Result; JObject result = response.Content.ReadAsJObject(); returnedParentEntities = (JArray)result["value"]; for (int i = 0; i < returnedParentEntities.Count; i++) { string childUrl = (string)returnedParentEntities[i]["*****@*****.**"]; HttpRequestMessage childRequest = new HttpRequestMessage(HttpMethod.Get, childUrl); HttpResponseMessage childResponse = Client.SendAsync(childRequest).Result; JObject childEntry = childResponse.Content.ReadAsJObject(); returnedChildEntities.Add(childEntry); } returnedChildrenIdentities = returnedChildEntities.Select(x => (int)x["Id"]).ToArray(); //Assert foreach (var returnedChildEntityId in returnedChildrenIdentities) { Assert.True(childEntities.Any(x => x.Id == returnedChildEntityId)); } }
public void TransientCustomActionsGetAdvertisedWithTheTargetWhenAvailable(string acceptHeader) { //Arrange JObject container; string expectedContainerNamePrefix = acceptHeader.Contains("fullmetadata") ? "#Container." : "#"; string expectedTargetUrl = BaseAddress.ToLowerInvariant() + "/CustomActionConventions/BaseEntity(2)/TransientActionBaseType"; string expectedActionName = "TransientActionBaseType"; string expectedContainerName = expectedContainerNamePrefix + expectedActionName; string requestUrl = BaseAddress.ToLowerInvariant() + "/CustomActionConventions/BaseEntity(2)/"; HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, requestUrl); request.SetAcceptHeader(acceptHeader); //Act HttpResponseMessage response = Client.SendAsync(request).Result; JObject result = response.Content.ReadAsJObject(); //Assert JsonAssert.ContainsProperty(expectedContainerName, result); container = (JObject)result[expectedContainerName]; JsonAssert.Equal(expectedTargetUrl, "target", container); if (acceptHeader.Contains("fullmetadata")) { JsonAssert.Equal(expectedActionName, "title", container); } else { JsonAssert.DoesNotContainProperty("title", container); } }