Exemple #1
0
        public async Task Test_Modify_Product()
        {
            string newDescription = "Adorable Fluffy Kitteh";

            using (var client = new APIClientProvider().Client)
            {
                var productGetAgain = await client.GetAsync("api/product");

                string productGetResponseBody = await productGetAgain.Content.ReadAsStringAsync();

                //HMN: Use a get to retrieve the products again and translate to a string

                var productList = JsonConvert.DeserializeObject <List <Product> >(productGetResponseBody);
                Assert.Equal(HttpStatusCode.OK, productGetAgain.StatusCode);

                var productObject = productList[0];
                var originalProductDescription = JsonConvert.SerializeObject(productObject.Description);
                productObject.Description = "Adorable Fluffy Kitteh";
                //Grabs the product object, serializes it, and stores it in a variable called originalProductPrice where the parameter of the serialized object is the object with its new value. The productObject.Price (the parameter of originalProductPrice) is changed and passed in.

                var editedProductAsJson = JsonConvert.SerializeObject(productObject);
                var response            = await client.PutAsync($"api/product/{productObject.Id}", new StringContent(editedProductAsJson, Encoding.UTF8, "application/json"));

                string responseBody = await response.Content.ReadAsStringAsync();

                Assert.Equal(HttpStatusCode.OK, response.StatusCode);

                var getProduct = await client.GetAsync($"/api/product/{productObject.Id}");

                getProduct.EnsureSuccessStatusCode();

                string getProductBody = await getProduct.Content.ReadAsStringAsync();

                Product newProduct = JsonConvert.DeserializeObject <Product>(getProductBody);

                Assert.Equal(HttpStatusCode.OK, getProduct.StatusCode);
                Assert.Equal(newDescription, newProduct.Description);

                newProduct.Description = originalProductDescription;
                var returnEditedProductToOriginalProduct = JsonConvert.SerializeObject(newProduct);

                var putEditedProductToOriginalProduct = await client.PutAsync($"api/product/{newProduct.Id}",
                                                                              new StringContent(returnEditedProductToOriginalProduct, Encoding.UTF8, "application/json"));

                string originalProductObject = await response.Content.ReadAsStringAsync();

                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            }
        }
Exemple #2
0
        public async Task Test_Delete_One_Order()
        {
            using (var client = new APIClientProvider().Client)
            {
                var deleteResponse = await client.DeleteAsync("/api/order/15");


                string responseBody = await deleteResponse.Content.ReadAsStringAsync();

                var order = JsonConvert.DeserializeObject <Order>(responseBody);


                Assert.Equal(HttpStatusCode.NoContent, deleteResponse.StatusCode);
            }
        }
Exemple #3
0
        public async Task Test_Get_All_Coffees()
        {
            using (var client = new APIClientProvider().Client)
            {
                // Arrange
                var response = await client.GetAsync("/api/coffees");

                // Act
                string responseBody = await response.Content.ReadAsStringAsync();

                var coffeeList = JsonConvert.DeserializeObject <List <Coffee> >(responseBody);
                // Assert
                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                Assert.True(coffeeList.Count > 0);
            }
        }
        public async Task Test_Gert_All_Employees()
        {
            using (var client = new APIClientProvider().Client)
            {
                var response = await client.GetAsync("/api/Employee");

                response.EnsureSuccessStatusCode();

                string responseBody = await response.Content.ReadAsStringAsync();

                var employeeList = JsonConvert.DeserializeObject <List <Employee> >(responseBody);

                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                Assert.True(employeeList.Count > 0);
            }
        }
        public async Task Test_Get_Single_Employee()
        {
            using (var client = new APIClientProvider().Client)
            {
                var response = await client.GetAsync("api/Employee/1");

                response.EnsureSuccessStatusCode();

                string responseBody = await response.Content.ReadAsStringAsync();

                var employee = JsonConvert.DeserializeObject <Employee>(responseBody);

                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                Assert.NotNull(employee);
            }
        }
