Exemplo n.º 1
0
        public void GetProductRepositoryTestIsCalled()
        {
            //Arrange
            MainWindow windowTest = new MainWindow();
            var MockNotificationSvc = new Mock<INotificationService>();
            var MockPaymentProcessor = new Mock<IPaymentProcessor>();
            var MockProductRepo = new Mock<IProductRepository>();
            OrderItemRepository orderRepo = new OrderItemRepository();
            Cart ActiveCart = new Cart(orderRepo);

            List<Product> catalogProducts = new List<Product>()
            {
                new Product(){Name = "cable", OnHand = 5},
                new Product(){Name = "charger", OnHand = 4},
                new Product() {Name = "battery", OnHand = 3}
            };

            MockProductRepo.Setup(x => x.GetProducts()).Returns(catalogProducts);

            //Act
            windowTest.ListProductsInCatalog(MockProductRepo.Object);

            Assert.AreEqual(true, windowTest.lstSelection.Items.Contains("cable"));
            MockProductRepo.Verify(x => x.GetProducts());
        }