public void TestEditSelectedFiles() { var operationsFactoryMock = new Mock <IOperationsFactory>(); var directoryServiceMock = new Mock <IDirectoryService>(); var fileServiceMock = new Mock <IFileService>(); var fileOpeningServiceMock = new Mock <IFileOpeningService>(); fileOpeningServiceMock .Setup(m => m.Open(FileName)) .Verifiable(); var pathServiceMock = new Mock <IPathService>(); IOperationsService operationsService = new OperationsService( operationsFactoryMock.Object, directoryServiceMock.Object, fileOpeningServiceMock.Object, fileServiceMock.Object, pathServiceMock.Object); operationsService.EditFiles(new[] { FileName }); fileOpeningServiceMock.Verify(m => m.Open(FileName), Times.Once()); }