Exemple #6
0
        public async Task Test_Get_One_Order()
        {
            using (var client = new APIClientProvider().Client)
            {
                var response = await client.GetAsync("/api/order/6");


                string responseBody = await response.Content.ReadAsStringAsync();

                var order = JsonConvert.DeserializeObject <Order>(responseBody);


                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                Assert.Equal(3, order.PaymentTypeId);
            }
        }
        public async Task Test_Modify_Student()
        {
            // New last name to change to and test
            string newLastName = "Bookerton";

            using (var client = new APIClientProvider().Client)
            {
                /*
                 *  PUT section
                 */
                Student modifiedFreddy = new Student
                {
                    StuFirstName   = "Freddy",
                    StuLastName    = newLastName,
                    StuSlackHandle = "@fullhousefreddy",
                    CohortId       = 1,
                    InstructorId   = 2
                };
                var modifiedFreddyAsJSON = JsonConvert.SerializeObject(modifiedFreddy);

                var response = await client.PutAsync(
                    "/api/Student/1",
                    new StringContent(modifiedFreddyAsJSON, Encoding.UTF8, "application/json")
                    );

                string responseBody = await response.Content.ReadAsStringAsync();

                Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);


                /*
                 *  GET section
                 *  Verify that the PUT operation was successful
                 */
                var getFreddy = await client.GetAsync("/api/Student/1");

                getFreddy.EnsureSuccessStatusCode();

                string getFreddyBody = await getFreddy.Content.ReadAsStringAsync();

                Student newFreddy = JsonConvert.DeserializeObject <Student>(getFreddyBody);

                Assert.Equal(HttpStatusCode.OK, getFreddy.StatusCode);
                Assert.Equal(newLastName, newFreddy.StuLastName);
            }
        }
Exemple #8
0
        public async Task Test_Modify_Student()
        {
            // New last name to change to and test
            int newCohortId = 2;

            using (var client = new APIClientProvider().Client)
            {
                /*
                 *  PUT section
                 */
                Student modifiedHarry = new Student
                {
                    FirstName   = "Harry",
                    LastName    = "Harrison",
                    CohortId    = newCohortId,
                    SlackHandle = "slack1"
                };
                var modifiedHarryAsJSON = JsonConvert.SerializeObject(modifiedHarry);

                var response = await client.PutAsync(
                    "/api/student/1",
                    new StringContent(modifiedHarryAsJSON, Encoding.UTF8, "application/json")
                    );

                string responseBody = await response.Content.ReadAsStringAsync();

                Assert.Equal(HttpStatusCode.OK, response.StatusCode);


                /*
                 *  GET section
                 *  Verify that the PUT operation was successful
                 */
                var getHarry = await client.GetAsync("/api/student/1");

                getHarry.EnsureSuccessStatusCode();

                string getHarryBody = await getHarry.Content.ReadAsStringAsync();

                Student newHarry = JsonConvert.DeserializeObject <Student>(getHarryBody);

                Assert.Equal(HttpStatusCode.OK, getHarry.StatusCode);
                Assert.Equal(newCohortId, newHarry.CohortId);
            }
        }
Exemple #9
0
        public async Task Test_Modify_Animal()
        {
            // New last name to change to and test
            int newAge = 5;

            using (var client = new APIClientProvider().Client)
            {
                /*
                 *  PUT section
                 */
                Animal modifiedJack = new Animal
                {
                    Name     = "Jack",
                    Breed    = "Cocker Spaniel",
                    Age      = newAge,
                    HasShots = true
                };
                var modifiedJackAsJSON = JsonConvert.SerializeObject(modifiedJack);

                var response = await client.PutAsync(
                    "/api/animals/1",
                    new StringContent(modifiedJackAsJSON, Encoding.UTF8, "application/json")
                    );

                string responseBody = await response.Content.ReadAsStringAsync();

                Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);


                /*
                 *  GET section
                 *  Verify that the PUT operation was successful
                 */
                var getJack = await client.GetAsync("/api/animals/1");

                getJack.EnsureSuccessStatusCode();

                string getJackBody = await getJack.Content.ReadAsStringAsync();

                Animal newJack = JsonConvert.DeserializeObject <Animal>(getJackBody);

                Assert.Equal(HttpStatusCode.OK, getJack.StatusCode);
                Assert.Equal(newAge, newJack.Age);
            }
        }
        public async Task Get_All_ProductType()
        {
            using (var client = new APIClientProvider().Client)
            {
                // Try to get all of the ProductTypes from /api/ProductType
                HttpResponseMessage response = await client.GetAsync(url);

                response.EnsureSuccessStatusCode();
                // Convert to JSON
                string responseBody = await response.Content.ReadAsStringAsync();

                // Convert from JSON to C#
                List <ProductType> producttypes = JsonConvert.DeserializeObject <List <ProductType> >(responseBody);
                // Make sure we got back a 200 OK Status and that there are more than 0 ProductTypes in our database
                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                Assert.True(producttypes.Count > 0);
            }
        }
