public void GetFullFileName_GivenInValid_ShouldReturnFullFilename() { //---------------Set up test pack------------------- var localPathManager = new LocalPathManager(InValidFileName); //---------------Assert Precondition---------------- Assert.IsNotNull(localPathManager); //---------------Execute Test ---------------------- var fileName = localPathManager.GetFullFileName(); //---------------Test Result ----------------------- Assert.IsFalse(string.IsNullOrEmpty(fileName)); Assert.AreEqual(InValidFileName, fileName); }
//All units used here has been unit tested seperately protected override List <string> PerformExecution(Dictionary <string, string> evaluatedValues) { string localToPath; evaluatedValues.TryGetValue("ToPath", out localToPath); string localFromPath; evaluatedValues.TryGetValue("FromPath", out localFromPath); IDropboxSingleExecutor <IDropboxResult> dropBoxDownLoad = new DropBoxDownLoad(localToPath); var dropboxSingleExecutor = GetDropboxSingleExecutor(dropBoxDownLoad); _dropboxClientWrapper = _dropboxClientWrapper ?? new DropboxClientWrapper(GetClient()); var dropboxExecutionResult = dropboxSingleExecutor.ExecuteTask(_dropboxClientWrapper); var dropboxSuccessResult = dropboxExecutionResult as DropboxDownloadSuccessResult; if (dropboxSuccessResult != null) { Response = dropboxSuccessResult.GetDownloadResponse(); var bytes = Response.GetContentAsByteArrayAsync().Result; if (Response.Response.IsFile) { LocalPathManager = new LocalPathManager(localFromPath); var validFolder = LocalPathManager.GetFullFileName(); var fileExist = LocalPathManager.FileExist(); if (fileExist && !OverwriteFile) { throw new Exception(ErrorResource.DropBoxDestinationFileAlreadyExist); } DropboxFile.WriteAllBytes(validFolder, bytes); } return(new List <string> { GlobalConstants.DropBoxSuccess }); } var dropboxFailureResult = dropboxExecutionResult as DropboxFailureResult; if (dropboxFailureResult != null) { Exception = dropboxFailureResult.GetException(); } var executionError = Exception.InnerException?.Message ?? Exception.Message; if (executionError.Contains("not_file")) { executionError = ErrorResource.DropBoxFilePathMissing; } throw new Exception(executionError); }