public async Task Test_Get_All_ProductTypes()
        {
            using (var client = new APIClientProvider().Client)
            {
                var response = await client.GetAsync("/api/ProductType");

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

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

                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                Assert.True(productTypes.Count > 0);
            }
        }
示例#2
0
        public async Task Test_Update_Employee()
        {
            // New last name to change to and test
            DateTime start = new DateTime(2019, 01, 01);
            DateTime end   = new DateTime(2019, 01, 01);

            using (var client = new APIClientProvider().Client)
            {
                /*
                 *  PUT section
                 */
                Employee modifiedMatt = new Employee
                {
                    FirstName    = "Matthew",
                    LastName     = "Ross",
                    DepartmentId = 1,
                    IsSuperVisor = false,
                    StartDate    = start,
                    EndDate      = end
                };
                var modifiedMattAsJSON = JsonConvert.SerializeObject(modifiedMatt);

                var response = await client.PutAsync(
                    "/api/employee/1",
                    new StringContent(modifiedMattAsJSON, 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 getMatt = await client.GetAsync("/api/employee/1");

                getMatt.EnsureSuccessStatusCode();

                string getMattBody = await getMatt.Content.ReadAsStringAsync();

                Employee newMatt = JsonConvert.DeserializeObject <Employee>(getMattBody);

                Assert.Equal(HttpStatusCode.OK, getMatt.StatusCode);
                Assert.Equal(start, newMatt.StartDate);
                Assert.Equal(end, newMatt.EndDate);
            }
        }
示例#3
0
        public async Task Test_Modify_PaymentType()
        {
            using (var client = new APIClientProvider().Client)
            {
                /*Initial GET
                 */
                var payment = await client.GetAsync("/api/PaymentType/4");

                string paymentBody = await payment.Content.ReadAsStringAsync();

                var paymentType = JsonConvert.DeserializeObject <PaymentType>(paymentBody);

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

                /*
                 *  PUT section
                 */
                PaymentType modifiedPaymentType = new PaymentType
                {
                    AcctNumber = paymentType.AcctNumber + 1,
                    Name       = "PayPal",
                    CustomerId = 1
                };
                var modifiedPaymentTypeAsJSON = JsonConvert.SerializeObject(modifiedPaymentType);

                var response = await client.PutAsync(
                    "/api/paymentType/4",
                    new StringContent(modifiedPaymentTypeAsJSON, Encoding.UTF8, "application/json")
                    );

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

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

                /*
                 *  GET section
                 */
                var getPayment = await client.GetAsync("/api/PaymentType/4");

                getPayment.EnsureSuccessStatusCode();

                string getPaymentBody = await getPayment.Content.ReadAsStringAsync();

                PaymentType newPayment = JsonConvert.DeserializeObject <PaymentType>(getPaymentBody);

                Assert.Equal(HttpStatusCode.OK, getPayment.StatusCode);
                Assert.Equal(paymentType.AcctNumber + 1, newPayment.AcctNumber);
            }
        }
        public async Task Test_Modify_Customer()
        {
            using (var client = new APIClientProvider().Client)
            {
                var customerGetInitialResponse = await client.GetAsync("api/customers");

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

                var customerList = JsonConvert.DeserializeObject <List <Customer> >(initialResponseBody);

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

                var customerObject = customerList[0];

                var defaultCustomerLastName = customerObject.LastName;

                //PUT TEST BEGINS
                customerObject.LastName = "newName";

                var modifiedCustomAsJson = JsonConvert.SerializeObject(customerObject);

                var response = await client.PutAsync($"api/customers/{customerObject.Id}",
                                                     new StringContent(modifiedCustomAsJson, Encoding.UTF8, "application/json"));

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

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

                var getCustomer = await client.GetAsync($"api/customers/{customerObject.Id}");

                getCustomer.EnsureSuccessStatusCode();

                string getCustomerBody = await getCustomer.Content.ReadAsStringAsync();

                Customer newCustomer = JsonConvert.DeserializeObject <Customer>(getCustomerBody);

                Assert.Equal("newName", newCustomer.LastName);

                newCustomer.LastName = defaultCustomerLastName;
                var returnCustomerToDefault = JsonConvert.SerializeObject(newCustomer);

                var putCustomerToDefault = await client.PutAsync($"api/customers/{customerObject.Id}",
                                                                 new StringContent(returnCustomerToDefault, Encoding.UTF8, "application/json"));

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

                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            }
        }
示例#5
0
        public async Task Test_Post_ProductType()
        {
            /*
             *  Generate a new instance of an HttpClient that you can
             *  use to generate HTTP requests to your API controllers.
             *  The `using` keyword will automatically dispose of this
             *  instance of HttpClient once your code is done executing.
             */
            using (var client = new APIClientProvider().Client)
            {
                /*
                 *  ARRANGE
                 */

                // Construct a new student object to be sent to the API
                ProductType toys = new ProductType
                {
                    Name = "Toys"
                };

                // Serialize the C# object into a JSON string
                var toysAsJSON = JsonConvert.SerializeObject(toys);


                /*
                 *  ACT
                 */

                // Use the client to send the request and store the response
                var response = await client.PostAsync(
                    "/api/ProductType",
                    new StringContent(toysAsJSON, Encoding.UTF8, "application/json")
                    );

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

                // Deserialize the JSON into an instance of Animal
                var newToys = JsonConvert.DeserializeObject <ProductType>(responseBody);


                /*
                 *  ASSERT
                 */

                Assert.Equal(HttpStatusCode.Created, response.StatusCode);
                Assert.Equal("Toys", newToys.Name);
            }
        }
        public async Task Test_Modify_ProductProduct()
        {
            // create a string to change the producttypes name
            string newName = "New ProductType Name";

            using (HttpClient client = new APIClientProvider().Client)
            {
                // create new producttype
                ProductType newProductType = await createProductType(client);

                // Change the name
                newProductType.Name = newName;

                // Convert them to JSON
                string modifiedDavidAsJSON = JsonConvert.SerializeObject(newProductType);

                // Make a PUT request with the new info
                HttpResponseMessage response = await client.PutAsync(
                    $"api/ProductType/{newProductType.Id}",
                    new StringContent(modifiedDavidAsJSON, Encoding.UTF8, "application/json")
                    );


                response.EnsureSuccessStatusCode();

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

                // We should have gotten a no content status code
                Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);

                // Try to GET the producttype we just edited
                HttpResponseMessage getProductType = await client.GetAsync($"api/ProductType/{newProductType.Id}");

                getProductType.EnsureSuccessStatusCode();

                string getProductTypeBody = await getProductType.Content.ReadAsStringAsync();

                ProductType modifiedProductType = JsonConvert.DeserializeObject <ProductType>(getProductTypeBody);

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

                // make sure it was updated
                Assert.Equal(newName, modifiedProductType.Name);

                // DELETEEEEEEE
                deleteThing(modifiedProductType, client);
            }
        }
示例#7
0
        public async Task Test_Update_Existing_Employee()
        {
            using (var client = new APIClientProvider().Client)
            {
                /*
                 * ARRANGE
                 */
                var testNum = 1;

                var testEmployee = new Employee()
                {
                    FirstName    = "Dwight",
                    LastName     = "Schrute",
                    DepartmentId = 3,
                    IsSupervisor = true
                };
                var jsonTestEmployee = JsonConvert.SerializeObject(testEmployee);

                /*
                 *  ACT
                 */
                var response = await client.PutAsync(
                    $"/api/Employees/{testNum}",
                    new StringContent(jsonTestEmployee, Encoding.UTF8, "application/json")
                    );

                /*
                 *  ASSERT
                 */
                Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);

                /*
                 *   GET
                 */

                var getEmployee = await client.GetAsync($"/api/Employees/{testNum}");

                getEmployee.EnsureSuccessStatusCode();

                string getResponse = await getEmployee.Content.ReadAsStringAsync();

                Employee updatedEmployee = JsonConvert.DeserializeObject <Employee>(getResponse);

                Assert.Equal(HttpStatusCode.OK, getEmployee.StatusCode);
                Assert.Equal(testNum, updatedEmployee.Id);
                Assert.Equal(testEmployee.FirstName, updatedEmployee.FirstName);
                Assert.Equal(testEmployee.DepartmentId, updatedEmployee.DepartmentId);
            }
        }
