Form() private method

private Form ( string slug ) : System.Web.Mvc.ActionResult
slug string
return System.Web.Mvc.ActionResult
コード例 #1
0
            public void Returns404_WhenSlug_IsWhiteSpaceString()
            {
                var controller = new RolesController(CreateRolesServices());

                var result = controller.Form(" \t ");

                result.ShouldNotBeNull();
                result.ShouldBeType <HttpNotFoundResult>();
            }
コード例 #2
0
            public void Returns404_WhenSlug_DoesNotMatchRole()
            {
                const string slug           = "role-1";
                var          queryProcessor = new Mock <IProcessQueries>(MockBehavior.Strict);

                queryProcessor.Setup(m => m.Execute(It.IsAny <GetRoleBySlugQuery>())).Returns(null as Role);
                var controller = new RolesController(CreateRolesServices(queryProcessor.Object));

                var result = controller.Form(slug);

                result.ShouldNotBeNull();
                result.ShouldBeType <HttpNotFoundResult>();
            }
コード例 #3
0
            public void Invokes_Roles_GetBySlug()
            {
                const string slug           = "role-1";
                const string name           = "Role 1";
                var          queryProcessor = new Mock <IProcessQueries>(MockBehavior.Strict);

                queryProcessor.Setup(m => m.Execute(It.IsAny <GetRoleBySlugQuery>())).
                Returns(new Role {
                    Name = name
                });
                var controller = new RolesController(CreateRolesServices(queryProcessor.Object));

                var result = controller.Form(slug);

                result.ShouldNotBeNull();
                queryProcessor.Verify(r => r.Execute(It.IsAny <GetRoleBySlugQuery>()), Times.Once());
            }
コード例 #4
0
            public void Returns_RoleForm()
            {
                const string slug           = "role-1";
                const string name           = "Role 1";
                var          queryProcessor = new Mock <IProcessQueries>(MockBehavior.Strict);

                queryProcessor.Setup(m => m.Execute(It.IsAny <GetRoleBySlugQuery>()))
                .Returns(new Role {
                    Name = name
                });
                var controller = new RolesController(CreateRolesServices(queryProcessor.Object));

                var result = controller.Form(slug);

                result.ShouldNotBeNull();
                result.ShouldBeType <ViewResult>();
                var viewResult = (ViewResult)result;

                viewResult.Model.ShouldNotBeNull();
                viewResult.Model.ShouldImplement <RoleForm>();
                var strongModel = (RoleForm)viewResult.Model;

                strongModel.Name.ShouldEqual(name);
            }
コード例 #5
0
            public void Returns_RoleForm()
            {
                const string slug = "role-1";
                const string name = "Role 1";
                var queryProcessor = new Mock<IProcessQueries>(MockBehavior.Strict);
                queryProcessor.Setup(m => m.Execute(It.IsAny<GetRoleBySlugQuery>()))
                    .Returns(new Role { Name = name });
                var controller = new RolesController(CreateRolesServices(queryProcessor.Object));

                var result = controller.Form(slug);

                result.ShouldNotBeNull();
                result.ShouldBeType<ViewResult>();
                var viewResult = (ViewResult)result;
                viewResult.Model.ShouldNotBeNull();
                viewResult.Model.ShouldImplement<RoleForm>();
                var strongModel = (RoleForm)viewResult.Model;
                strongModel.Name.ShouldEqual(name);
            }
コード例 #6
0
            public void Invokes_Roles_GetBySlug()
            {
                const string slug = "role-1";
                const string name = "Role 1";
                var queryProcessor = new Mock<IProcessQueries>(MockBehavior.Strict);
                queryProcessor.Setup(m => m.Execute(It.IsAny<GetRoleBySlugQuery>())).
                    Returns(new Role { Name = name });
                var controller = new RolesController(CreateRolesServices(queryProcessor.Object));

                var result = controller.Form(slug);

                result.ShouldNotBeNull();
                queryProcessor.Verify(r => r.Execute(It.IsAny<GetRoleBySlugQuery>()), Times.Once());
            }
コード例 #7
0
            public void Returns404_WhenSlug_DoesNotMatchRole()
            {
                const string slug = "role-1";
                var queryProcessor = new Mock<IProcessQueries>(MockBehavior.Strict);
                queryProcessor.Setup(m => m.Execute(It.IsAny<GetRoleBySlugQuery>())).Returns(null as Role);
                var controller = new RolesController(CreateRolesServices(queryProcessor.Object));

                var result = controller.Form(slug);

                result.ShouldNotBeNull();
                result.ShouldBeType<HttpNotFoundResult>();
            }
コード例 #8
0
            public void Returns404_WhenSlug_IsWhiteSpaceString()
            {
                var controller = new RolesController(CreateRolesServices());

                var result = controller.Form(" \t ");

                result.ShouldNotBeNull();
                result.ShouldBeType<HttpNotFoundResult>();
            }