Example #1
0
        public void TestListResultInterestPointAsync()
        {
            BoraNowSeeder.Seed();
            var bo      = new ResultInterestPointBusinessObject();
            var resList = bo.ListAsync().Result;

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
Example #2
0
        public async Task <IActionResult> Index()
        {
            var listOperation = await _bo.ListAsync();

            if (!listOperation.Success)
            {
                return(OperationErrorBackToIndex(listOperation.Exception));
            }
            var ipListOperation = await _ipbo.ListAsync();

            if (!ipListOperation.Success)
            {
                return(OperationErrorBackToIndex(ipListOperation.Exception));
            }
            var rListOperation = await _rbo.ListAsync();

            if (!rListOperation.Success)
            {
                return(OperationErrorBackToIndex(rListOperation.Exception));
            }


            var list = new List <ResultInterestPointViewModel>();

            foreach (var item in listOperation.Result)
            {
                if (!item.IsDeleted)
                {
                    list.Add(ResultInterestPointViewModel.Parse(item));
                }
            }

            var ipList = new List <InterestPointViewModel>();

            foreach (var item in ipListOperation.Result)
            {
                if (!item.IsDeleted)
                {
                    ipList.Add(InterestPointViewModel.Parse(item));
                }
            }
            var rList = new List <ResultViewModel>();

            foreach (var item in rListOperation.Result)
            {
                if (!item.IsDeleted)
                {
                    rList.Add(ResultViewModel.Parse(item));
                }
            }

            ViewData["Title"]       = "Result Interest Point  ";
            ViewData["BreadCrumbs"] = GetCrumbs();
            ViewData["DeleteHref"]  = GetDeleteRef();
            ViewBag.InterestPoints  = ipList;
            ViewBag.Results         = rList;
            return(View(list));
        }
Example #3
0
        public void TesDeletetResultInterestPointAsync()
        {
            BoraNowSeeder.Seed();
            var bo        = new ResultInterestPointBusinessObject();
            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);
        }
Example #4
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);
        }