コード例 #1
0
        public async Task SuccessStoryController_Index_Test04()
        {
            // Initialization
            SuccessStoryController ctl = new SuccessStoryController();

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

            // To test the number of the elements in the list
            var modelList = (List<StoryIndexViewModel>)((ViewResult)result).Model;
            Assert.AreEqual(1, modelList.Count());
        }
コード例 #2
0
        public async Task SuccessStoryController_List_Test()
        {
            // Initialization
            SuccessStoryController ctl = new SuccessStoryController();

            // To test if it is null
            var result = await ctl.List(null);
            Assert.IsNotNull(result);
        }
コード例 #3
0
        public void SuccessStoryController_DeleteConfirmed_Test()
        {
            // Initialization
            SuccessStoryController ctl = new SuccessStoryController();

            // To test if it is null
            var result = ctl.DeleteConfirmed(131);
            Assert.IsNotNull(result);
        }
コード例 #4
0
        public void SuccessStoryController_Edit_Test11()
        {
            // Initialization
            SuccessStoryController ctl = new SuccessStoryController();
            StoryIndexViewModel editView = new StoryIndexViewModel();

            // To test if it is null
            var result = ctl.Edit(editView);
            Assert.IsNotNull(result);
        }
コード例 #5
0
        public async Task SuccessStoryController_Edit_Test10()
        {
            // Initialization
            SuccessStoryController ctl = new SuccessStoryController();

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

            // To test if it is a HttpNotFoundResult when the id is invalid
            Assert.IsInstanceOfType(result, typeof(HttpNotFoundResult));
        }
コード例 #6
0
        public async Task SuccessStoryController_Edit_Test03()
        {
            // Initialization
            SuccessStoryController ctl = new SuccessStoryController();

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

            // To test if it is a valid id
            // var model = (StoryIndexViewModel)((ViewResult)result).Model;
            // Assert.IsNotNull(model);
        }
コード例 #7
0
        public void SuccessStoryController_Create_Test01()
        {
            // Initialization
            SuccessStoryController ctl = new SuccessStoryController();

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

            // To test if its contents
            var model = (StoryIndexViewModel)((ViewResult)result).Model;
            Assert.AreEqual("~/Images/no_image.jpg", model.successStory.pic);
        }
コード例 #8
0
        public async Task SuccessStoryController_Detail_Test07()
        {
            // Initialization
            SuccessStoryController ctl = new SuccessStoryController();

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

            // To test if it is a valid id
            var model = (StoryIndexViewModel)((ViewResult)result).Model;
            Assert.IsNotNull(model);
        }