public void Test_Deleting_A_Service_Offer()
        {
            var context = new DbTestDataContext();

            using (var unitOfWork = new UnitOfWork(context))
            {
                try
                {
                    unitOfWork.Users.Create(GetUser());
                    ServiceOffer service = unitOfWork.Offers.Create(GetServiceOffer());
                    var          result  = unitOfWork.Offers.Delete(t => t.ID == service.ID);
                    Assert.IsTrue(result);
                }
                catch
                {
                    Assert.Fail();
                }
                finally
                {
                    context.ServiceOffer.DeleteAllOnSubmit(context.ServiceOffer);
                    context.SubmitChanges();
                    context.Users.DeleteAllOnSubmit(context.Users);
                    context.AspNetUsers.DeleteAllOnSubmit(context.AspNetUsers);
                    context.AddressTable.DeleteAllOnSubmit(context.AddressTable);
                    context.SubmitChanges();
                }
            }
        }
        public void Test_Getting_Specific_Service_Offer()
        {
            var context = new DbTestDataContext();

            using (var unitOfWork = new UnitOfWork(context))
            {
                try
                {
                    unitOfWork.Users.Create(GetUser());
                    ServiceOffer created = unitOfWork.Offers.Create(GetServiceOffer());
                    ServiceOffer result  = unitOfWork.Offers.Get(t => t.ID == created.ID);
                    Assert.AreEqual("Cleaning", created.SubCategory.Name.ToString());
                    Assert.AreEqual(created.SubCategory, result.SubCategory);
                }
                catch
                {
                    Assert.Fail();
                }
                finally
                {
                    context.ServiceOffer.DeleteAllOnSubmit(context.ServiceOffer);
                    context.SubmitChanges();
                    context.Users.DeleteAllOnSubmit(context.Users);
                    context.AspNetUsers.DeleteAllOnSubmit(context.AspNetUsers);
                    context.AddressTable.DeleteAllOnSubmit(context.AddressTable);
                    context.SubmitChanges();
                }
            }
        }
        private static ServiceOffer GetServiceOffer()
        {
            var ServiceOffertub = new ServiceOffer
            {
                SubCategory = new SubCategory
                {
                    Name     = "Cleaning",
                    Category = new Category
                    {
                        Name = "Home",
                    },
                },
                RatePerHour = 20,
                Description = "Sample",
                Employee_ID = "Username12",
                Title       = "First",
            };

            return(ServiceOffertub);
        }
        private static ServiceOffer GetInvalidServiceOffer()
        {
            var ServiceOffertub = new ServiceOffer
            {
                SubCategory = new SubCategory
                {
                    Name     = "Notexists",
                    Category = new Category
                    {
                        Name = "Notexists",
                    },
                },
                RatePerHour = -1,
                Description = " ",
                Employee_ID = "hftrtoerp[ggpohi54-6934-09-023",
                Title       = "Inval",
            };

            return(ServiceOffertub);
        }
        private static ServiceOffer ToUpdateServiceOffer()
        {
            var ServiceOffertub = new ServiceOffer
            {
                SubCategory = new SubCategory
                {
                    Name     = "Buildings",
                    Category = new Category
                    {
                        Name = "Architecture",
                    },
                },
                RatePerHour = 100,
                Description = "Updated",
                Employee_ID = "Username123",
                Title       = "Updated",
            };

            return(ServiceOffertub);
        }