Ejemplo n.º 1
0
        public async Task UserWishList_NotFoundResult()
        {
            // Arrange
            GetUserAsyncReturns = new User { Id = 1, UserName = "******" };

            // Act
            var result = await ControllerSUT.Shared("fred");

            // Assert
            var viewResult = Assert.IsAssignableFrom<NotFoundResult>(result);
        }
Ejemplo n.º 2
0
        public async Task UserWishList_ReturnsViewResult()
        {
            // Arrange
            GetUserAsyncReturns = new User { Id = 1, UserName = "******" };

            // Act
            var result = await ControllerSUT.Shared("bob");

            // Assert
            var viewResult = Assert.IsAssignableFrom<RedirectToActionResult>(result);
            Assert.Equal(nameof(WishlistController.Index), viewResult.ActionName);
        }
Ejemplo n.º 3
0
        public async Task UserWishList_ReturnsViewResult_WhenSuccessful()
        {
            // Arrange
            GetUserAsyncReturns = new User { Id = 1, UserName = "******" };
            FindByNameAsyncReturns = new User { Id = 2, UserName = "******", WishlistVisibility = WishlistVisibility.Everyone };

            // Act
            var result = await ControllerSUT.Shared("fred");

            // Assert
            var viewResult = Assert.IsAssignableFrom<ViewResult>(result);
            var wishlistItem = Assert.IsAssignableFrom<WishlistViewModel>(viewResult.ViewData.Model);
        }
Ejemplo n.º 4
0
        public async Task UserWishList_RedirectToActionResult_WhenFriendshipIsPending()
        {
            // Arrange
            GetUserAsyncReturns = new User { Id = 1, UserName = "******" };
            FindByNameAsyncReturns = new User { Id = 2, UserName = "******", WishlistVisibility = WishlistVisibility.FriendsOnly };

            // Act
            var result = await ControllerSUT.Shared("fred");

            // Assert
            var viewResult = Assert.IsAssignableFrom<RedirectToActionResult>(result);
            Assert.Equal(nameof(FriendsController.Index), viewResult.ActionName);
            Assert.Equal("Friends", viewResult.ControllerName);
        }