public BuildRelationshipPath ( ApiResource resource, string id, ResourceRelationship relationship ) : string | ||
resource | ApiResource | The resource this path is related to. |
id | string | The unique id of the resource. |
relationship | ResourceRelationship | The relationship this path refers to. |
리턴 | string |
public void AddsPrefix() { var target = new DefaultUrlPathBuilder("my-prefix"); var result = target.BuildCanonicalPath(Resource); _output.WriteLine(result); Assert.StartsWith("/my-prefix/", result); result = target.BuildCanonicalPath(Resource, Id); _output.WriteLine(result); Assert.StartsWith("/my-prefix/", result); result = target.BuildRelationshipPath(Resource, Id, Relationship); _output.WriteLine(result); Assert.StartsWith("/my-prefix/", result); result = target.BuildRelationshipPath(Resource, Id, Relationship, Id); _output.WriteLine(result); Assert.StartsWith("/my-prefix/", result); }
public void GivesCorrectResults() { var target = new DefaultUrlPathBuilder(); var result = target.BuildCanonicalPath(Resource); _output.WriteLine(result); Assert.Equal("/people/", result); result = target.BuildCanonicalPath(Resource, Id); _output.WriteLine(result); Assert.Equal("/people/123/", result); result = target.BuildRelationshipPath(Resource, Id, Relationship); _output.WriteLine(result); Assert.Equal("/people/123/relationships/job/", result); result = target.BuildRelationshipPath(Resource, Id, Relationship, Id); _output.WriteLine(result); Assert.Equal("/people/123/job/", result); }