public void Order_GetAll() { var orders = new[] { new Order {Id = 1, Notes = "Order 1"}, new Order {Id = 2, Notes = "Order 2"} }; Mock<IDataRepositoryFactory> mockDataRepositoryFactory = new Mock<IDataRepositoryFactory>(); mockDataRepositoryFactory.Setup(mock => mock.GetDataRepository<IOrderRepository>().Get()).Returns(orders); OrderManager manager = new OrderManager(mockDataRepositoryFactory.Object); var resultedOrder = manager.GetAllOrders(); Assert.AreEqual(orders.Length, resultedOrder.Length); }
public void Part_GetAll() { var parts = new[] { new Part {Id = 1, Notes = "Part 1"}, new Part {Id = 2, Notes = "Part 2"} }; Mock<IDataRepositoryFactory> mockDataRepositoryFactory = new Mock<IDataRepositoryFactory>(); mockDataRepositoryFactory.Setup(mock => mock.GetDataRepository<IPartRepository>().Get()).Returns(parts); PartManager manager = new PartManager(mockDataRepositoryFactory.Object); var resultedPart = manager.GetAllParts(); Assert.AreEqual(parts.Length, resultedPart.Length); }