Exemple #11
0
        public async Task Test_Delete_Student()
        {
            using (var client = new APIClientProvider().Client)
            {
                var response = await client.DeleteAsync("/api/student/3");

                Assert.Equal(HttpStatusCode.OK, response.StatusCode);


                var getDeletedStudent = await client.GetAsync("/api/student/3");

                getDeletedStudent.EnsureSuccessStatusCode();



                Assert.Equal(HttpStatusCode.NoContent, getDeletedStudent.StatusCode);
            }
        }
        public async Task Delete_ProductType()
        {
            // Note: with many of these methods, I'm creating dummy data and then testing to see if I can delete it. I'd rather do that for now than delete something else I (or a user) created in the database, but it's not essential-- we could test deleting anything
            // Create a new coffee in the db
            ProductType newTestType = await CreateDummyProductType();

            // Delete it
            await deleteDummyProductType(newTestType);

            using (var client = new APIClientProvider().Client)
            {
                // Try to get it again
                HttpResponseMessage response = await client.GetAsync($"{url}{newTestType.Id}");

                // Make sure it's really gone
                Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
            }
        }
        public async Task Test_Modify_Employee()
        {
            // New last name to change to and test
            string newLastName = "Spalding";

            using (var client = new APIClientProvider().Client)
            {
                /*
                 *  PUT section
                 */
                Employee modifiedKate = new Employee
                {
                    FirstName    = "Kate",
                    LastName     = newLastName,
                    DepartmentId = 2,
                    IsSuperVisor = true
                };
                var modifiedKateAsJSON = JsonConvert.SerializeObject(modifiedKate);

                var response = await client.PutAsync(
                    "api/Employee/2",
                    new StringContent(modifiedKateAsJSON, Encoding.UTF8, "application/json")
                    );

                response.EnsureSuccessStatusCode();
                string responseBody = await response.Content.ReadAsStringAsync();

                Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);

                /*
                 *  GET section
                 */
                var getKate = await client.GetAsync("api/Employee/2");

                getKate.EnsureSuccessStatusCode();

                string getKateBody = await getKate.Content.ReadAsStringAsync();

                Employee newKate = JsonConvert.DeserializeObject <Employee>(getKateBody);

                Assert.Equal(HttpStatusCode.OK, getKate.StatusCode);
                Assert.Equal(newLastName, newKate.LastName);
            }
        }
        public async Task Test_Modify_Animal()
        {
            // New eating habit value to change to and test
            string NewEatingHabit = "Herbivore";

            using (var client = new APIClientProvider().Client)
            {
                /*
                 *  PUT section
                 */
                Animal ModifiedButter = new Animal
                {
                    Name        = "Butter",
                    Species     = "Northwest African Cheetah",
                    EatingHabit = NewEatingHabit,
                    Legs        = 4,
                    ZooId       = 2
                };
                var ModifiedButterAsJSON = JsonConvert.SerializeObject(ModifiedButter);

                var response = await client.PutAsync(
                    "/api/animals/1",
                    new StringContent(ModifiedButterAsJSON, Encoding.UTF8, "application/json")
                    );

                string responseBody = await response.Content.ReadAsStringAsync();

                Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);

                /*
                 *  GET section
                 */
                var GetButter = await client.GetAsync("/api/animals/1");

                GetButter.EnsureSuccessStatusCode();

                string GetButterBody = await GetButter.Content.ReadAsStringAsync();

                Animal NewButter = JsonConvert.DeserializeObject <Animal>(GetButterBody);

                Assert.Equal(HttpStatusCode.OK, GetButter.StatusCode);
                Assert.Equal(NewEatingHabit, NewButter.EatingHabit);
            }
        }
        public async Task Update_PaymentType()
        {
            using (var client = new APIClientProvider().Client)
            {
                // Create a dummy PaymentType
                PaymentType newBitCash = await CreateDummyPaymentType();

                // Make a new accctNumber and assign it to our dummy PaymentType
                int newAcctNumber = 822;
                newBitCash.AcctNumber = newAcctNumber;

                // Convert it to JSON
                string modifiedBitCashAsJSON = JsonConvert.SerializeObject(newBitCash);

                // Try to PUT the newly edited PaymentType
                var response = await client.PutAsync(
                    $"{url}/{newBitCash.Id}",
                    new StringContent(modifiedBitCashAsJSON, Encoding.UTF8, "application/json")
                    );

                // See what comes back from the PUT. Is it a 204?
                string responseBody = await response.Content.ReadAsStringAsync();

                Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);

                // Get the edited PaymentType back from the database after the PUT
                var getModifiedBitCash = await client.GetAsync($"{url}/{newBitCash.Id}");

                getModifiedBitCash.EnsureSuccessStatusCode();

                // Convert it to JSON
                string getPaymentTypeBody = await getModifiedBitCash.Content.ReadAsStringAsync();

                // Convert it from JSON to C#
                PaymentType newlyEditedPaymentType = JsonConvert.DeserializeObject <PaymentType>(getPaymentTypeBody);

                // Make sure the acctNumber was modified correctly
                Assert.Equal(HttpStatusCode.OK, getModifiedBitCash.StatusCode);
                Assert.Equal(newAcctNumber, newlyEditedPaymentType.AcctNumber);

                // Clean up after yourself
                await deleteDummyPaymentType(newlyEditedPaymentType);
            }
        }
