Esempio n. 1
0
        public void test_order_repository_usage()
        {
            OrderRepositoryTestClass repositoryTest = new OrderRepositoryTestClass();

            IEnumerable<Order> orderItems = repositoryTest.GetAllOrder();

            Assert.IsNotNull(orderItems);
        }
        public void test_order_repository_usage()
        {
            OrderRepositoryTestClass repositoryTest = new OrderRepositoryTestClass();

            IEnumerable <Order> orderItems = repositoryTest.GetAllOrder();

            Assert.IsNotNull(orderItems);
        }
Esempio n. 3
0
        public void test_order_repository_mocking()
        {
            List<Order> orders = new List<Order>()
            {
                new Order() { Id = 1, Notes = "Order One" },
                new Order() { Id = 2, Notes = "Order Two" }
            };

            Mock<IOrderRepository> mockOrderRepository = new Mock<IOrderRepository>();
            mockOrderRepository.Setup(obj => obj.Get()).Returns(orders);

            OrderRepositoryTestClass repositoryTest = new OrderRepositoryTestClass(mockOrderRepository.Object);

            IEnumerable<Order> ret = repositoryTest.GetAllOrder();

            Assert.AreEqual(ret, orders);
        }
        public void test_order_repository_mocking()
        {
            List <Order> orders = new List <Order>()
            {
                new Order()
                {
                    Id = 1, Notes = "Order One"
                },
                new Order()
                {
                    Id = 2, Notes = "Order Two"
                }
            };

            Mock <IOrderRepository> mockOrderRepository = new Mock <IOrderRepository>();

            mockOrderRepository.Setup(obj => obj.Get()).Returns(orders);

            OrderRepositoryTestClass repositoryTest = new OrderRepositoryTestClass(mockOrderRepository.Object);

            IEnumerable <Order> ret = repositoryTest.GetAllOrder();

            Assert.AreEqual(ret, orders);
        }