public void InsertTest() { var task1 = CustomerManager.Load(); Customer customer = task1.Result.FirstOrDefault(); task1.Wait(); var task2 = EmployeeManager.Load(); Employee employee = task2.Result.FirstOrDefault(); task2.Wait(); var task3 = ServiceTypeManager.Load(); ServiceType serviceType = task3.Result.FirstOrDefault(); task3.Wait(); Appointment appointment = new Appointment { CustomerId = customer.Id, EmployeeId = employee.Id, StartDateTime = DateTime.Now, EndDateTime = DateTime.Now.AddHours(2), ServiceId = serviceType.Id, Status = AppointmentStatus.Scheduled.ToString() }; var task4 = AppointmentManager.Insert(appointment, true); bool result = task4.Result; task4.Wait(); Assert.IsTrue(result == true); }
public async Task <ActionResult <IEnumerable <ServiceType> > > Get() { try { return(Ok(await ServiceTypeManager.Load())); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }
public void LoadTest() { int expected = 3; var task = ServiceTypeManager.Load(); List <ServiceType> serviceTypes = task.Result; task.Wait(); Assert.AreEqual(expected, serviceTypes.Count); }
public void DeleteTest() { var task = ServiceTypeManager.Load(); ServiceType serviceType = task.Result.FirstOrDefault(); task.Wait(); var task2 = ServiceTypeManager.Delete(serviceType.Id, true); int result = task2.Result; task2.Wait(); Assert.IsTrue(result > 0); }
public void UpdateTest() { var task = ServiceTypeManager.Load(); ServiceType serviceType = task.Result.FirstOrDefault(); task.Wait(); serviceType.CostPerSQFT = 0.003M; var task2 = ServiceTypeManager.Update(serviceType, true); int result = task2.Result; task2.Wait(); Assert.IsTrue(result > 0); }
public void LoadByIdDescription() { var task = ServiceTypeManager.Load(); List <ServiceType> serviceTypes = task.Result; task.Wait(); string description = serviceTypes.FirstOrDefault().Description; var task2 = ServiceTypeManager.LoadByDescription(description); ServiceType serviceType = task2.Result; task2.Wait(); Assert.IsTrue(serviceType.Description == description); }
public void LoadByIdTest() { var task = ServiceTypeManager.Load(); List <ServiceType> serviceTypes = task.Result; task.Wait(); Guid id = serviceTypes.FirstOrDefault().Id; var task2 = ServiceTypeManager.LoadById(id); ServiceType serviceType = task2.Result; task2.Wait(); Assert.IsTrue(serviceType.Id == id); }