public void TestCreateResultAsync() { var rbo = new ResultBusinessObject(); var qbo = new QuizBusinessObject(); var vbo = new VisitorBusinessObject(); var quiz = new Quiz("Quiz 1"); qbo.Create(quiz); var countrybo = new CountryBusinessObject(); var pbo = new ProfileBusinessObject(); var companybo = new CompanyBusinessObject(); var country = new Country("Holanda"); var profile = new Profile("a", "b"); var company = new Company("a", "b", "c", "d", profile.Id); countrybo.Create(country); pbo.Create(profile); companybo.Create(company); var visitor = new Visitor("B", "N", DateTime.Now, "Male", profile.Id, country.Id); vbo.Create(visitor); var result = new Result("Q1 Result", DateTime.UtcNow, quiz.Id, visitor.Id); var resCreate = rbo.CreateAsync(result).Result; var resGet = rbo.ReadAsync(result.Id).Result; Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null); }
public void TestCreateInterestPointNewsletterAsync() { BoraNowSeeder.Seed(); var ipnbo = new InterestPointNewsletterBusinessObject(); var nbo = new NewsletterBusinessObject(); var cbo = new CompanyBusinessObject(); var ipbo = new InterestPointBusinessObject(); var pbo = new ProfileBusinessObject(); var profile = new Profile("II", "AA"); pbo.Create(profile); var news = new Newsletter("New in town, this doughnut place is nuts", "New in town"); var company = new Company("a", "b", "c", "123333", profile.Id); var interestPoint = new InterestPoint("a", "b", "c", "d", "e", "f", "g", true, true, company.Id); nbo.Create(news); cbo.Create(company); ipbo.Create(interestPoint); var interestPointNews = new InterestPointNewsletter(interestPoint.Id, news.Id); var resCreate = ipnbo.CreateAsync(interestPointNews).Result; var restGet = ipnbo.ReadAsync(interestPointNews.Id).Result; Assert.IsTrue(resCreate.Success && restGet.Success && restGet.Result != null); }
public void TestUpdatetCompany() { BoraNowSeeder.Seed(); var cbo = new CompanyBusinessObject(); var resList = cbo.List(); var item = resList.Result.FirstOrDefault(); var pbo = new ProfileBusinessObject(); var profile = new Profile("II", "AA"); pbo.Create(profile); var company = new Company("B", "C", "1263", "2434", profile.Id); item.Name = company.Name; item.Representative = company.Representative; item.PhoneNumber = company.PhoneNumber; item.VatNumber = company.VatNumber; item.ProfileId = company.ProfileId; var resUpdate = cbo.Update(item); resList = cbo.List(); Assert.IsTrue(resUpdate.Success && resList.Success && resList.Result.First().Name == company.Name && resList.Result.First().Representative == company.Representative && resList.Result.First().PhoneNumber == company.PhoneNumber && resList.Result.First().VatNumber == company.VatNumber && resList.Result.First().ProfileId == company.ProfileId); }
public void TestCreateInterestPointCategoryAsync() { BoraNowSeeder.Seed(); var ipcipbo = new InterestPointCategoryInterestPointBusinessObject(); var ipbo = new InterestPointBusinessObject(); var cipbo = new CategoryInterestPointBusinessObject(); var pbo = new ProfileBusinessObject(); var profile = new Profile("II", "AA"); pbo.Create(profile); var c = new CompanyBusinessObject(); var company = new Company("A", "B", "12345678", "1234567", profile.Id); c.Create(company); var interestPoint = new InterestPoint("a", "b", "c", "d", "e", "f", "g", true, true, company.Id); var category = new CategoryInterestPoint("vegan"); var interestPointCategory = new InterestPointCategoryInterestPoint(interestPoint.Id, category.Id); ipbo.Create(interestPoint); cipbo.Create(category); var resCreate = ipcipbo.CreateAsync(interestPointCategory).Result; var resGet = ipcipbo.ReadAsync(interestPointCategory.Id).Result; Assert.IsTrue(resGet.Success && resCreate.Success && resGet.Result != null); }
public void TestListProfileAsync() { BoraNowSeeder.Seed(); var pbo = new ProfileBusinessObject(); var resList = pbo.ListAsync().Result; Assert.IsTrue(resList.Success && resList.Result.Count == 2); }
public void TestListProfileAsync() { ContextSeeder.Seed(); var bo = new ProfileBusinessObject(); var resList = bo.ListAsync().Result; Assert.IsTrue(resList.Success && resList.Result.Count == 1); }
public void TestDeleteProfile() { ContextSeeder.Seed(); var bo = new ProfileBusinessObject(); var resList = bo.List(); var resDelete = bo.Delete(resList.Result.First().Id); var resNotList = bo.List().Result.Where(x => !x.IsDeleted).ToList(); Assert.IsTrue(resDelete.Success && resNotList.Count == 0); }
public void TestCreateSamePhoneNumberProfileAsync() { ContextSeeder.Seed(); var bo = new ProfileBusinessObject(); var item = bo.ListAsync().Result.Result.First(); var reg = new Profile(123456089, "Manuel", "Macabres", item.PhoneNumber, DateTime.UtcNow); var resCreate = bo.CreateAsync(reg).Result; Assert.IsTrue(resCreate.Success && resCreate.Message == "Phone number already exists"); }
public void TestCreateSameVatNumberProfile() { ContextSeeder.Seed(); var bo = new ProfileBusinessObject(); var item = bo.List().Result.First(); var reg = new Profile(item.VatNumber, "Manuel", "Macabres", 919191918, DateTime.UtcNow); var resCreate = bo.Create(reg); Assert.IsTrue(resCreate.Success && resCreate.Message == "Vat number already exists"); }
public void TestDeleteProfileAsync() { ContextSeeder.Seed(); var bo = new ProfileBusinessObject(); var resList = bo.ListAsync().Result; var resDelete = bo.DeleteAsync(resList.Result.First().Id).Result; resList = bo.ListNotDeletedAsync().Result; Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.Count == 0); }
public void TestCreateAndReadProfileAsync() { ContextSeeder.Seed(); var bo = new ProfileBusinessObject(); var reg = new Profile(123459789, "Manuel", "Macabres", 939191919, DateTime.UtcNow); var resCreate = bo.CreateAsync(reg).Result; var resGet = bo.ReadAsync(reg.Id).Result; Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null); }
public void TestDeleteInterestPointCategoryAsync() { BoraNowSeeder.Seed(); var bo = new ProfileBusinessObject(); var resList = bo.List(); var resDelete = bo.DeleteAsync(resList.Result.First().Id).Result; resList = bo.ListAsync().Result; Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.First().IsDeleted); }
public void TestUpdateSamePhoneNumberProfileAsync() { ContextSeeder.Seed(); var bo = new ProfileBusinessObject(); var item = new Profile(123450789, "Manuel", "Macabres", 939191919, DateTime.UtcNow); bo.Create(item); item.PhoneNumber = 919191919; var resUpdate = bo.UpdateAsync(item).Result; Assert.IsTrue(resUpdate.Success && resUpdate.Message == "Phone number already exists"); }
public void TestCreateAndReadShoppingBasketAsync() { ContextSeeder.Seed(); var bo = new ShoppingBasketBusinessObject(); var pbo = new ProfileBusinessObject(); var pro = pbo.ListAsync().Result.Result.FirstOrDefault(); var sb = new ShoppingBasket(pro.Id); var resCreate = bo.CreateAsync(sb).Result; var resGet = bo.ReadAsync(sb.Id).Result; Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null); }
public void TestCreateProfile() { BoraNowSeeder.Seed(); var pbo = new ProfileBusinessObject(); var profile = new Profile("B", "C"); var resCreate = pbo.Create(profile); var resGet = pbo.Read(profile.Id); Assert.IsTrue(resGet.Success && resCreate.Success && resGet.Result != null); }
public void TestUpdateResultInterestPointAsync() { BoraNowSeeder.Seed(); var ripbo = new ResultInterestPointBusinessObject(); var resList = ripbo.List(); var item = resList.Result.FirstOrDefault(); var rbo = new ResultBusinessObject(); var ipbo = new InterestPointBusinessObject(); var vbo = new VisitorBusinessObject(); var qbo = new QuizBusinessObject(); var quiz = new Quiz("Quiz 1"); qbo.Create(quiz); var countrybo = new CountryBusinessObject(); var pbo = new ProfileBusinessObject(); var companybo = new CompanyBusinessObject(); var country = new Country("Holanda"); var profile = new Profile("a", "b"); var company = new Company("a", "b", "c", "d", profile.Id); countrybo.Create(country); pbo.Create(profile); companybo.Create(company); var visitor = new Visitor("A", "E", DateTime.Now, "M", profile.Id, country.Id); vbo.Create(visitor); var result = new Result("Quiz 2", DateTime.UtcNow, quiz.Id, visitor.Id); var interestPoint = new InterestPoint("Bar do Rui", "Pesticos&Cocktails", "-", "C://images", "14h", "00h", "D", true, true, company.Id); rbo.Create(result); ipbo.Create(interestPoint); var resultInterestPoint = new ResultInterestPoint(result.Id, interestPoint.Id); item.ResultId = resultInterestPoint.ResultId; item.InterestPointId = resultInterestPoint.InterestPointId; var resUpdate = ripbo.UpdateAsync(item).Result; resList = ripbo.ListAsync().Result; Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().ResultId == item.ResultId && resList.Result.First().InterestPointId == item.InterestPointId); }
public void TestUpdateProfileAsync() { ContextSeeder.Seed(); var bo = new ProfileBusinessObject(); var resList = bo.ListAsync().Result; var item = resList.Result.FirstOrDefault(); item.FirstName = "Jorge"; var resUpdate = bo.UpdateAsync(item).Result; resList = bo.ListNotDeletedAsync().Result; Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().FirstName == "Jorge"); }
public void TestUpdateShoppingBasketAsync() { ContextSeeder.Seed(); var bo = new ShoppingBasketBusinessObject(); var resList = bo.ListAsync().Result; var item = resList.Result.FirstOrDefault(); var pbo = new ProfileBusinessObject(); var pro = pbo.List().Result.FirstOrDefault(); item.ProfileId = pro.Id; var resUpdate = bo.UpdateAsync(item).Result; resList = bo.ListNotDeletedAsync().Result; Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().ProfileId == pro.Id); }
public void TestUpdateInterestPoint() { BoraNowSeeder.Seed(); var ipbo = new InterestPointBusinessObject(); var resList = ipbo.List(); var item = resList.Result.FirstOrDefault(); var cbo = new CompanyBusinessObject(); var pbo = new ProfileBusinessObject(); var profile = new Profile("II", "AA"); pbo.Create(profile); var company = new Company("kfc", "you", "9111222", "11111", profile.Id); cbo.Create(company); var interestPoint = new InterestPoint("a", "b", "c", "d", "e", "f", "g", true, true, company.Id); item.Name = interestPoint.Name; item.Address = interestPoint.Address; item.ClosingDays = interestPoint.ClosingDays; item.ClosingHours = interestPoint.ClosingHours; item.Description = interestPoint.Description; item.OpeningHours = interestPoint.OpeningHours; item.PhotoPath = interestPoint.PhotoPath; item.CovidSafe = interestPoint.CovidSafe; item.Status = interestPoint.Status; item.CompanyId = interestPoint.CompanyId; var resUpdate = ipbo.Update(item); resList = ipbo.List(); Assert.IsTrue(resUpdate.Success && resList.Success && resList.Result.First().Name == interestPoint.Name && resList.Result.First().Address == interestPoint.Address && resList.Result.First().ClosingHours == interestPoint.ClosingHours && resList.Result.First().Description == interestPoint.Description && resList.Result.First().ClosingDays == interestPoint.ClosingDays && resList.Result.First().OpeningHours == interestPoint.OpeningHours && resList.Result.First().PhotoPath == interestPoint.PhotoPath && resList.Result.First().CovidSafe == interestPoint.CovidSafe && resList.Result.First().Status == interestPoint.Status && resList.Result.First().CompanyId == interestPoint.CompanyId); }
public void TestCreateCompany() { BoraNowSeeder.Seed(); var cbo = new CompanyBusinessObject(); var pbo = new ProfileBusinessObject(); var profile = new Profile("EE", "AA"); pbo.Create(profile); var company = new Company("B", "C", "123", "234", profile.Id); var resCreate = cbo.Create(company); var resGet = cbo.Read(company.Id); Assert.IsTrue(resGet.Success && resCreate.Success && resGet.Result != null); }
public void TestCreateAndReadReservedQueueAsync() { ContextSeeder.Seed(); var boProf = new ProfileBusinessObject(); var profList = boProf.List().Result.First(); var boEst = new EstablishmentBusinessObject(); var estList = boEst.List().Result.First(); var bo = new ReservedQueueBusinessObject(); var res = new ReservedQueue(estList.Id, profList.Id); var resCreate = bo.CreateAsync(res).Result; var resGet = bo.ReadAsync(res.Id).Result; Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null); }
public void TestUpdateResultAsync() { BoraNowSeeder.Seed(); var rbo = new ResultBusinessObject(); var resList = rbo.List(); var item = resList.Result.FirstOrDefault(); var qbo = new QuizBusinessObject(); var quiz = new Quiz("Quiz 2"); qbo.Create(quiz); var countrybo = new CountryBusinessObject(); var pbo = new ProfileBusinessObject(); var companybo = new CompanyBusinessObject(); var country = new Country("Holanda"); var profile = new Profile("a", "b"); var company = new Company("a", "b", "c", "d", profile.Id); countrybo.Create(country); pbo.Create(profile); companybo.Create(company); var vbo = new VisitorBusinessObject(); var visitor = new Visitor("B", "N", DateTime.Now, "Male", profile.Id, country.Id); vbo.Create(visitor); var result = new Result("Q1 Result", DateTime.UtcNow, quiz.Id, visitor.Id); item.Title = result.Title; item.Date = result.Date; item.QuizId = result.QuizId; item.VisitorId = result.VisitorId; var resUpdate = rbo.Update(item); resList = rbo.ListAsync().Result; Assert.IsTrue(resList.Success && resUpdate.Success && resList.Result.First().Title == item.Title && resList.Result.First().Date == item.Date && resList.Result.First().QuizId == item.QuizId && resList.Result.First().VisitorId == item.VisitorId); }
public void TestHourLimitAsync() { ContextSeeder.Seed(); var boProf = new ProfileBusinessObject(); var profList = boProf.List().Result.First(); var boEst = new EstablishmentBusinessObject(); var estList = boEst.List().Result.First(); var bo = new ReservedQueueBusinessObject(); var res = new ReservedQueue(Guid.NewGuid(), DateTime.UtcNow.AddHours(-3), DateTime.UtcNow, false, estList.Id, profList.Id); var resCreate = bo.CreateAsync(res); var limit = bo.TwoHourLimitReserveAsync(res.Id); Assert.IsTrue(res.IsDeleted && limit.Result.Success && !limit.Result.Result); }
public void TestCreateResultInterestPointAsync() { var ripbo = new ResultInterestPointBusinessObject(); var rbo = new ResultBusinessObject(); var ipbo = new InterestPointBusinessObject(); var vbo = new VisitorBusinessObject(); var qbo = new QuizBusinessObject(); var quiz = new Quiz("Quiz 1"); qbo.Create(quiz); var countrybo = new CountryBusinessObject(); var pbo = new ProfileBusinessObject(); var companybo = new CompanyBusinessObject(); var country = new Country("Holanda"); var profile = new Profile("a", "b"); var company = new Company("a", "b", "c", "d", profile.Id); countrybo.Create(country); pbo.Create(profile); companybo.Create(company); var visitor = new Visitor("A", "C", DateTime.Now, "M", profile.Id, country.Id); vbo.Create(visitor); var result = new Result("Quiz 1", DateTime.UtcNow, quiz.Id, visitor.Id); var interestPoint = new InterestPoint("Bar do Rui", "Pesticos&Cocktails", "Rua dos Anjos", "C://images", "14h", "00h", "Sabados", true, true, company.Id); rbo.Create(result); ipbo.Create(interestPoint); var _resultInterestPoint = new ResultInterestPoint(result.Id, interestPoint.Id); var resCreate = ripbo.CreateAsync(_resultInterestPoint).Result; var resGet = ripbo.ReadAsync(_resultInterestPoint.Id).Result; Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null); }
public void TestUpdatetProfile() { BoraNowSeeder.Seed(); var pbo = new ProfileBusinessObject(); var resList = pbo.List(); var item = resList.Result.FirstOrDefault(); var profile = new Profile("E", "A"); item.Description = profile.Description; item.PhotoPath = profile.PhotoPath; var resUpdate = pbo.Update(item); resList = pbo.List(); Assert.IsTrue(resUpdate.Success && resList.Success && resList.Result.First().Description == profile.Description && resList.Result.First().PhotoPath == profile.PhotoPath); }
public void TestUpdateVisitor() { BoraNowSeeder.Seed(); var vbo = new VisitorBusinessObject(); var resList = vbo.List(); var item = resList.Result.FirstOrDefault(); var countrybo = new CountryBusinessObject(); var pbo = new ProfileBusinessObject(); var companybo = new CompanyBusinessObject(); var country = new Country("Holanda"); var profile = new Profile("a", "b"); var company = new Company("a", "b", "c", "d", profile.Id); countrybo.Create(country); pbo.Create(profile); companybo.Create(company); var visitor = new Visitor("R", "f", DateTime.Now.AddYears(-24), "F", profile.Id, country.Id); item.FirstName = visitor.FirstName; item.LastName = visitor.LastName; item.BirthDate = visitor.BirthDate; item.Gender = visitor.Gender; item.ProfileId = visitor.ProfileId; item.CountryId = visitor.CountryId; var resUpdate = vbo.Update(item); resList = vbo.List(); Assert.IsTrue(resUpdate.Success && resList.Success && resList.Result.First().FirstName == visitor.FirstName && resList.Result.First().LastName == visitor.LastName && resList.Result.First().BirthDate == visitor.BirthDate && resList.Result.First().Gender == visitor.Gender && resList.Result.First().ProfileId == visitor.ProfileId && resList.Result.First().CountryId == visitor.CountryId); }
public void TestCreateInterestPointAsync() { BoraNowSeeder.Seed(); var ipbo = new InterestPointBusinessObject(); var cbo = new CompanyBusinessObject(); var pbo = new ProfileBusinessObject(); var profile = new Profile("II", "AA"); pbo.Create(profile); var company = new Company("kfc", "you", "9111222", "11111", profile.Id); cbo.Create(company); var interestPoint = new InterestPoint("a", "b", "c", "d", "e", "f", "g", true, true, company.Id); var resCreate = ipbo.CreateAsync(interestPoint).Result; var resGet = ipbo.ReadAsync(interestPoint.Id).Result; Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null); }
public void TestDailyLimitAsync() { ContextSeeder.Seed(); var boProf = new ProfileBusinessObject(); var profList = boProf.List().Result.First(); var bo = new ShoppingBasketBusinessObject(); var res1 = new ShoppingBasket(profList.Id); var res2 = new ShoppingBasket(profList.Id); var res3 = new ShoppingBasket(profList.Id); var res4 = new ShoppingBasket(profList.Id); bo.Create(res1); bo.Create(res2); bo.Create(res3); bo.Create(res4); var reserves = bo.DayLimitReserveItemsAsync(res4.Id); Assert.IsTrue(reserves.Result.Success && !reserves.Result.Result); }
public void TestUpdateInterestpointCategoryAsync() { BoraNowSeeder.Seed(); var ipcipbo = new InterestPointCategoryInterestPointBusinessObject(); var resList = ipcipbo.ListAsync().Result; var item = resList.Result.FirstOrDefault(); var ipbo = new InterestPointBusinessObject(); var cipbo = new CategoryInterestPointBusinessObject(); var pbo = new ProfileBusinessObject(); var profile = new Profile("II", "AA"); pbo.Create(profile); var c = new CompanyBusinessObject(); var company = new Company("A", "B", "12345678", "1234567", profile.Id); c.Create(company); var interestPoint = new InterestPoint("a", "b", "c", "d", "e", "f", "g", true, true, company.Id); var category = new CategoryInterestPoint("vegan"); ipbo.Create(interestPoint); cipbo.Create(category); var interestPointCategoryInterestPoint = new InterestPointCategoryInterestPoint(interestPoint.Id, category.Id); item.InterestPointId = interestPointCategoryInterestPoint.InterestPointId; item.CategoryId = interestPointCategoryInterestPoint.CategoryId; var resUpdate = ipcipbo.UpdateAsync(item).Result; resList = ipcipbo.ListAsync().Result; Assert.IsTrue(resUpdate.Success && resList.Success && resList.Result.First().InterestPointId == interestPoint.Id && resList.Result.First().CategoryId == category.Id); }
public void TestCreateVisitorAsync() { BoraNowSeeder.Seed(); var vbo = new VisitorBusinessObject(); var countrybo = new CountryBusinessObject(); var pbo = new ProfileBusinessObject(); var companybo = new CompanyBusinessObject(); var country = new Country("Holanda"); var profile = new Profile("a", "b"); var company = new Company("a", "b", "c", "d", profile.Id); countrybo.Create(country); pbo.Create(profile); companybo.Create(company); var visitor = new Visitor("m", "f", DateTime.Now.AddYears(-24), "m", profile.Id, country.Id); var resCreate = vbo.CreateAsync(visitor).Result; var restGet = vbo.ReadAsync(visitor.Id).Result; Assert.IsTrue(resCreate.Success && restGet.Success && restGet.Result != null); }