예제 #1
0
        public void TestDirectoryCreation()
        {
            var operationsFactoryMock = new Mock <IOperationsFactory>();
            var directoryServiceMock  = new Mock <IDirectoryService>();
            var fullDirectoryPath     = Path.Combine(SelectedDirectoryName, DirectoryName);

            directoryServiceMock
            .Setup(m => m.CreateDirectory(fullDirectoryPath))
            .Verifiable();
            var fileOpeningServiceMock = new Mock <IFileOpeningService>();
            var fileServiceMock        = new Mock <IFileService>();
            var pathServiceMock        = new Mock <IPathService>();

            pathServiceMock
            .Setup(m => m.Combine(SelectedDirectoryName, DirectoryName))
            .Returns(fullDirectoryPath);

            IOperationsService operationsService = new OperationsService(
                operationsFactoryMock.Object,
                directoryServiceMock.Object,
                fileOpeningServiceMock.Object,
                fileServiceMock.Object,
                pathServiceMock.Object);

            operationsService.CreateDirectory(SelectedDirectoryName, DirectoryName);

            directoryServiceMock.Verify(m => m.CreateDirectory(fullDirectoryPath), Times.Once());
        }