示例#8
0
        public async Task Test_Create_Payment()
        {
            using (var client = new APIClientProvider().Client)
            {
                /*
                 *  CREATE section
                 */
                var getOldList = await client.GetAsync("/api/PaymentType");

                getOldList.EnsureSuccessStatusCode();

                string getOldListBody = await getOldList.Content.ReadAsStringAsync();

                var oldList = JsonConvert.DeserializeObject <List <PaymentType> >(getOldListBody);



                PaymentType paymentType = new PaymentType
                {
                    Name       = "VISA",
                    AcctNumber = 213213,
                    CustomerId = 2
                };

                var modifiedPaymentAsJSON = JsonConvert.SerializeObject(paymentType);

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

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

                /*
                 *  GET section
                 *  Verify that the Post operation was successful
                 */
                var getPayments = await client.GetAsync("/api/PaymentType");

                getPayments.EnsureSuccessStatusCode();

                string getPaymentBody = await getPayments.Content.ReadAsStringAsync();

                var newList = JsonConvert.DeserializeObject <List <PaymentType> >(getPaymentBody);

                Assert.Equal(HttpStatusCode.OK, getPayments.StatusCode);
                Assert.True(newList.Count > oldList.Count);
            }
        }
        public async Task Test_Modify_Employee()
        {
            // Change bob's name to robert because he's all grown up now, go get em champ
            string newName = "Robert";

            using (HttpClient client = new APIClientProvider().Client)
            {
                // Create a new instance of bob
                Employee newEmployee = await createEmployee(client);

                // Set a new title
                newEmployee.FirstName = newName;

                // Convert it to JSON
                string modifiedEmployeeAsJSON = JsonConvert.SerializeObject(newEmployee);

                // PUT the new employee
                HttpResponseMessage response = await client.PutAsync(
                    $"api/Employee/{newEmployee.Id}",
                    new StringContent(modifiedEmployeeAsJSON, Encoding.UTF8, "application/json")
                    );


                response.EnsureSuccessStatusCode();

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

                // Check that there's a no content status code
                Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);


                HttpResponseMessage getEmployee = await client.GetAsync($"api/Employee/{newEmployee.Id}");

                getEmployee.EnsureSuccessStatusCode();

                string getEmployeeBody = await getEmployee.Content.ReadAsStringAsync();

                Employee modifiedEmployee = JsonConvert.DeserializeObject <Employee>(getEmployeeBody);

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


                Assert.Equal(newName, modifiedEmployee.FirstName);

                // fire this guy
                await deleteEmployee(modifiedEmployee, client);
            }
        }
        public async Task Test_Modify_Product()
        {
            // Changing Banana Bandana's title to be more fitting
            string newTitle = "RING RING RING RING BANANA PHONE";

            using (HttpClient client = new APIClientProvider().Client)
            {
                // Create a new instance of Banana
                Product newBanana = await createBanana(client);

                // Set a new title
                newBanana.Title = newTitle;

                // Convert it to JSON
                string modifiedBananaAsJSON = JsonConvert.SerializeObject(newBanana);

                // PUT the banana
                HttpResponseMessage response = await client.PutAsync(
                    $"api/Product/{newBanana.Id}",
                    new StringContent(modifiedBananaAsJSON, Encoding.UTF8, "application/json")
                    );


                response.EnsureSuccessStatusCode();

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

                // Check that there's a no content status code
                Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);


                HttpResponseMessage getBanana = await client.GetAsync($"api/Product/{newBanana.Id}");

                getBanana.EnsureSuccessStatusCode();

                string getBananaBody = await getBanana.Content.ReadAsStringAsync();

                Product modifiedBanana = JsonConvert.DeserializeObject <Product>(getBananaBody);

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


                Assert.Equal(newTitle, modifiedBanana.Title);

                // DELETE THE YELLOW
                deleteBanana(modifiedBanana, client);
            }
        }
