public void AddMissingFileDirectoryParts_GivenDestinationPathIsDirectory_SourcePathIsDirectory() { const string file = "C:\\Parent\\a.txt"; const string dstfile = "C:\\Parent\\Child\\"; var srcPath = new Mock <IActivityIOPath>(); srcPath.Setup(path => path.Path).Returns(file); var dstPath = new Mock <IActivityIOPath>(); dstPath.Setup(path => path.Path).Returns(dstfile); var dev2CrudOperationTO = new Dev2CRUDOperationTO(true); var src = new Mock <IActivityIOOperationsEndPoint>(); src.Setup(p => p.CreateDirectory(It.IsAny <IActivityIOPath>(), dev2CrudOperationTO)).Returns(true); src.Setup(p => p.IOPath).Returns(srcPath.Object); src.Setup(p => p.PathSeperator()).Returns("\\"); src.Setup(p => p.PathIs(srcPath.Object)).Returns(enPathType.Directory); var dst = new Mock <IActivityIOOperationsEndPoint>(); dst.Setup(p => p.CreateDirectory(It.IsAny <IActivityIOPath>(), dev2CrudOperationTO)).Returns(true); dst.Setup(p => p.IOPath).Returns(dstPath.Object); dst.Setup(p => p.PathSeperator()).Returns("\\"); dst.Setup(p => p.PathIs(dstPath.Object)).Returns(enPathType.Directory); var commonDataUtils = new CommonDataUtils(); commonDataUtils.AddMissingFileDirectoryParts(src.Object, dst.Object); dstPath.VerifySet(p => p.Path = @"C:\Parent\Child\a.txt"); }
public void GivenNullDestination_AddMissingFileDirectoryParts_ShouldRetunError() { var commonDataUtils = new CommonDataUtils(); var tempFile = Path.GetTempFileName(); const string newFileName = "ZippedTempFile"; 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, "")); Assert.IsNotNull(commonDataUtils); dstEndPoint.IOPath.Path = string.Empty; commonDataUtils.AddMissingFileDirectoryParts(scrEndPoint, dstEndPoint); }