public void DownloadDocumentFromTheCloud_GivenInvalidFileName_ShouldReturnInvalidFileName(string fileName) { //Arrange var sut = GreateAsposeApi(); const string expected = "Invalid file name"; //Act var actual = sut.DownloadDocumentFromTheCloud(fileName, FileRouteFinder.GetDirectoryToStoreTheDocumentFromTheCloud()); Assert.AreEqual(expected, actual.ErrorMessage); }
public void UploadToAsposeCloud_GivenPDFPath_ShouldUploadItToAsposeCloud() { //Arrange var sut = GreateAsposeApi(); var filePath = FileRouteFinder.GetDirectoryOfTheMainDocument(); //Act var actual = sut.UploadToAsposeCloud(filePath); //Assert Assert.AreEqual(200, actual.UploadResults.Code); }
public void DownloadDocumentFromTheCloud_GivenFileNameNotExistingInCloud_ShouldReturnFileDoesNotExist() { //Arrange var sut = GreateAsposeApi(); const string fileName = "File.pdf"; const string expected = "File you looking for does not exist, check filename and try again"; //Act var actual = sut.DownloadDocumentFromTheCloud(fileName, FileRouteFinder.GetDirectoryToStoreTheDocumentFromTheCloud()); Assert.AreEqual(expected, actual.ErrorMessage); }
public void DownloadDocumentFromTheCloud_GivenFileName_ShouldDownloadFileFromAsposeCloud() { //Arrange var sut = GreateAsposeApi(); const string fileName = "Aspose_by_Siphenathi_2.pdf"; var downloadedPdf = FileRouteFinder.GetDirectoryToStoreTheDocumentFromTheCloud(); //Act var actual = sut.DownloadDocumentFromTheCloud(fileName, downloadedPdf); var bytesOfDownloadedFile = File.ReadAllBytes(downloadedPdf); Assert.AreEqual(bytesOfDownloadedFile, actual.Bytes); }
public void DisableFields_GivenFilenames_ShouldDisableFieldsAndReturnStatusOk() { //Arrange var sut = GreateAsposeApi(); var formFile = FileRouteFinder.GetDirectoryOfTheMainDocument(); var newFilePath = FileRouteFinder.GetDirectoryToStoreTheDocumentWithDisableProperties(); var fieldsToDisable = new List <string> { "Date_of_Birth", "First_Name", "Surname" }; //Act sut.DisableFields(formFile, newFilePath, fieldsToDisable); var originalFile = File.ReadAllBytes(formFile); var newFile = File.ReadAllBytes(newFilePath); //Assert Assert.AreNotEqual(originalFile, newFile); }