示例#11
0
        public async Task Test_Modify_Computer()
        {
            // create a string to change the Computers name
            string newMake = "MacBook BROS";

            using (HttpClient client = new APIClientProvider().Client)
            {
                // create new Computer
                Computer newcomputer = await CreateComputer(client);

                // Change the name
                newcomputer.Make = newMake;

                // Convert them to JSON
                string modifiedComputerAsJSON = JsonConvert.SerializeObject(newcomputer);

                // Make a PUT request with the new info
                HttpResponseMessage response = await client.PutAsync(
                    $"api/Computer/{newcomputer.Id}",
                    new StringContent(modifiedComputerAsJSON, Encoding.UTF8, "application/json")
                    );


                response.EnsureSuccessStatusCode();

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

                // We should have gotten a no content status code
                Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);

                // Try to GET the Computer we just edited
                HttpResponseMessage getComputer = await client.GetAsync($"api/Computer/{newcomputer.Id}");

                getComputer.EnsureSuccessStatusCode();

                string getComputerbody = await getComputer.Content.ReadAsStringAsync();

                Computer modifiedComputer = JsonConvert.DeserializeObject <Computer>(getComputerbody);

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

                // make sure it was updated
                Assert.Equal(newMake, modifiedComputer.Make);

                // DELETEEEEEEE
                deleteComputer(modifiedComputer, client);
            }
        }
