public void Returns404_WhenSlug_IsWhiteSpaceString() { var controller = new RolesController(CreateRolesServices()); var result = controller.Form(" \t "); result.ShouldNotBeNull(); result.ShouldBeType <HttpNotFoundResult>(); }
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>(); }
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()); }
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); }
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); }
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()); }
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>(); }
public void Returns404_WhenSlug_IsWhiteSpaceString() { var controller = new RolesController(CreateRolesServices()); var result = controller.Form(" \t "); result.ShouldNotBeNull(); result.ShouldBeType<HttpNotFoundResult>(); }