public void Create_ValidCreateCommandsList_CustomerServiceRepository_Should_be_Called() { // Arrange List<CustomerCreateCommand> customerCreateCommandList = new List<CustomerCreateCommand>() { new CustomerCreateCommand() { FirstName = "Mohamed", LastName = "Ahmed" }, new CustomerCreateCommand() { FirstName = "Adel", LastName = "Mostafa" }, new CustomerCreateCommand() { FirstName = "Ahmed", LastName = "Kamal" } }; var mockRepository = new Mock<ICustomerRepository>(); mockRepository.Setup(x => x.Save(It.IsAny<Customer>())); MockingSamples.CustomerService_2 customerService = new MockingSamples.CustomerService_2(mockRepository.Object); // Act customerService.Create(customerCreateCommandList); // Assert mockRepository.Verify(x => x.Save(It.IsAny<Customer>()), Times.Exactly(customerCreateCommandList.Count)); }