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 TestListCountryAsync() { BoraNowSeeder.Seed(); var cbo = new CountryBusinessObject(); var resList = cbo.ListAsync().Result; Assert.IsTrue(resList.Success && resList.Result.Count == 2); }
public void TestDeleteCountryAsync() { BoraNowSeeder.Seed(); var vbo = new CountryBusinessObject(); var resList = vbo.List(); var resDelete = vbo.DeleteAsync(resList.Result.First().Id).Result; resList = vbo.ListAsync().Result; Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.First().IsDeleted); }
public void TestCreateCountryAsync() { BoraNowSeeder.Seed(); var vbo = new CountryBusinessObject(); var country = new Country("madagascar"); var resCreate = vbo.CreateAsync(country).Result; var restGet = vbo.ReadAsync(country.Id).Result; Assert.IsTrue(resCreate.Success && restGet.Success && restGet.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 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 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 TestUpdateCountryAsync() { BoraNowSeeder.Seed(); var vbo = new CountryBusinessObject(); var resList = vbo.List(); var item = resList.Result.FirstOrDefault(); var country = new Country("madagascar"); item.Name = country.Name; //item.ProfileId = Country.ProfileId; var resUpdate = vbo.UpdateAsync(item).Result; resList = vbo.ListAsync().Result; Assert.IsTrue(resUpdate.Success && resList.Success && resList.Result.First().Name == country.Name); }
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 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); }