public void RedirectToIndexAction_WhenPassedTeamsNamesAreNull() { // arrange var userService = new Mock <IUserService>(); var subscriptionsController = new SubscriptionsController(userService.Object); // act subscriptionsController.SubscribeForTeamResults(null); // assert subscriptionsController.WithCallTo(c => c.SubscribeForTeamResults(null)) .ShouldRedirectTo(c => c.Index()); }
public void ReturnJsonArrayResult_WhenInvoked() { // arrange var contextMock = new Mock <ControllerContext>(); contextMock.SetupGet(p => p.HttpContext.User.Identity.Name).Returns("username"); contextMock.SetupGet(p => p.HttpContext.Request.IsAuthenticated).Returns(true); var userService = new Mock <IUserService>(); var subscriptionsController = new SubscriptionsController(userService.Object); // act subscriptionsController.RemoveSubscription(null); // assert subscriptionsController.WithCallTo(c => c.RemoveSubscription(null)) .ShouldReturnJson(); }