Exemple #16
0
        public async Task Edit_Coffee()
        {
            using (var client = new APIClientProvider().Client)
            {
                // Arrange
                Coffee editedCoffee = new Coffee()
                {
                    Title    = "EDITED COFFEE",
                    BeanType = "New Bean Type"
                };
                // Act
                string jsonCoffee            = JsonConvert.SerializeObject(editedCoffee);
                HttpResponseMessage response = await client.PutAsync($"/api/coffees/{fixture.TestCoffee.Id}",
                                                                     new StringContent(jsonCoffee, Encoding.UTF8, "application/json"));

                // Assert
                Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);
            }
        }
Exemple #17
0
        public async Task Test_Get_Single_Employee()
        {
            using (var client = new APIClientProvider().Client)
            {
                var response = await client.GetAsync("api/employees/1009");


                string responseBody = await response.Content.ReadAsStringAsync();

                var employee = JsonConvert.DeserializeObject <Employee>(responseBody);

                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                Assert.Equal(0, employee.DepartmentId);
                Assert.Equal("Josh", employee.FirstName);
                Assert.Equal("Hibray", employee.LastName);
                Assert.True(employee.IsSupervisor);
                Assert.NotNull(employee);
            }
        }
        public async Task Test_Get_NonExitant_Animal_Fails()
        {
            using (var client = new APIClientProvider().Client)
            {
                /*
                 *  ARRANGE
                 */

                /*
                 *  ACT
                 */
                var response = await client.GetAsync("/api/animals/999999999");

                /*
                 *  ASSERT
                 */
                Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
            }
        }
