public void TestGetListOfChildrenWithParent() { var customerManagerMock = new Mock <ICustomerManager>(); customerManagerMock.Setup(m => m.GetAllCustomers()) .Returns( new List <Customer> { new Customer { CustomerID = 1, Name = "Adam", Address = "Örebro", Borrows = new List <Borrow> { new Borrow { DateOfBorrow = new DateTime(2018, 10, 10), Book = new Book { } } } }, new Customer { CustomerID = 2, Parent = new Customer { CustomerID = 9 } }, new Customer { CustomerID = 3, Parent = new Customer { CustomerID = 10 } }, new Customer { CustomerID = 4, Parent = new Customer { CustomerID = 11 } }, new Customer { CustomerID = 5, Parent = new Customer { CustomerID = 12 } }, new Customer { CustomerID = 6, Parent = new Customer { CustomerID = 13 } }, new Customer { CustomerID = 7, Parent = new Customer { CustomerID = 14 } }, new Customer { CustomerID = 8, Parent = new Customer { CustomerID = 15 } } }); var customerAPI = new CustomerAPI(customerManagerMock.Object, null, null); var childrenList = customerAPI.GetListOfChildrenWithParentAdressForChildrenEvent(); Assert.AreEqual(3, childrenList.Count); }