Exemple #1
0
        public void OnGet_IfValidModel_ReturnPage()
        {
            var pageModel = new AboutModel();
            var result    = pageModel.OnGet();

            Assert.IsType <PageResult>(result);
        }
Exemple #2
0
        void OnGet()
        {
            var model = new AboutModel();

            model.OnGet();
            Assert.Equal("Your application description page.", model.Message);
        }
        public void AboutModel_OnGet_HasCorrectMessage()
        {
            // act
            _model.OnGet();

            // assert
            Assert.Equal("Your application description page", _model.Message);
        }
Exemple #4
0
        public void OnGet_IfInvalidModel_ReturnBadRequest()
        {
            var pageModel = new AboutModel();

            pageModel.ModelState.AddModelError("Error", "Bad request: GET method failed in About.cshtml.cs.");
            var result = pageModel.OnGet();

            Assert.IsType <BadRequestResult>(result);
        }
        public void AboutMessageTest()
        {
            string     expectedMessage = "Your application description page.";
            AboutModel about           = new AboutModel();

            about.OnGet();
            string aboutMessage = about.Message;

            Assert.Equal(expectedMessage, aboutMessage);
        }