Ejemplo n.º 1
0
        public async Task Index_ReturnsViewResult()
        {
            // Arrange

            // Act
            var result = await ControllerSUT.Index();

            // Assert
            var viewResult = Assert.IsAssignableFrom <ViewResult>(result);
        }
Ejemplo n.º 2
0
        public async Task Index_ReturnsViewResult()
        {
            // Arrange
            GetUserAsyncReturns = new User { Id = 1 };

            // Act
            var result = await ControllerSUT.Index();

            // Assert
            var viewResult = Assert.IsAssignableFrom<ViewResult>(result);
            var wishlistItem = Assert.IsAssignableFrom<WishlistViewModel>(viewResult.ViewData.Model);
        }
Ejemplo n.º 3
0
        public async Task Index_ReturnsViewResult()
        {
            // Arrange

            // Act
            var result = await ControllerSUT.Index();

            // Assert
            var viewResult    = Assert.IsAssignableFrom <ViewResult>(result);
            var homeViewModel = Assert.IsAssignableFrom <HomeViewModel>(viewResult.Model);

            Assert.NotEmpty(homeViewModel.BannerGames);
        }
Ejemplo n.º 4
0
        public async Task Index_ReturnsViewResult()
        {
            // Arrange
            GetUserAsyncReturns = user1;

            // Act
            var result = await ControllerSUT.Index(game1.GameId);

            // Assert
            var viewResult = Assert.IsAssignableFrom <ViewResult>(result);
            var game       = Assert.IsAssignableFrom <Game>(viewResult.ViewData.Model);

            Assert.NotEmpty(game.Reviews);
        }
Ejemplo n.º 5
0
        public async Task Index_ReturnsViewResult()
        {
            // Arrange

            // Act
            var result = await ControllerSUT.Index(null, null, null);

            // Assert
            var viewResult = Assert.IsAssignableFrom <ViewResult>(result);
            var model      = Assert.IsAssignableFrom <GameIndexViewModel>(viewResult.ViewData.Model);

            Assert.NotEmpty(model.FilterGroups);
            Assert.NotEmpty(model.Games);
        }
Ejemplo n.º 6
0
        public async Task Index_ReturnsViewResult()
        {
            // Arrange
            GetUserAsyncReturns = identityUser;

            // Act
            var result = await ControllerSUT.Index();

            // Assert
            var viewResult = Assert.IsAssignableFrom <ViewResult>(result);
            var cart       = Assert.IsAssignableFrom <CartViewModel>(viewResult.ViewData.Model);

            Assert.IsAssignableFrom <IEnumerable <CartItemViewModel> >(cart.Items);
            Assert.Equal(identityUser, cart.User);
        }
Ejemplo n.º 7
0
        public async Task Index_ReturnsViewResult()
        {
            // Arrange
            GetUserAsyncReturns = new User {
                Id = 166
            };

            // Act
            var result = await ControllerSUT.Index();

            // Assert
            var viewResult = Assert.IsAssignableFrom <ViewResult>(result);
            var friends    = Assert.IsAssignableFrom <FriendsViewModel>(viewResult.ViewData.Model);

            Assert.IsAssignableFrom <IEnumerable <UserRelationship> >(friends.FriendRelationships);
            Assert.IsAssignableFrom <IEnumerable <UserRelationship> >(friends.PendingRelationships);
        }
        public async Task Index_ReturnsViewResult()
        {
            // Arrange
            GetUserAsyncReturns = user1;

            Profile testProfile = new Profile
            {
                ProfileId = 1,
                UserId    = user1.Id
            };

            _context.Add(testProfile);

            UserRelationship testRelationship = new UserRelationship
            {
                UserRelationshipId = 1,
                RelatingUser       = user1,
                RelatedUser        = user2,
                RelatingProfile    = user1.Profile,
                RelatedProfile     = user2.Profile,
                Type = Relationship.Friend,
            };

            _context.Add(testRelationship);

            _context.FriendMessages.Add(new FriendMessage
            {
                FriendMessageId    = 1,
                SendingUserId      = user1.Id,
                ReceivingUserId    = 99,
                MessageContent     = "hey",
                MessageDateTime    = DateTime.Now.ToString(),
                UserRelationship   = testRelationship,
                UserRelationshipId = testRelationship.UserRelationshipId
            });

            await _context.SaveChangesAsync();

            // Act
            var result = await ControllerSUT.Index(testRelationship.UserRelationshipId);

            // Assert
            Assert.IsAssignableFrom <ViewResult>(result);
        }
        public async Task Index_ReturnsNotFound_WhenUserRelationshipIsNotFound()
        {
            // Arrange
            User user = _context.Users.FirstOrDefault();

            GetUserAsyncReturns = user;

            UserRelationship testRelationship = new UserRelationship
            {
                UserRelationshipId = 1,
                RelatingUser       = profile1.User,
                RelatedUser        = profile2.User,
                RelatingProfile    = user1.Profile,
                RelatedProfile     = user2.Profile,
                Type = Relationship.Friend
            };

            // Act
            var result = await ControllerSUT.Index(testRelationship.UserRelationshipId);

            // Assert
            Assert.IsAssignableFrom <NotFoundResult>(result);
        }