public async void ShouldDeleteMerchantCorrectly(string uniqueId) { var requestMessage = MockHelper.CreateHttpRequestMessage( $"{URL}/{uniqueId}", HttpMethod.Delete); var response = await _testFactory.CreateClient().SendAsync(requestMessage); response.StatusCode.Should().Be(HttpStatusCode.OK); }
public async void ShouldGetMerchantCorrectly(string uniqueId) { var requestMessage = MockHelper.CreateHttpRequestMessage( $"{URL}/{uniqueId}", HttpMethod.Get); var response = await _testFactory.CreateClient().SendAsync(requestMessage); response.StatusCode.Should().Be(HttpStatusCode.OK); var responseBodyJson = await response.Content.ReadAsStringAsync(); var responseBody = JsonConvert.DeserializeObject <MerchantViewModel>(responseBodyJson); responseBody.Should().NotBeNull(); responseBody.UniqueId.Should().Be(uniqueId); }
public async void ShouldGreateMerchantCorrectly() { var requestBody = new CreateMerchantCommand { IsActive = true, Currency = "AUD", WebsiteUrl = "www.test-03.com", Country = "Australia", DiscountPercentage = 5.0m }; var requestMessage = MockHelper.CreateHttpRequestMessage( URL, HttpMethod.Post, requestBody); var response = await _testFactory.CreateClient().SendAsync(requestMessage); response.StatusCode.Should().Be(HttpStatusCode.OK); }
public async void ShouldUpdateMerchantCorrectly() { var requestBody = new UpdateMerchantCommand { UniqueId = "62178593-efbc-4ba2-9bbd-d2841c896820", IsActive = true, Currency = "AUD", WebsiteUrl = "www.test-04.com", Country = "Australia", DiscountPercentage = 5.0m }; var requestMessage = MockHelper.CreateHttpRequestMessage( URL, HttpMethod.Put, requestBody); var response = await _testFactory.CreateClient().SendAsync(requestMessage); response.StatusCode.Should().Be(HttpStatusCode.OK); }
public async void ShouldGetMerchantsCorrectly() { var requestMessage = MockHelper.CreateHttpRequestMessage( URL, HttpMethod.Get); var response = await _testFactory.CreateClient().SendAsync(requestMessage); response.StatusCode.Should().Be(HttpStatusCode.OK); var responseBodyJson = await response.Content.ReadAsStringAsync(); var responseBody = JsonConvert.DeserializeObject <IEnumerable <MerchantViewModel> >(responseBodyJson); responseBody.Should().NotBeEmpty(); responseBody.Count().Should().Be(2); var merchantViewModels = responseBody.ToList(); merchantViewModels[0].UniqueId.Should().Be("62178593-efbc-4ba2-9bbd-d2841c896820"); merchantViewModels[0].WebsiteUrl.Should().Be("www.test-01.com"); merchantViewModels[1].UniqueId.Should().Be("62178593-efbc-4ba2-9bbd-d2841c896821"); merchantViewModels[1].WebsiteUrl.Should().Be("www.test-02.com"); }