public void TestDirectoryRenaming() { var operationsFactoryMock = new Mock <IOperationsFactory>(); var directoryServiceMock = new Mock <IDirectoryService>(); directoryServiceMock .Setup(m => m.Rename(DirectoryName, NewDirectoryName)) .Verifiable(); directoryServiceMock .Setup(m => m.CheckIfExists(DirectoryName)) .Returns(true); var fileOpeningServiceMock = new Mock <IResourceOpeningService>(); var fileServiceMock = new Mock <IFileService>(); var fileOperationsStateServiceMock = new Mock <IOperationsStateService>(); var pathServiceMock = new Mock <IPathService>(); IOperationsService operationsService = new OperationsService( operationsFactoryMock.Object, directoryServiceMock.Object, fileOpeningServiceMock.Object, fileServiceMock.Object, pathServiceMock.Object, fileOperationsStateServiceMock.Object); operationsService.Rename(DirectoryName, NewDirectoryName); directoryServiceMock.Verify(m => m.Rename(DirectoryName, NewDirectoryName), Times.Once()); }