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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        public void TestListInterestPointAsync()
        {
            BoraNowSeeder.Seed();
            var bo      = new InterestPointBusinessObject();
            var resList = bo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
Ejemplo n.º 4
0
        public void TestDeleteInterestPointAsync()
        {
            BoraNowSeeder.Seed();
            var bo        = new InterestPointBusinessObject();
            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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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 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);
        }
Ejemplo n.º 10
0
        public void TestUpdateInterestPointNewsletterAsync()
        {
            BoraNowSeeder.Seed();
            var ipnbo   = new InterestPointNewsletterBusinessObject();
            var resList = ipnbo.List();
            var item    = resList.Result.FirstOrDefault();

            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 newInterestPointNews = new InterestPointNewsletter(interestPoint.Id, news.Id);

            item.InterestPointId = newInterestPointNews.InterestPointId;
            item.NewsLetterId    = newInterestPointNews.NewsLetterId;

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

            resList = ipnbo.ListAsync().Result;

            Assert.IsTrue(resUpdate.Success && resList.Success &&
                          resList.Result.First().InterestPointId == newInterestPointNews.InterestPointId && resList.Result.First().NewsLetterId == newInterestPointNews.NewsLetterId);
        }