public async Task CreateResponse_CallsAppropriateServiceMethods() { // Arrange var enrollments = fixture.CreateMany <Enrollment>(3); var ouputDirectory = fixture.Create <string>(); var outputEnrollments = fixture.Create <string>(); var ouputFilePath = fixture.Create <string>(); _fileServiceMock.Setup(s => s.GetOuputFilePath(It.IsAny <string>(), It.IsAny <string>())).Returns(ouputFilePath); _enrollmentServiceMock.Setup(s => s.SortEnrollmentsForCompany(It.IsAny <IEnumerable <Enrollment> >(), It.IsAny <string>())); _jsonServiceMock.Setup(s => s.SerializeEnrollmentsToJson(It.IsAny <List <Enrollment> >())).Returns(outputEnrollments); // Act await _sut.CreateResponse(enrollments, ouputDirectory, new CancellationToken()); // Assert _fileServiceMock.Verify(s => s.GetOuputFilePath(It.Is <string>(x => x == ouputDirectory), It.IsAny <string>()), Times.Exactly(3)); _enrollmentServiceMock.Verify(s => s.SortEnrollmentsForCompany(It.IsAny <IEnumerable <Enrollment> >(), It.IsAny <string>()), Times.Exactly(3)); _jsonServiceMock.Verify(s => s.SerializeEnrollmentsToJson(It.IsAny <List <Enrollment> >()), Times.Exactly(3)); _fileServiceMock.Verify(s => s.WriteOutputFile(It.Is <string>(x => x == outputEnrollments), It.Is <string>(x => x == ouputFilePath), It.IsAny <CancellationToken>()), Times.Exactly(3)); }