public void TestXboxFileCopyPCXboxCallsFileInfoCopyToCorrectly() { IProgress <XboxFileTransferMetric> expectedProgress = null; bool success = false; ShimXboxPath.HasXboxOriginString = path => true; ShimFileInfoExtensions.CopyToFileInfoXboxPathXboxConsoleIProgressOfXboxFileTransferMetric = (fileInfo, xboxPath, console, metrics) => { success = true; Assert.AreEqual(this.pcFile, fileInfo.FullName, "Copy didn't pass the expected source file path to the adapter."); Assert.AreEqual(this.xboxFilePath.FullName, xboxPath.FullName, "Copy didn't pass the expected destination file path to the adapter."); Assert.AreSame(expectedProgress, metrics, "Copy didn't pass the expected destination file path to the adapter."); return(null); }; XboxFile.Copy(this.pcFile, this.xboxFilePath, this.XboxConsole); Assert.IsTrue(success, "FileInfo.CopyTo wasn't called."); XboxFile.Copy(this.pcFile, this.xboxFilePath, this.XboxConsole, null); expectedProgress = new Progress <XboxFileTransferMetric>(); XboxFile.Copy(this.pcFile, this.xboxFilePath, this.XboxConsole, expectedProgress); }
public void TestXboxFileExistsCallsXboxFileInfoExistsImplCorrectly() { // test when a file exists: bool success = false; ShimXboxFileInfo.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(XboxFile.Exists(this.xboxFilePath, this.XboxConsole), "The file should exist."); Assert.IsTrue(success, "XboxFileInfo.ExistsImpl wasn't called."); // test when a file doesn't exist: success = false; ShimXboxFileInfo.ExistsImplStringXboxPathXboxConsoleAdapterBase = (systemIpAddress, xboxPath, adapterBase) => { success = true; return(false); }; Assert.IsFalse(XboxFile.Exists(this.xboxFilePath, this.XboxConsole), "The file shouldn't exist."); Assert.IsTrue(success, "XboxFileInfo.ExistsImpl wasn't called."); }
public void TestXboxFileDeleteCallsXboxFileInfoDeleteCorrectly() { bool success = false; ShimXboxFileInfo.AllInstances.Delete = xboxFileInfo => { success = true; }; XboxFile.Delete(this.xboxFilePath, this.XboxConsole); Assert.IsTrue(success, "XboxFileInfo.Delete wasn't called."); }
public void TestXboxFileMoveXboxPCCallsCopyXboxFileInfoDeleteCorrectly() { int successSequenceChecker = 1; ShimXboxFile.CopyXboxPathStringXboxConsole = (sourceFile, destinationFile, console) => { successSequenceChecker *= 2; Assert.AreEqual(this.xboxFilePath, sourceFile, "The source file is incorrect."); Assert.AreEqual(this.pcFile, destinationFile, "The destination file is incorrect."); Assert.AreEqual(this.XboxConsole, console, "The console is incorrect."); }; ShimXboxFileInfo.AllInstances.Delete = xboxFileInfo => { successSequenceChecker++; Assert.IsTrue(string.Equals(this.xboxFilePath.FullName, xboxFileInfo.FullName, StringComparison.OrdinalIgnoreCase) && this.xboxFilePath.OperatingSystem == xboxFileInfo.OperatingSystem, "The file to be deleted is incorrect."); }; XboxFile.Move(this.xboxFilePath, this.pcFile, this.XboxConsole); Assert.IsTrue(successSequenceChecker == 3, "XboxFile.Copy and XboxFileInfo.Delete were not called in the required order."); }
public void TestXboxFileCopyXboxPCCallsXboxFileInfoCopyCorrectly() { IProgress <XboxFileTransferMetric> expectedProgress = null; bool success = false; ShimXboxPath.HasXboxOriginString = path => true; ShimXboxFileInfo.AllInstances.CopyStringIProgressOfXboxFileTransferMetric = (xboxFileInfo, path, metrics) => { success = true; Assert.AreEqual(this.xboxFilePath.FullName, xboxFileInfo.FullName, "Copy didn't pass the expected source file path to the adapter."); Assert.AreEqual(this.pcFile, path, "Copy didn't pass the expected destination file path to the adapter."); Assert.AreSame(expectedProgress, metrics, "Copy didn't pass the expected destination file path to the adapter."); }; XboxFile.Copy(this.xboxFilePath, this.pcFile, this.XboxConsole); Assert.IsTrue(success, "XboxFileInfo.Copy wasn't called."); XboxFile.Copy(this.xboxFilePath, this.pcFile, this.XboxConsole, null); expectedProgress = new Progress <XboxFileTransferMetric>(); XboxFile.Copy(this.xboxFilePath, this.pcFile, this.XboxConsole, expectedProgress); }
public void TestXboxFileCopyPCXboxNotSupportedDestinationFile() { ShimXboxPath.HasXboxOriginString = path => false; XboxFile.Copy(this.pcFile, this.xboxFilePath, this.XboxConsole); }
public void TestXboxFileCopyPCXboxArgumentNullDestinationFile() { XboxFile.Copy(this.pcFile, null, this.XboxConsole); }
public void TestXboxFileExistsArgumentNullConsole() { XboxFile.Exists(this.xboxFilePath, null); }
public void TestXboxFileCopyXboxPCNotSupportedSourceFile() { ShimXboxPath.HasXboxOriginString = path => false; XboxFile.Copy(this.xboxFilePath, this.pcFile, this.XboxConsole); }
public void TestXboxFileCopyXboxPCArgumentNullSourceFile() { XboxFile.Copy(null, this.pcFile, this.XboxConsole); }