示例#1
0
        public void TestDeleteInterestPoint()
        {
            BoraNowSeeder.Seed();
            var bo        = new InterestPointBusinessObject();
            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);
        }
示例#2
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);
        }
示例#3
0
        public void TestListInterestPoint()
        {
            BoraNowSeeder.Seed();
            var bo      = new InterestPointBusinessObject();
            var resList = bo.List();

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
        public ActionResult <List <InterestPointViewModel> > List()
        {
            var res = _bo.List();

            if (!res.Success)
            {
                return(new ObjectResult(HttpStatusCode.InternalServerError));
            }
            var list = new List <InterestPointViewModel>();

            foreach (var item in res.Result)
            {
                list.Add(InterestPointViewModel.Parse(item));
            }
            return(list);
        }