public void TestCreateAndListServiceProvidedAsync()
        {
            ApplicationSeeder.Seed();

            var bo        = new ServiceProvidedBO();
            var foreignBO = new ServiceBO();

            var serviceProvided = new ServiceProvided(foreignBO.ListUndeleted().Result.First().Id);

            var resCreate = bo.CreateAsync(serviceProvided).Result;
            var resGet    = bo.ReadAsync(serviceProvided.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
        public void TestDeleteService()
        {
            ApplicationSeeder.Seed();

            var bo = new ServiceBO();

            var resList = bo.List();
            var total   = resList.Result.Count;

            var resDelete = bo.Delete(resList.Result.First().Id);

            var list = bo.ListUndeleted();

            Assert.IsTrue(resDelete.Success && resList.Success && list.Result.Count == (total - 1));
        }
        public void TestUpdateService()
        {
            ApplicationSeeder.Seed();

            var bo = new ServiceBO();

            var resList = bo.List();

            var item = resList.Result.FirstOrDefault();

            item.IsActive = false;

            var resUpdate = bo.Update(item);

            var list = bo.ListUndeleted();

            Assert.IsTrue(resList.Success && resUpdate.Success && list.Result.First().IsActive == false);
        }
        public void TestUpdateServiceProvidedAsync()
        {
            ApplicationSeeder.Seed();

            var bo        = new ServiceProvidedBO();
            var foreignBO = new ServiceBO();

            var resList = bo.ListAsync().Result;

            var item = resList.Result.FirstOrDefault();

            item.ServiceId = foreignBO.ListUndeleted().Result.Last().Id;

            var resUpdate = bo.UpdateAsync(item).Result;

            var list = bo.ListUndeletedAsync().Result;

            Assert.IsTrue(resList.Success && resUpdate.Success && list.Result.First().ServiceId == foreignBO.ListUndeleted().Result.Last().Id);
        }
        public void TestCreateAndListJobAsync()
        {
            ApplicationSeeder.Seed();

            var bo              = new JobBO();
            var foreignBO       = new ServiceBO();
            var foreignClientBO = new ClientBO();

            var job = new Job("Setúbal N4 1323", DateTime.Now.Date.AddDays(2), DateTime.Now.Date.AddDays(2).AddMinutes(180), 23.99, "Scheduled", 0, false, foreignBO.ListUndeleted().Result.First().Id, foreignClientBO.ListUndeleted().Result.First().Id);

            var resCreate = bo.CreateAsync(job).Result;
            var resGet    = bo.ReadAsync(job.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }