public void ResourceWithRelationshipsToResourceObject_DeviatingForeignKeyAndNoNavigationWhileRelationshipIncluded_IgnoresForeignKeyDuringBuild() { // Arrange var resource = new OneToOneDependent { Principal = null, PrincipalId = 123 }; var relationships = _resourceGraph.GetRelationships <OneToOneDependent>(tr => tr.Principal); // Act var resourceObject = _builder.Build(resource, relationships: relationships); // Assert Assert.Null(resourceObject.Relationships["principal"].Data); }
public void ResourceWithRelationshipsToResourceObject_DeviatingForeignKeyWhileRelationshipIncluded_IgnoresForeignKeyDuringBuild() { // Arrange var resource = new OneToOneDependent { Principal = new OneToOnePrincipal { Id = 10 }, PrincipalId = 123 }; var relationships = _resourceGraph.GetRelationships <OneToOneDependent>(tr => tr.Principal); // Act var resourceObject = _builder.Build(resource, relationships: relationships); // Assert Assert.Single(resourceObject.Relationships); Assert.NotNull(resourceObject.Relationships["principal"].Data); var ro = (ResourceIdentifierObject)resourceObject.Relationships["principal"].Data; Assert.Equal("10", ro.Id); }