Exemple #1
0
        public void ActivityShedules_Create()
        {
            int countActivitiesBefore = activitySchedules.Count;

            ActionResult actionResult = controller.Create(newActivitySchedule);

            Assert.AreNotEqual(countActivitiesBefore, activitySchedules.Count);
            Assert.IsInstanceOfType(actionResult, typeof(RedirectToRouteResult));
        }
Exemple #2
0
        public async Task CreateTest()
        {
            IActionResult res;
            GroupModel    gm = new GroupModel(100)
            {
                Tags = "TAGS",
                Name = "NAME",
                Type = Group.GroupType.Open
            };


            /*Rely on [Authorize]
             * LogOut();
             * res = controller.Create();
             * Assert.IsInstanceOf<ForbidResult>(res);
             * res = await controller.Create(gm);
             * Assert.IsInstanceOf<ForbidResult>(res);
             */
            LogIn(users[1]);
            res = controller.Create();
            Assert.IsInstanceOf <ViewResult>(res);
            Assert.IsInstanceOf <GroupModel>(((ViewResult)res).Model);
            int c = groups.Count;

            res = await controller.Create(gm);

            Assert.IsInstanceOf <RedirectToActionResult>(res);
            Assert.AreEqual(c + 1, (await GetContext().Group.LastAsync()).Id);

            c = await GetContext().Group.CountAsync();

            controller.ModelState.AddModelError("Name", "ERR");
            res = await controller.Create(gm);

            Assert.IsInstanceOf <ViewResult>(res);
            Assert.IsInstanceOf <GroupModel>(((ViewResult)res).Model);
            Assert.AreEqual(c, await GetContext().Group.CountAsync());
        }
Exemple #3
0
 public void Create()
 {
     GroupsController test   = new GroupsController();
     ViewResult       result = test.Create() as ViewResult;
     //result.ExecuteResult();
 }
        public void Create_Group_ShouldReturnView()
        {
            var result = _controller.Create();

            Assert.IsAssignableFrom <IActionResult>(result);
        }