public void HomeControllerReturnsCorrectUserViewModelDataWhenSeededWithTestData()
        {
            //Arrange
            var firstName = "James";
            var lastName = "James";
            var currency = "GBP";
            var email = "*****@*****.**";

            var controller = new HomeController(_mockQueryHandler.Object, _mockCommandHandler.Object);
            _mockQueryHandler.Setup(x => x.GetUserDetails()).Returns(new User
            {
                FirstName = firstName,
                LastName = lastName,
                Currency = currency,
                Email = email
            });

            // Act
            var result = controller.Index() as ViewResult;
            var expectedModel = result.Model as CompositionModel;

            // Assert
            Assert.True(expectedModel.UserViewModel.FirstName == firstName &&
                        expectedModel.UserViewModel.LastName == lastName &&
                        expectedModel.UserViewModel.Currency == currency &&
                        expectedModel.UserViewModel.Email == email);
        }
        public void HomeControllerReturnsNonNullViewResultWhenIndexMethodIsCalled()
        {
            //Arrange
            var controller = new HomeController(_mockQueryHandler.Object, _mockCommandHandler.Object);

            // Act
            var result = controller.Index() as ViewResult;

            // Assert
            Assert.NotNull(result);
        }
        public void HomeControllerReturnsCorrectViewModelWhenIndexIsCalled()
        {
            //Arrange
            var controller = new HomeController(_mockQueryHandler.Object, _mockCommandHandler.Object);

            // Act
            var result = controller.Index() as ViewResult;
            var expectedModel = result.Model as CompositionModel;

            // Assert
            Assert.NotNull(expectedModel);
        }
        public void HomeControllerReturnsCorrectBasketViewModelDataWhenSeededWithTestData()
        {
            //Arrange
            var productName = "test product";
            var productDescription = "test description";
            var cost = 5.44m;
            var category = "test category";
            var imageUrl = "http://test.image.com/image.jpg";

            var controller = new HomeController(_mockQueryHandler.Object, _mockCommandHandler.Object);
            _mockQueryHandler.Setup(x => x.GetUserBasket()).Returns(new List<BasketItem>
            {
                new BasketItem
                {
                    ProductName = productName,
                    Description = productDescription,
                    Category = category,
                    Cost = cost,
                    Image = imageUrl
                }
            });

            // Act
            var result = controller.Index() as ViewResult;
            var expectedModel = result.Model as CompositionModel;
            var basket = expectedModel.BasketViewModel.FirstOrDefault();

            // Assert
            Assert.NotNull(basket);
            Assert.True(basket.ProductName == productName &&
                        basket.Description == productDescription &&
                        basket.Category == category &&
                        basket.Cost == cost &&
                        basket.Image == imageUrl);
        }