public void GetItemsByOrder_GivenAValidOrderID_ReturnsTheListOfItemsForThatOrder() { // arrange List <OrderItem> data = new List <OrderItem>(); data.Add(new OrderItem() { ID = 30, OrderID = 10 }); data.Add(new OrderItem() { ID = 31, OrderID = 11 }); data.Add(new OrderItem() { ID = 32, OrderID = 11 }); data.Add(new OrderItem() { ID = 33, OrderID = 11 }); data.Add(new OrderItem() { ID = 34, OrderID = 12 }); data.Add(new OrderItem() { ID = 35, OrderID = 12 }); List <OrderItem> expected = new List <OrderItem>(); expected.Add(data[1]); expected.Add(data[2]); expected.Add(data[3]); Mock <DbSet <OrderItem> > mockSet = EntityMockFactory.CreateSet(data.AsQueryable()); Mock <OrderDb> mockContext = new Mock <OrderDb>(); mockContext.Setup(c => c.OrderItems).Returns(mockSet.Object); OrderItemRepository sut = new OrderItemRepository(mockContext.Object); // act var actual = sut.GetItemsByOrder(11); // assert Assert.IsTrue(Equality.AreEqual(expected, actual)); }