public void AddWarehouse_GivenANewWarehouse_AddsToDatabase() { // arrange Warehouse warehouse = new Warehouse() { ID = 212 }; Mock <IWarehouseRepository> mockRepo = new Mock <IWarehouseRepository>(); LocationService sut = new LocationService(null, mockRepo.Object, null, null); // act sut.AddWarehouse(warehouse); // assert mockRepo.Verify(r => r.AddWarehouse(It.Is <Warehouse>(a => a.Equals(warehouse))), Times.Once()); }