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);
        }
Example #2
0
        public ActionResult Create([FromBody] CategoryInterestPointViewModel vm)
        {
            var c = new CategoryInterestPoint(vm.Name);

            var res  = _bo.Create(c);
            var code = res.Success ? HttpStatusCode.OK : HttpStatusCode.InternalServerError;

            return(new ObjectResult(code));
        }
        public void TestCreateCategoryInterestPoint()
        {
            BoraNowSeeder.Seed();
            var cipbo = new CategoryInterestPointBusinessObject();

            var categoryInterestPoint = new CategoryInterestPoint("B");

            var resCreate = cipbo.Create(categoryInterestPoint);
            var resGet    = cipbo.Read(categoryInterestPoint.Id);

            Assert.IsTrue(resGet.Success && resCreate.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);
        }