public void test_factory_mocking_stock2()
        {
            List <Stock> stocks = new List <Stock>()
            {
                new Stock()
                {
                    Id = 1, Notes = "Stock One"
                },
                new Stock()
                {
                    Id = 2, Notes = "Stock Two"
                }
            };

            Mock <IStockRepository> mockStockRepository = new Mock <IStockRepository>();

            mockStockRepository.Setup(obj => obj.Get()).Returns(stocks);

            Mock <IDataRepositoryFactory> mockDataRepository = new Mock <IDataRepositoryFactory>();

            mockDataRepository.Setup(obj => obj.GetDataRepository <IStockRepository>()).Returns(mockStockRepository.Object);

            RepositoryFactoryTestClass factoryTest = new RepositoryFactoryTestClass(mockDataRepository.Object);

            IEnumerable <Stock> ret = factoryTest.GetAllStock();

            Assert.AreEqual(ret, stocks);
        }
        public void test_factory_mocking_part2()
        {
            List <Part> parts = new List <Part>()
            {
                new Part()
                {
                    Id = 1, Notes = "Part One"
                },
                new Part()
                {
                    Id = 2, Notes = "Part Two"
                }
            };

            Mock <IPartRepository> mockPartRepository = new Mock <IPartRepository>();

            mockPartRepository.Setup(obj => obj.Get()).Returns(parts);

            Mock <IDataRepositoryFactory> mockDataRepository = new Mock <IDataRepositoryFactory>();

            mockDataRepository.Setup(obj => obj.GetDataRepository <IPartRepository>()).Returns(mockPartRepository.Object);

            RepositoryFactoryTestClass factoryTest = new RepositoryFactoryTestClass(mockDataRepository.Object);

            IEnumerable <Part> ret = factoryTest.GetAllParts();

            Assert.AreEqual(ret, parts);
        }
        public void test_factory_mocking2()
        {
            List <Supplier> suppliers = new List <Supplier>()
            {
                new Supplier()
                {
                    Id = 1, Name = "Supplier One"
                },
                new Supplier()
                {
                    Id = 2, Name = "Supplier Two"
                }
            };

            Mock <ISupplierRepository> mockSupplierRepository = new Mock <ISupplierRepository>();

            mockSupplierRepository.Setup(obj => obj.Get()).Returns(suppliers);

            Mock <IDataRepositoryFactory> mockDataRepository = new Mock <IDataRepositoryFactory>();

            mockDataRepository.Setup(obj => obj.GetDataRepository <ISupplierRepository>()).Returns(mockSupplierRepository.Object);

            RepositoryFactoryTestClass factoryTest = new RepositoryFactoryTestClass(mockDataRepository.Object);

            IEnumerable <Supplier> ret = factoryTest.GetSuppliers();

            Assert.AreEqual(ret, suppliers);
        }
        public void test_factory_mocking_order2()
        {
            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);

            Mock <IDataRepositoryFactory> mockDataRepository = new Mock <IDataRepositoryFactory>();

            mockDataRepository.Setup(obj => obj.GetDataRepository <IOrderRepository>()).Returns(mockOrderRepository.Object);

            RepositoryFactoryTestClass factoryTest = new RepositoryFactoryTestClass(mockDataRepository.Object);

            IEnumerable <Order> ret = factoryTest.GetAllOrders();

            Assert.AreEqual(ret, orders);
        }
        public void test_order_repository_factory_usage()
        {
            RepositoryFactoryTestClass factoryTest = new RepositoryFactoryTestClass();

            var orders = factoryTest.GetAllOrders();

            Assert.IsTrue(orders != null);
        }
        public void test_part_repository_factory_usage()
        {
            RepositoryFactoryTestClass factoryTest = new RepositoryFactoryTestClass();

            var parts = factoryTest.GetAllParts();

            Assert.IsTrue(parts != null);
        }
        public void test_stock_repository_factory_usage()
        {
            RepositoryFactoryTestClass factoryTest = new RepositoryFactoryTestClass();

            IEnumerable<Stock> stocks = factoryTest.GetAllStock();

            Assert.IsTrue(stocks != null);
        }
        public void test_stock_repository_factory_usage()
        {
            RepositoryFactoryTestClass factoryTest = new RepositoryFactoryTestClass();

            IEnumerable <Stock> stocks = factoryTest.GetAllStock();

            Assert.IsTrue(stocks != null);
        }
        public void test_repository_factory_usage()
        {
            RepositoryFactoryTestClass factoryTest = new RepositoryFactoryTestClass();

            IEnumerable <Supplier> suppliers = factoryTest.GetSuppliers();

            Assert.IsTrue(suppliers != null);
        }
        public void test_order_repository_factory_usage()
        {
            RepositoryFactoryTestClass factoryTest = new RepositoryFactoryTestClass();

            var orders = factoryTest.GetAllOrders();

            Assert.IsTrue(orders != null);
        }
        public void test_repository_factory_usage()
        {
            RepositoryFactoryTestClass factoryTest = new RepositoryFactoryTestClass();

            IEnumerable<Supplier> suppliers = factoryTest.GetSuppliers();

            Assert.IsTrue(suppliers != null);
        }
        public void test_part_repository_factory_usage()
        {
            RepositoryFactoryTestClass factoryTest = new RepositoryFactoryTestClass();

            var parts = factoryTest.GetAllParts();

            Assert.IsTrue(parts != null);
        }
        public void test_factory_mocking_order1()
        {
            List<Order> orders = new List<Order>()
            {
                new Order() { Id = 1, Notes = "Order One" },
                new Order() { Id = 2, Notes = "Order Two" }
            };

            Mock<IDataRepositoryFactory> mockDataRepository = new Mock<IDataRepositoryFactory>();
            mockDataRepository.Setup(obj => obj.GetDataRepository<IOrderRepository>().Get()).Returns(orders);

            RepositoryFactoryTestClass factoryTest = new RepositoryFactoryTestClass(mockDataRepository.Object);

            IEnumerable<Order> ret = factoryTest.GetAllOrders();

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

            Mock<IDataRepositoryFactory> mockDataRepository = new Mock<IDataRepositoryFactory>();
            mockDataRepository.Setup(obj => obj.GetDataRepository<IStockRepository>().Get()).Returns(stocks);

            RepositoryFactoryTestClass factoryTest = new RepositoryFactoryTestClass(mockDataRepository.Object);

            IEnumerable<Stock> ret = factoryTest.GetAllStock();

            Assert.AreEqual(ret, stocks);
        }
        public void test_factory_mocking1()
        {
            List<Supplier> suppliers = new List<Supplier>()
            {
                new Supplier() { Id = 1, Name = "Supplier One" },
                new Supplier() { Id = 2, Name = "Supplier Two" }
            };

            Mock<IDataRepositoryFactory> mockDataRepository = new Mock<IDataRepositoryFactory>();
            mockDataRepository.Setup(obj => obj.GetDataRepository<ISupplierRepository>().Get()).Returns(suppliers);

            RepositoryFactoryTestClass factoryTest = new RepositoryFactoryTestClass(mockDataRepository.Object);

            IEnumerable<Supplier> ret = factoryTest.GetSuppliers();

            Assert.AreEqual(ret, suppliers);
        }
        public void test_factory_mocking_part1()
        {
            List<Part> parts = new List<Part>()
            {
                new Part() { Id = 1, Notes = "Part One" },
                new Part() { Id = 2, Notes = "Part Two" }
            };

            Mock<IDataRepositoryFactory> mockDataRepository = new Mock<IDataRepositoryFactory>();
            mockDataRepository.Setup(obj => obj.GetDataRepository<IPartRepository>().Get()).Returns(parts);

            RepositoryFactoryTestClass factoryTest = new RepositoryFactoryTestClass(mockDataRepository.Object);

            IEnumerable<Part> ret = factoryTest.GetAllParts();

            Assert.AreEqual(ret, parts);
        }