public void TestXboxDirectoryExistsCallsXboxDirectoryInfoExistsImplCorrectly() { // test when a directory exists: bool success = false; ShimXboxDirectoryInfo.ExistsImplStringXboxPathXboxConsoleAdapterBase = (systemIpAddress, xboxPath, adapterBase) => { success = true; Assert.AreEqual(this.XboxConsole.Adapter, adapterBase, "The passed adapter does not equal the original one."); return(true); }; Assert.IsTrue(XboxDirectory.Exists(this.xboxDirectoryPath, this.XboxConsole), "The directory should exist."); Assert.IsTrue(success, "XboxDirectoryInfo.ExistsImpl wasn't called."); // test when a directory doesn't exist: success = false; ShimXboxDirectoryInfo.ExistsImplStringXboxPathXboxConsoleAdapterBase = (systemIpAddress, xboxPath, adapterBase) => { success = true; return(false); }; Assert.IsFalse(XboxDirectory.Exists(this.xboxDirectoryPath, this.XboxConsole), "The directory shouldn't exist."); Assert.IsTrue(success, "XboxDirectoryInfo.ExistsImpl wasn't called."); }
public void TestXboxDirectoryDeleteCallsXboxDirectoryInfoDeleteCorrectly() { bool success = false; ShimXboxDirectoryInfo.AllInstances.Delete = xboxDirectoryInfo => { success = true; }; XboxDirectory.Delete(this.xboxDirectoryPath, this.XboxConsole); Assert.IsTrue(success, "XboxDirectoryInfo.Delete wasn't called."); }
public void TestXboxDirectoryDeleteRecursiveCallsXboxDirectoryInfoDeleteRecursiveCorrectly() { // test non-recursive: bool success = false; bool recursive = false; ShimXboxDirectoryInfo.AllInstances.DeleteBoolean = (xboxDirectoryInfo, isRecursive) => { success = true; Assert.IsTrue(recursive == isRecursive, string.Format(CultureInfo.CurrentCulture, "Recursion behavior does not correspond to the specified parameter ({0}).", recursive)); }; XboxDirectory.Delete(this.xboxDirectoryPath, recursive, this.XboxConsole); Assert.IsTrue(success, "XboxDirectoryInfo.Delete (recursive) wasn't called."); // test recursive: success = false; recursive = true; XboxDirectory.Delete(this.xboxDirectoryPath, recursive, this.XboxConsole); Assert.IsTrue(success, "XboxDirectoryInfo.Delete (recursive) wasn't called."); }
public void TestXboxDirectoryMoveXboxPCCallsCopyXboxDirectoryInfoDeleteCorrectly() { int successSequenceChecker = 1; ShimXboxDirectory.CopyXboxPathStringXboxConsole = (sourceDirectory, destinationDirectory, console) => { successSequenceChecker *= 2; Assert.AreEqual(this.xboxDirectoryPath, sourceDirectory, "The source directory is incorrect."); Assert.AreEqual(this.pcDirectory, destinationDirectory, "The destination directory is incorrect."); Assert.AreEqual(this.XboxConsole, console, "The console is incorrect."); }; ShimXboxDirectoryInfo.AllInstances.DeleteBoolean = (xboxDirectoryInfo, isRecursive) => { successSequenceChecker++; Assert.IsTrue(string.Equals(this.xboxDirectoryPath.FullName, xboxDirectoryInfo.FullName, StringComparison.OrdinalIgnoreCase) && this.xboxDirectoryPath.OperatingSystem == xboxDirectoryInfo.OperatingSystem, "The directory to be deleted is incorrect."); Assert.IsTrue(isRecursive, "The delete should be recursive."); }; XboxDirectory.Move(this.xboxDirectoryPath, this.pcDirectory, this.XboxConsole); Assert.IsTrue(successSequenceChecker == 3, "XboxDirectory.Copy and XboxDirectoryInfo.Delete were not called in the required order."); }
public void TestXboxDirectoryCopyXboxPCCallsXboxDirectoryInfoCopyCorrectly() { bool success = false; IProgress <XboxFileTransferMetric> expectedProgress = null; ShimXboxPath.HasXboxOriginString = path => true; ShimXboxDirectoryInfo.AllInstances.CopyStringIProgressOfXboxFileTransferMetric = (xboxDirectoryInfo, path, metrics) => { success = true; Assert.AreEqual(this.xboxDirectoryPath.FullName, xboxDirectoryInfo.FullName, "Copy didn't pass on the correct directory."); Assert.AreEqual(this.pcDirectory, path, "Copy didn't pass on the correct xbox directory."); Assert.AreSame(expectedProgress, metrics, "Copy didn't pass on the same progress object."); }; XboxDirectory.Copy(this.xboxDirectoryPath, this.pcDirectory, this.XboxConsole); Assert.IsTrue(success, "XboxDirectoryInfo.Copy wasn't called."); XboxDirectory.Copy(this.xboxDirectoryPath, this.pcDirectory, this.XboxConsole, null); expectedProgress = new Progress <XboxFileTransferMetric>(); XboxDirectory.Copy(this.xboxDirectoryPath, this.pcDirectory, this.XboxConsole, expectedProgress); }
public void TestXboxDirectoryCopyPCXboxCallsDirectoryInfoCopyToCorrectly() { bool success = false; IProgress <XboxFileTransferMetric> expectedProgress = null; ShimXboxPath.HasXboxOriginString = path => true; ShimDirectoryInfoExtensions.CopyToDirectoryInfoXboxPathXboxConsoleIProgressOfXboxFileTransferMetric = (directoryInfo, xboxPath, console, metrics) => { success = true; Assert.AreEqual(this.pcDirectory, directoryInfo.FullName, "Copy didn't pass on the correct directory."); Assert.AreEqual(this.xboxDirectoryPath, xboxPath, "Copy didn't pass on the correct xbox directory."); Assert.AreSame(expectedProgress, metrics, "Copy didn't pass on the same progress object."); return(null); }; XboxDirectory.Copy(this.pcDirectory, this.xboxDirectoryPath, this.XboxConsole); Assert.IsTrue(success, "DirectoryInfo.CopyTo wasn't called."); XboxDirectory.Copy(this.pcDirectory, this.xboxDirectoryPath, this.XboxConsole, null); expectedProgress = new Progress <XboxFileTransferMetric>(); XboxDirectory.Copy(this.pcDirectory, this.xboxDirectoryPath, this.XboxConsole, expectedProgress); }
public void TestXboxDirectoryCopyPCXboxNotSupportedDestinationDirectory() { ShimXboxPath.HasXboxOriginString = path => false; XboxDirectory.Copy(this.pcDirectory, this.xboxDirectoryPath, this.XboxConsole); }
public void TestXboxDirectoryCopyPCXboxArgumentNullDestinationDirectory() { XboxDirectory.Copy(this.pcDirectory, null, this.XboxConsole); }
public void TestXboxDirectoryExistsArgumentNullConsole() { XboxDirectory.Exists(this.xboxDirectoryPath, null); }
public void TestXboxDirectoryCopyXboxPCNotSupportedSourceDirectory() { ShimXboxPath.HasXboxOriginString = path => false; XboxDirectory.Copy(this.xboxDirectoryPath, this.pcDirectory, this.XboxConsole); }
public void TestXboxDirectoryCopyXboxPCArgumentNullSourceDirectory() { XboxDirectory.Copy(null, this.pcDirectory, this.XboxConsole); }