public void ActivityIOBroker_Zip_WhenOverwriteSetTrue_ShouldOverwriteFile() { //------------Setup for test-------------------------- tempFile = Path.GetTempFileName(); var zipPathName = Path.GetTempPath() + NewFileName + ".zip"; IActivityIOOperationsEndPoint scrEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(ActivityIOFactory.CreatePathFromString(tempFile, string.Empty, null, true, "")); IActivityIOOperationsEndPoint dstEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(ActivityIOFactory.CreatePathFromString(zipPathName, string.Empty, null, true, "")); Dev2ZipOperationTO zipTO = ActivityIOFactory.CreateZipTO(null, null, null, true); File.WriteAllText(zipPathName, ""); //------------Assert Preconditions------------------- Assert.IsTrue(zipTO.Overwrite); Assert.IsTrue(File.Exists(zipPathName)); var readAllBytes = File.ReadAllBytes(zipPathName); Assert.AreEqual(0, readAllBytes.Length); //------------Execute Test--------------------------- ActivityIOFactory.CreateOperationsBroker().Zip(scrEndPoint, dstEndPoint, zipTO); //------------Assert Results------------------------- Assert.IsTrue(File.Exists(zipPathName)); readAllBytes = File.ReadAllBytes(zipPathName); Assert.AreNotEqual(0, readAllBytes.Length); File.Delete(tempFile); File.Delete(zipPathName); }
protected override string ExecuteBroker(IActivityOperationsBroker broker, IActivityIOOperationsEndPoint scrEndPoint, IActivityIOOperationsEndPoint dstEndPoint) { Dev2ZipOperationTO zipTo = ActivityIOFactory.CreateZipTO(ColItr.FetchNextRow(_compresItr).TheValue, ColItr.FetchNextRow(_archPassItr).TheValue, ColItr.FetchNextRow(_archNameItr).TheValue, Overwrite); return(broker.Zip(scrEndPoint, dstEndPoint, zipTo)); }
public void CreatePathFromString_CreateUnzipTO_AssertCorrectType() { var operationTO = ActivityIOFactory.CreateZipTO("20", "ss", "name", true); Assert.AreEqual("20", operationTO.CompressionRatio); Assert.AreEqual("ss", operationTO.ArchivePassword); Assert.AreEqual("name", operationTO.ArchiveName); Assert.IsTrue(operationTO.Overwrite); }