public void WhenExecuteCommandWithValidFile_CommandManager_ShouldZipDirectory() { var path = "myPath"; var storedDataService = new StoredDataServiceMock(false); var fileServiceMock = new FileServiceMock() { IsDirectoryReturn = false }; var commandDefinition = new ZipCommand(fileServiceMock); var instance = new CommandManager(_loggerServiceMock, storedDataService, _cryptoServiceMock); instance.RegisterCommand(commandDefinition); var inputRequest = new InputRequest( commandDefinition.GetInvocationCommandName(), commandDefinition.CommandPathParameter.GetInvokeName(), path); instance.ExecuteInputRequest(inputRequest); var expected = path; var actual = fileServiceMock.ZippedPath; Assert.Equal(expected, actual); }
public void WhenExecuteCommandWithoutPathParameter_CommandManager_ShouldThrowException() { var storedDataService = new StoredDataServiceMock(false); var fileServiceMock = new FileServiceMock(); var commandDefinition = new ZipCommand(fileServiceMock); var instance = new CommandManager(_loggerServiceMock, storedDataService, _cryptoServiceMock); instance.RegisterCommand(commandDefinition); var inputRequest = new InputRequest( commandDefinition.GetInvocationCommandName()); Assert.Throws <InvalidParamsException>(() => { instance.ExecuteInputRequest(inputRequest); }); }