public async Task ensureAddProductCategoryReturnsBadRequestIfCategoryHasDuplicateName() { GetProductCategoryModelView getCategoryMV = await ensureAddProductCategoryReturnsCreatedIfCategoryWasAddedSuccessfully(); var response = await client.PostAsJsonAsync(baseUrl, getCategoryMV); Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); }
public async Task ensureDeleteProductCategoryReturnsNoContentIfCategoryWasRemoved() { GetProductCategoryModelView getCategoryMV = await ensureAddProductCategoryReturnsCreatedIfCategoryWasAddedSuccessfully(); var response = await client.DeleteAsync(string.Format("{0}/{1}", baseUrl, getCategoryMV.id)); Assert.Equal(HttpStatusCode.NoContent, response.StatusCode); }
public async Task ensureFindProductCategoryReturnsOkIfCategoryExists() { GetProductCategoryModelView getCategoryMV = await ensureAddProductCategoryReturnsCreatedIfCategoryWasAddedSuccessfully(); var response = await client.GetAsync(string.Format("{0}/{1}", baseUrl, getCategoryMV.id)); Assert.Equal(HttpStatusCode.OK, response.StatusCode); }
public async Task ensureAddProductCategoryReturnsCreatedCategoryDTOInBody() { string categoryName = "Drawers" + Guid.NewGuid().ToString("n"); AddProductCategoryModelView addCategoryMV = new AddProductCategoryModelView() { name = categoryName }; var response = await client.PostAsJsonAsync(baseUrl, addCategoryMV); GetProductCategoryModelView actual = await response.Content.ReadAsAsync <GetProductCategoryModelView>(); GetProductCategoryModelView expected = new GetProductCategoryModelView() { name = categoryName }; Assert.Equal(expected.name, actual.name); }