Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 public async Task <ActionResult <IEnumerable <ServiceType> > > Get()
 {
     try
     {
         return(Ok(await ServiceTypeManager.Load()));
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message));
     }
 }
Ejemplo n.º 3
0
        public void LoadTest()
        {
            int expected = 3;

            var task = ServiceTypeManager.Load();
            List <ServiceType> serviceTypes = task.Result;

            task.Wait();

            Assert.AreEqual(expected, serviceTypes.Count);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
        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);
        }