コード例 #1
0
        public void TeamProfilesController_Details_Test3()
        {
            // Initialization
            TeamProfilesController ctl = new TeamProfilesController();

            // To test if it is null
            var result = ctl.Details(999);
            Assert.IsNotNull(result);

            // To test if it is a valid id
            var model = (HttpStatusCodeResult)result;
            Assert.AreEqual(404, model.StatusCode);
        }
コード例 #2
0
        public void TeamProfilesController_Index_Test1()
        {
            // Initialization
            TeamProfilesController ctl = new TeamProfilesController();

            // To test if it is null
            var result = ctl.Index();
            Assert.IsNotNull(result);

            // To test the number of the elements in the list
            var modelList = (List<ProfileIndexViewModel>)((ViewResult)result).Model;
            Assert.AreEqual(5, modelList.Count);
        }
コード例 #3
0
        public void TeamProfilesController_Details_Test2()
        {
            // Initialization
            TeamProfilesController ctl = new TeamProfilesController();

            // To test if it is null
            var result = ctl.Details(21);
            Assert.IsNotNull(result);

            // To test if it is a valid id
            var model = (profile)((ViewResult)result).Model;
            Assert.IsNotNull(model);
            //var model = (HttpStatusCodeResult)result;
            //Assert.AreEqual(400, model.StatusCode);
        }
コード例 #4
0
        public async Task TeamProfilesController_Delete_Test3()
        {
            // Initialization
            TeamProfilesController ctl = new TeamProfilesController();

            // To test if it is null
            var result = await ctl.Delete(1);
            Assert.IsNotNull(result);

            // To test if it is a valid id
            var model = (ProfileIndexViewModel)((ViewResult)result).Model;
            Assert.IsNotNull(model);
        }
コード例 #5
0
        public async Task TeamProfilesController_Delete_Test2()
        {
            // Initialization
            TeamProfilesController ctl = new TeamProfilesController();

            // To test if it is null
            var result = await ctl.Delete(21);
            Assert.IsNotNull(result);

            // To test if it is a valid id
            Assert.IsInstanceOfType(result, typeof(HttpNotFoundResult));
            var model = (HttpNotFoundResult)result;
            Assert.AreEqual(404, model.StatusCode);
        }
コード例 #6
0
        public async Task TeamProfilesController_Edit_Test4()
        {
            // Initialization
            TeamProfilesController ctl = new TeamProfilesController();

            // To test if it is null
            var result = await ctl.Edit(1);
            var model = (ProfileIndexViewModel)((ViewResult)result).Model;
            model.teamProfile.name = "Anne";

            var result2 = ctl.Edit(model);
            Assert.IsNotNull(result);
        }
コード例 #7
0
        public void TeamProfilesController_Create_Test2()
        {
            // Initialization
            TeamProfilesController ctl = new TeamProfilesController();

            // To test if it is null
            var result = ctl.Create();
            Assert.IsNotNull(result);

            // To test if its contents
            var model = (ProfileIndexViewModel)((ViewResult)result).Model;
            Assert.AreEqual(0, model.teamProfile.profile_id);
            Assert.IsNull(model.teamProfile.name);
            Assert.IsNull(model.teamProfile.detail);
            Assert.AreEqual(0, model.teamProfile.status);
        }
コード例 #8
0
        public void TeamProfilesController_Create_Test1()
        {
            // Initialization
            TeamProfilesController ctl = new TeamProfilesController();

            // To test if it is null
            var result = ctl.Create();
            Assert.IsNotNull(result);

            // To test if its contents
            var model = (ProfileIndexViewModel)((ViewResult)result).Model;
            Assert.AreEqual("~/Images/no_image.jpg", model.teamProfile.pic);
        }