private static async Task RegisterProducts(TestApiClient client, IEnumerable <ProductView> products) { foreach (var product in products) { var createResult = await client.Post("/api/Products", product); createResult.EnsureStatusCode(HttpStatusCode.Created); product.Id = createResult.Value.Id; product.CreatedBy = createResult.Value.CreatedBy; product.CreatedDate = createResult.Value.CreatedDate; } }
public void ListFormsUsesCorrectEndpoint() { // Given TestApiClient apiClient = new TestApiClient(); NetlifyClient client = new NetlifyClient(apiClient); // When Form[] result = client.ListForms().SendAsync().Result; // Then apiClient.Requests[0].Method.ShouldBe(HttpMethod.Get); apiClient.Requests[0].RequestUri.ToString().ShouldBe("/forms"); }
public void GetSiteParsesJson() { // Given TestApiClient apiClient = new TestApiClient().WithResourceResposeContent("Site.json"); NetlifyClient client = new NetlifyClient(apiClient); // When Site result = client.GetSite("50e9bfc8-e242-428d-ba2b-3ae7c2d9863f").SendAsync().Result; // Then result.ShouldNotBeNull(); VerifySite(result); }
public void GetSiteUsesCorrectEndpoint() { // Given TestApiClient apiClient = new TestApiClient(); NetlifyClient client = new NetlifyClient(apiClient); // When Site result = client.GetSite("50e9bfc8-e242-428d-ba2b-3ae7c2d9863f").SendAsync().Result; // Then apiClient.Requests[0].Method.ShouldBe(HttpMethod.Get); apiClient.Requests[0].RequestUri.ToString().ShouldBe("/sites/50e9bfc8-e242-428d-ba2b-3ae7c2d9863f"); }
public void ListSitesParsesJson() { // Given TestApiClient apiClient = new TestApiClient().WithResourceResposeContent("Sites.json"); NetlifyClient client = new NetlifyClient(apiClient); // When Site[] result = client.ListSites().SendAsync().Result; // Then result.Length.ShouldBe(2); GetSiteFixture.VerifySite(result[0]); result[1].Id.ShouldBe("46b48455-90b4-4559-8233-6f6d08194696"); }
public void CryptowatchApiClient_CheckCurrenBalanceAsync() { var checkCurrentBalanceTask = TestApiClient.CheckCurrentBalanceAsync(); checkCurrentBalanceTask.Wait(); var result = checkCurrentBalanceTask.Result; Assert.IsNotNull(result); Assert.IsNotNull(result.DocumentationUrl); Assert.IsNotNull(result.Indexes); Assert.IsNotNull(result.Revision); Assert.IsNotNull(result.UpTime); Assert.AreNotEqual(0, result.Indexes.Count); }
public void ListSiteFormsUsesCorrectEndpoint() { // Given TestApiClient apiClient = new TestApiClient(); NetlifyClient client = new NetlifyClient(apiClient); Site site = new Site(client); site.Id = "50e9bfc8-e242-428d-ba2b-3ae7c2d9863f"; // When Form[] result = site.ListSiteForms().SendAsync().Result; // Then apiClient.Requests[0].Method.ShouldBe(HttpMethod.Get); apiClient.Requests[0].RequestUri.ToString().ShouldBe("/sites/50e9bfc8-e242-428d-ba2b-3ae7c2d9863f/forms"); }
private static ITestApiClient BuildBookingsApiClient(HttpClient httpClient, HearingServicesConfiguration serviceSettings) { return(TestApiClient.GetClient(serviceSettings.TestApiUrl, httpClient)); }