示例#12
0
        public async Task Modify_A_Department()
        {
            using (var client = new APIClientProvider().Client)
            {
                var getAllResponse = await client.GetAsync("/api/departments");


                string getAllResponseBody = await getAllResponse.Content.ReadAsStringAsync();

                var departments = JsonConvert.DeserializeObject <List <Department> >(getAllResponseBody);

                /*
                 *  PUT section
                 */
                decimal    newBudget          = 1200000;
                Department modifiedDepartment = new Department()
                {
                    Name   = "C#",
                    Budget = newBudget
                };
                var departmentAsJSON = JsonConvert.SerializeObject(modifiedDepartment);

                var response = await client.PutAsync(
                    $"/api/departments/{departments[0].Id}",
                    new StringContent(departmentAsJSON, 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 getDepartment = await client.GetAsync($"/api/departments/{departments[0].Id}");

                getDepartment.EnsureSuccessStatusCode();

                string getDepartmentBody = await getDepartment.Content.ReadAsStringAsync();

                Department newDepartment = JsonConvert.DeserializeObject <Department>(getDepartmentBody);

                Assert.Equal(HttpStatusCode.OK, getDepartment.StatusCode);
                Assert.Equal(modifiedDepartment.Budget, newDepartment.Budget);
            }
        }
示例#13
0
        public async Task PostCustomer_Success()
        {
            using (HttpClient client = new APIClientProvider().Client)
            {
                string customer = GenerateCustomer();
                HttpResponseMessage response = await client.PostAsync("api/Customer", new StringContent(customer, Encoding.UTF8, "application/json"));

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

                Customer DeJSONCustomer = JsonConvert.DeserializeObject <Customer>(responseBody);
                Assert.Equal("Marshal", DeJSONCustomer.FirstName);
                Assert.Equal("Lee", DeJSONCustomer.LastName);
            }
        }
示例#14
0
        public async Task Test_Get_Single_Incomplete_Order()
        {
            using (var client = new APIClientProvider().Client)
            {
                var response = await client.GetAsync("/api/Order/5/?_completed=false");


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

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

                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                Assert.Null(order.PaymentType);
            }
        }
示例#15
0
        public async Task Test_Create_And_Delete_Customer()
        {
            using (var client = new APIClientProvider().Client)
            {
                // Create a new David
                Customer newCustomer = await createCustomer(client);

                // Make sure his info checks out
                Assert.Equal("Larry", newCustomer.FirstName);
                Assert.Equal("Johnson", newCustomer.LastName);

                // Clean up after ourselves - delete David!
                deleteCustomer(newCustomer, client);
            }
        }
        public async Task Test_Create_And_Delete_Product()
        {
            using (var client = new APIClientProvider().Client)
            {
                // Create a new Banana
                Product newBanana = await createBanana(client);

                // Make sure Banana is indeed a banana
                Assert.Equal("Banana Bandana", newBanana.Title);


                // delete the filthy hat
                deleteBanana(newBanana, client);
            }
        }
示例#17
0
        public async Task Test_Create_And_Delete_Order()
        {
            using (var client = new APIClientProvider().Client)
            {
                // Create a new David
                Order newOrder = await createOrder(client);

                // Make sure his info checks out
                Assert.Equal(5, newOrder.PaymentTypeId);
                Assert.Equal(5, newOrder.CustomerId);

                // Clean up after ourselves - delete David!
                deleteOrder(newOrder, client);
            }
        }
示例#18
0
        public async Task Test_Get_Single_Department()
        {
            using (var client = new APIClientProvider().Client)
            {
                var response = await client.GetAsync("/api/departments/2");


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

                var department = JsonConvert.DeserializeObject <Department>(responseBody);

                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                Assert.NotNull(department);
            }
        }
示例#19
0
        public async Task GetSpecificDepartment()
        {
            using (var client = new APIClientProvider().Client)
            {
                var specific_Department = await client.GetAsync("api/Department/3");

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

                var specific_Dept_res = JsonConvert.DeserializeObject <Department>(responseBody);


                Assert.Equal(HttpStatusCode.OK, specific_Department.StatusCode);
                Assert.Equal("Animal Control", specific_Dept_res.Name);
            }
        }
        public async Task Test_Get_All_TrainingPrograms()
        {
            using (var client = new APIClientProvider().Client)
            {
                var response = await client.GetAsync("/api/TrainingProgram");


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

                var orderList = JsonConvert.DeserializeObject <List <TrainingProgram> >(responseBody);

                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                Assert.True(orderList.Count > 0);
            }
        }
        public async Task Test_Create_And_Delete_Employee()
        {
            using (var client = new APIClientProvider().Client)
            {
                // hire bob
                Employee newEmployee = await createEmployee(client);

                // Make sure sure our Bob is not an imposter (no bad response)
                Assert.Equal("Bob", newEmployee.FirstName);


                // fire bob
                await deleteEmployee(newEmployee, client);
            }
        }
示例#22
0
        public async Task Test_Create_And_Delete_ProductType()
        {
            using (var client = new APIClientProvider().Client)
            {
                // Create a new Table
                ProductType newTable = await createTable(client);

                // Make sure his info checks out
                Assert.Equal("Table", newTable.Name);


                // Clean up after ourselves - delete Table!
                deleteTable(newTable, client);
            }
        }
示例#23
0
        public async Task Test_Get_Single_ProductType()
        {
            using (var client = new APIClientProvider().Client)
            {
                var response = await client.GetAsync("api/ProductType/1");

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

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

                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                Assert.Equal("Computers", productType.Name);
                Assert.NotNull(productType);
            }
        }
        public async Task Test_Create_And_Delete_Student()
        {
            using (var client = new APIClientProvider().Client)
            {
                // Create a new David
                Customer newDavid = await createDavid(client);

                // Make sure his info checks out
                Assert.Equal("David", newDavid.FirstName);
                Assert.Equal("Bird", newDavid.LastName);

                // Clean up after ourselves - delete David!
                deleteDavid(newDavid, client);
            }
        }
        public async Task Test_deleteOneFalse_ProductType()
        {
            using (var client = new APIClientProvider().Client)
            {
                /*
                 *  ACT
                 */
                var newResponse = await client.DeleteAsync("/api/producttype/1000");


                string newResponseBody = await newResponse.Content.ReadAsStringAsync();

                Assert.Equal(HttpStatusCode.NotFound, newResponse.StatusCode);
            }
        }
示例#26
0
        public async Task TestDeleteComputer()
        {
            using (var client = new APIClientProvider().Client) {
                var computerGetInitialResponse = await client.GetAsync("api/computers");

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

                
 var computerList = JsonConvert.DeserializeObject <List <Computer> >(initialResponseBody);
                
 Assert.Equal(HttpStatusCode.OK, computerGetInitialResponse.StatusCode);

                
 int removeLastObject = computerList.Count - 1; 
 var computerObject = computerList[removeLastObject]; 

 var response = await client.DeleteAsync($"api/computers/{ computerObject.Id}"); 

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

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

 var getComputer = await client.GetAsync($"api/computers/{ computerObject.Id}"); 
 getComputer.EnsureSuccessStatusCode(); 

 string getComputerBody = await getComputer.Content.ReadAsStringAsync();

                
 Computer newComputer = JsonConvert.DeserializeObject <Computer>(getComputerBody); 

 Assert.Equal(HttpStatusCode.OK, getComputer.StatusCode);
            }
        }
示例#27
0
        public async Task Test_Get_Single_Employee()
        {
            using (var client = new APIClientProvider().Client)
            {
                var response = await client.GetAsync("/api/employees/1");


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

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

                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                Assert.NotNull(employee);
            }
        }
        public async Task Test_Get_All_Departments_With_Employees()
        {
            using (var client = new APIClientProvider().Client)
            {
                var response = await client.GetAsync("api/Department?_include=employees");

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

                var departments = JsonConvert.DeserializeObject <List <Department> >(responseBody);
                var employees   = JsonConvert.DeserializeObject <List <Employee> >(responseBody);
                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                Assert.True(departments.Count > 0);
                Assert.True(employees.Count > 0);
            }
        }
        public async Task Test_Create_And_Delete_Program()
        {
            using (var client = new APIClientProvider().Client)
            {
                // Create a new David
                TrainingProgram newProgram = await createProgram(client);

                // Make sure his info checks out
                Assert.Equal("Computer Programming Program", newProgram.Name);
                Assert.Equal(14, newProgram.MaxAttendees);


                deleteProgram(newProgram, client);
            }
        }
        public async Task Test_Put_TrainingProgram()
        {
            string newName = "Feather Factory Learning Center For Soft People";



            using (var client = new APIClientProvider().Client)
            {
                /*
                 *  ARRANGE
                 */
                TrainingProgram ModifiedFeatherFactory = new TrainingProgram
                {
                    Name         = newName,
                    StartDate    = DateTime.Now,
                    EndDate      = DateTime.Now.AddDays(30),
                    MaxAttendees = 5
                };

                var ModifiedFeatherFactoryAsJSON = JsonConvert.SerializeObject(ModifiedFeatherFactory);


                /*
                 *  ACT
                 */
                var response = await client.PutAsync("/api/TrainingPrograms/2",
                                                     new StringContent(ModifiedFeatherFactoryAsJSON, Encoding.UTF8, "application/json"));


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

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

                var GetFeatherFactory = await client.GetAsync("/api/TrainingPrograms/2");

                GetFeatherFactory.EnsureSuccessStatusCode();

                string GetFeatherFactoryBody = await GetFeatherFactory.Content.ReadAsStringAsync();

                TrainingProgram NewFeatherFactory = JsonConvert.DeserializeObject <TrainingProgram>(GetFeatherFactoryBody);

                /*
                 *  ASSERT
                 */
                Assert.Equal(HttpStatusCode.OK, GetFeatherFactory.StatusCode);
                Assert.Equal(newName, NewFeatherFactory.Name);
            }
        }