Exemple #19
0
        public async Task Test_Modify_Order()
        {
            // New last name to change to and test
            int newPaymentId = 3;

            using (var client = new APIClientProvider().Client)
            {
                /*
                 *  PUT section
                 */
                Order modifiedOrder = new Order
                {
                    CustomerId    = 2,
                    PaymentTypeId = newPaymentId
                };
                var modifiedOrderAsJSON = JsonConvert.SerializeObject(modifiedOrder);

                var response = await client.PutAsync(
                    "/api/order/11",
                    new StringContent(modifiedOrderAsJSON, Encoding.UTF8, "application/json")
                    );

                string responseBody = await response.Content.ReadAsStringAsync();

                Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);

                /*
                 * GET section
                 * Verify that the PUT operation was successful
                 */
                var getOrder = await client.GetAsync("/api/order/11");

                getOrder.EnsureSuccessStatusCode();

                string getOrderBody = await getOrder.Content.ReadAsStringAsync();

                Order newOrder = JsonConvert.DeserializeObject <Order>(getOrderBody);

                Assert.Equal(HttpStatusCode.OK, getOrder.StatusCode);
                Assert.Equal(newPaymentId, newOrder.PaymentTypeId);
            }
        }
        public async Task Test_Delete_NonExistent_Animal_Fails()
        {
            using (var client = new APIClientProvider().Client)
            {
                /*
                 *  ARRANGE
                 */

                /*
                 *  ACT
                 */
                var deleteResponse = await client.DeleteAsync("/api/animals/600000");

                /*
                 *  ASSERT
                 */
                Assert.False(deleteResponse.IsSuccessStatusCode);
                Assert.Equal(HttpStatusCode.NotFound, deleteResponse.StatusCode);
            }
        }
        // Reusable method to create a new coffee in the database and return it
        public async Task <ProductType> CreateDummyProductType()
        {
            using (var client = new APIClientProvider().Client)
            {
                // Serialize the C# object into a JSON string
                string ProductTypeAsJSON = JsonConvert.SerializeObject(dummyProductType);
                // Use the client to send the request and store the response
                HttpResponseMessage response = await client.PostAsync(
                    url,
                    new StringContent(ProductTypeAsJSON, Encoding.UTF8, "application/json")
                    );

                // Store the JSON body of the response
                string responseBody = await response.Content.ReadAsStringAsync();

                // Deserialize the JSON into an instance of a ProductType
                ProductType newlyCreatedProductType = JsonConvert.DeserializeObject <ProductType>(responseBody);
                return(newlyCreatedProductType);
            }
        }
        public async Task Test_Create_Employee()
        {
            using (var client = new APIClientProvider().Client)
            {
                /*
                 *  ARRANGE
                 * [{"id":3,"departmentId":0,"firstName":"Single","lastName":"Quotes","isSupervisor":true,"trainingPrograms":[]},
                 */
                Employee Josh = new Employee
                {
                    DepartmentId = 1,
                    FirstName    = "Josh",
                    LastName     = "Hibray",
                    IsSupervisor = true
                };

                var JoshAsJSON = JsonConvert.SerializeObject(Josh);

                /*
                 *  ACT
                 */
                var response = await client.PostAsync("/api/employees",
                                                      new StringContent(JoshAsJSON, Encoding.UTF8, "application/json")
                                                      );


                string responseBody = await response.Content.ReadAsStringAsync();

                var newJosh = JsonConvert.DeserializeObject <Employee>(responseBody);

                /*
                 *  ASSERT
                 */
                Assert.Equal(HttpStatusCode.Created, response.StatusCode);
                Assert.Equal(1, newJosh.DepartmentId);
                Assert.Equal("Josh", newJosh.FirstName);
                Assert.Equal("Hibray", newJosh.LastName);
                Assert.True(newJosh.IsSupervisor);
            }
        }
        public async Task Update_Computer()
        {
            using (var client = new APIClientProvider().Client)
            {
                // Create a dummy Computer
                Computer newDell = await CreateDummyComputer();

                // Make a new Manufacturer and assign it to our dummy Computer
                string newManufacturer = "Dell";
                newDell.Manufacturer = newManufacturer;
                // Convert it to JSON
                string modifiedDellAsJSON = JsonConvert.SerializeObject(newDell);
                // Try to PUT the newly edited Computer
                var response = await client.PutAsync(
                    $"{url}/{newDell.Id}",
                    new StringContent(modifiedDellAsJSON, Encoding.UTF8, "application/json")
                    );

                // See what comes back from the PUT. Is it a 204?
                string responseBody = await response.Content.ReadAsStringAsync();

                Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);
                // Get the edited Computer back from the database after the PUT
                var getModifiedDell = await client.GetAsync($"{url}/{newDell.Id}");

                getModifiedDell.EnsureSuccessStatusCode();
                // Convert it to JSON
                string getComputerBody = await getModifiedDell.Content.ReadAsStringAsync();

                // Convert it from JSON to C#
                Computer newlyEditedComputer = JsonConvert.DeserializeObject <Computer>(getComputerBody);
                // Make sure the acctNumber was modified correctly
                Assert.Equal(HttpStatusCode.OK, getModifiedDell.StatusCode);
                Assert.Equal(newManufacturer, newlyEditedComputer.Manufacturer);
                // Clean up after yourself
                await deleteDummyComputer(newlyEditedComputer);
            }
        }
