public async void AnonymousLinks() { // Arrange string contentType = TestConfiguration.TestData.RestAPI.ContentType; LinkableResource expected = new LinkableResource(); expected.AddLink("authenticate", null, $"application/vnd.imgtec.oauthtoken+{contentType}"); expected.AddLink("versions", null, $"application/vnd.imgtec.versions+{contentType}"); // Act APIEntryPoint entryPoint = await _HttpClientFixture.GetAPIEntryPoint(); // Assert ExpectLinks(entryPoint, expected); }
public async void AuthenticatedLinks() { // Arrange string contentType = TestConfiguration.TestData.RestAPI.ContentType; LinkableResource expected = new LinkableResource(); expected.AddLink("authenticate", null, $"application/vnd.imgtec.oauthtoken+{contentType}"); expected.AddLink("versions", null, $"application/vnd.imgtec.versions+{contentType}"); expected.AddLink("accesskeys", null, $"application/vnd.imgtec.accesskeys+{contentType}"); expected.AddLink("configuration", null, $"application/vnd.imgtec.configuration+{contentType}"); expected.AddLink("clients", null, $"application/vnd.imgtec.clients+{contentType}"); expected.AddLink("identities", null, $"application/vnd.imgtec.identities+{contentType}"); expected.AddLink("objectdefinitions", null, $"application/vnd.imgtec.objectdefinitions+{contentType}"); expected.AddLink("subscriptions", null, $"application/vnd.imgtec.subscriptions+{contentType}"); expected.AddLink("metrics", null, $"application/vnd.imgtec.metrics+{contentType}"); // Act await _HttpClientFixture.Login(); APIEntryPoint entryPoint = await _HttpClientFixture.GetAPIEntryPoint(); //Assert ExpectLinks(entryPoint, expected); }
public static void AddLink <T>(this LinkableResource link, HttpRequest request, string rel, string href) { string type = request.GetContentType(typeof(T)); link.AddLink(rel, href, type); }