Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public void TestUpdateQuizAnswer()
        {
            BoraNowSeeder.Seed();
            var qabo       = new QuizAnswerBusinessObject();
            var qqbo       = new QuizQuestionBusinessObject();
            var quizbo     = new QuizBusinessObject();
            var resList    = qabo.List();
            var quizAnswer = resList.Result.FirstOrDefault();


            var newQuiz         = new Quiz("Where you wanna go?");
            var newQuizQuestion = new QuizQuestion("Where you wanna go?", newQuiz.Id);

            quizbo.Create(newQuiz);
            qqbo.Create(newQuizQuestion);

            quizAnswer.QuizQuestionId = newQuizQuestion.Id;
            quizAnswer.Answer         = "yes";

            var resUpdate = qabo.Update(quizAnswer);

            resList = qabo.List();

            Assert.IsTrue(resUpdate.Success && resList.Success && resList.Result.First().Answer == "yes" &&
                          resList.Result.First().QuizQuestionId == newQuizQuestion.Id);
        }
Ejemplo n.º 3
0
        public void TestListQuizAsync()
        {
            BoraNowSeeder.Seed();
            var bo      = new QuizBusinessObject();
            var resList = bo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
Ejemplo n.º 4
0
        public void TestCreateQuizAsync()
        {
            BoraNowSeeder.Seed();
            var _quiz     = new Quiz("Questionário BoraNow");
            var _bo       = new QuizBusinessObject();
            var resCreate = _bo.CreateAsync(_quiz).Result;
            var resGet    = _bo.ReadAsync(_quiz.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Ejemplo n.º 5
0
        public void TesDeletetQuiz()
        {
            BoraNowSeeder.Seed();
            var bo        = new QuizBusinessObject();
            var resList   = bo.List();
            var resDelete = bo.Delete(resList.Result.First().Id);

            resList = bo.List();

            Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.First().IsDeleted);
        }
Ejemplo n.º 6
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.º 7
0
        public void TestUpdateQuizAsync()
        {
            BoraNowSeeder.Seed();
            var qbo     = new QuizBusinessObject();
            var resList = qbo.List();

            var quiz    = resList.Result.FirstOrDefault();
            var newQuiz = new Quiz("BoraNow Quiz");

            quiz.Title = newQuiz.Title;

            var resUpdate = qbo.UpdateAsync(quiz).Result;

            resList = qbo.ListAsync().Result;
            Assert.IsTrue(resUpdate.Success && resList.Success && resList.Result.First().Title == quiz.Title);
        }
Ejemplo n.º 8
0
        public void TestCreateQuizQuestionAsync()
        {
            BoraNowSeeder.Seed();
            var qqbo = new QuizQuestionBusinessObject();
            var qbo  = new QuizBusinessObject();

            var quiz = new Quiz("This quiz rocks");

            qbo.Create(quiz);

            var quizQuestion = new QuizQuestion("do u like wine?", quiz.Id);

            var resCreate = qqbo.CreateAsync(quizQuestion).Result;
            var resGet    = qqbo.ReadAsync(quizQuestion.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
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.º 11
0
        public void TestCreateQuizAnswerAsync()
        {
            BoraNowSeeder.Seed();
            var qabo   = new QuizAnswerBusinessObject();
            var qqbo   = new QuizQuestionBusinessObject();
            var quizbo = new QuizBusinessObject();

            var newQuiz         = new Quiz("Where you wanna go?");
            var newQuizQuestion = new QuizQuestion("Where you wanna go?", newQuiz.Id);

            quizbo.Create(newQuiz);
            qqbo.Create(newQuizQuestion);

            var newQuizAnswer = new QuizAnswer("Beach", newQuizQuestion.Id);

            var resCreate = qabo.CreateAsync(newQuizAnswer).Result;
            var resGet    = qabo.ReadAsync(newQuizAnswer.Id).Result;

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Ejemplo n.º 12
0
        public void TestUpdateQuizQuestion()
        {
            BoraNowSeeder.Seed();
            var qqbo    = new QuizQuestionBusinessObject();
            var resList = qqbo.List();
            var item    = resList.Result.FirstOrDefault();

            var qbo = new QuizBusinessObject();

            var quiz = new Quiz("This quiz rocks");

            qbo.Create(quiz);

            item.QuizId   = quiz.Id;
            item.Question = "viewpoint?";


            var resUpdate = qqbo.Update(item);

            resList = qqbo.List();

            Assert.IsTrue(resUpdate.Success && resList.Success && resList.Result.First().Question == "viewpoint?" &&
                          resList.Result.First().QuizId == quiz.Id);
        }