Exemple #24
0
        public async Task Create_One_Coffee()
        {
            using (var client = new APIClientProvider().Client)
            {
                // Arrange
                Coffee newCoffee = new Coffee()
                {
                    Title    = "Test Coffee",
                    BeanType = "New Bean Type"
                };
                string jsonCoffee = JsonConvert.SerializeObject(newCoffee);
                // Act
                HttpResponseMessage response = await client.PostAsync("/api/coffees",
                                                                      new StringContent(jsonCoffee, Encoding.UTF8, "application/json"));

                string responseBody = await response.Content.ReadAsStringAsync();

                Coffee coffeeResponse = JsonConvert.DeserializeObject <Coffee>(responseBody);
                // Assert
                Assert.Equal(HttpStatusCode.Created, response.StatusCode);
                Assert.Equal(coffeeResponse.Title, newCoffee.Title);
            }
        }
        public async Task Test_Create_ProductType()
        {
            using (var client = new APIClientProvider().Client)
            {
                ProductType productType = new ProductType
                {
                    Name = "Toys"
                };

                var productTypeAsJSON = JsonConvert.SerializeObject(productType);

                var response = await client.PostAsync(
                    "/api/producttype",
                    new StringContent(productTypeAsJSON, Encoding.UTF8, "application/json")
                    );

                string responseBody = await response.Content.ReadAsStringAsync();

                var newProductType = JsonConvert.DeserializeObject <ProductType>(responseBody);

                Assert.Equal(HttpStatusCode.Created, response.StatusCode);
                Assert.Equal("Toys", newProductType.Name);
            }
        }
Exemple #26
0
        public async Task Test_Get_Single_Product()
        {
            using (var client = new APIClientProvider().Client)
            {
                var productGetInitialResponse = await client.GetAsync("api/product");

                string initialResponseBody = await productGetInitialResponse.Content.ReadAsStringAsync();

                var productList = JsonConvert.DeserializeObject <List <Product> >(initialResponseBody);

                Assert.Equal(HttpStatusCode.OK, productGetInitialResponse.StatusCode);

                var productObject = productList[0];

                var response = await client.GetAsync($"api/product/{productObject.Id}");

                string responseBody = await response.Content.ReadAsStringAsync();

                var productReturned = JsonConvert.DeserializeObject <Product>(responseBody);

                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                Assert.True(productReturned.Id == productObject.Id);
            }
        }
        public async Task Get_Single_ProductType()
        {
            using (HttpClient client = new APIClientProvider().Client)
            {
                // Create a dummy coffee
                ProductType newTestType = await CreateDummyProductType();

                // Try to get it
                HttpResponseMessage response = await client.GetAsync($"{url}/{newTestType.Id}");

                response.EnsureSuccessStatusCode();
                // Turn the response into JSON
                string responseBody = await response.Content.ReadAsStringAsync();

                // Turn the JSON into C#
                ProductType TestTypeFromDB = JsonConvert.DeserializeObject <ProductType>(responseBody);
                // Did we get back what we expected to get back?
                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                Assert.Equal(dummyProductType.Name, newTestType.Name);
                Assert.Equal(dummyProductType.Archived, newTestType.Archived);
                // Clean up after ourselves-- delete the dummy coffee we just created
                await deleteDummyProductType(TestTypeFromDB);
            }
        }
        public async Task Create_ProductType()
        {
            using (var client = new APIClientProvider().Client)
            {
                // Create a new ProductType in the db
                ProductType newTestType = await CreateDummyProductType();

                // Try to get it again
                HttpResponseMessage response = await client.GetAsync($"{url}/{newTestType.Id}");

                response.EnsureSuccessStatusCode();
                // Turn the response into JSON
                string responseBody = await response.Content.ReadAsStringAsync();

                // Turn the JSON into C#
                ProductType newProductType = JsonConvert.DeserializeObject <ProductType>(responseBody);
                // Make sure it's really there
                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                Assert.Equal(dummyProductType.Name, newProductType.Name);
                Assert.Equal(dummyProductType.Archived, newProductType.Archived);
                // Clean up after ourselves
                await deleteDummyProductType(newProductType);
            }
        }