public void TestXboxFileInfoCopy() { XboxFileInfo fileInfo = new XboxFileInfo( new ShimXboxFileSystemInfoDefinition() { PathGet = () => new XboxPath(@"xd:\parentDirectory\file", XboxOperatingSystem.System) }, this.XboxConsole); string expectedDestination = @"c:\parentDirectory\file"; IProgress <XboxFileTransferMetric> expectedMetric = null; bool success = false; this.shimAdapter.ReceiveFileStringXboxPathStringIProgressOfXboxFileTransferMetric = (systemIpAddress, sourceFilePath, destinationFilePath, metrics) => { success = true; Assert.AreEqual(fileInfo.FullName, sourceFilePath.FullName, "Copy didn't pass the expected source file path to the adapter."); Assert.AreEqual(expectedDestination, destinationFilePath, "Copy didn't pass the expected destination file path to the adapter."); Assert.AreSame(expectedMetric, metrics, "Copy didn't pass the expected destination file path to the adapter."); }; fileInfo.Copy(expectedDestination); Assert.IsTrue(success); fileInfo.Copy(expectedDestination, null); expectedMetric = new Progress <XboxFileTransferMetric>(); fileInfo.Copy(expectedDestination, expectedMetric); }
public void TestXboxFileInfoCopyTargetDirectoryNull() { this.shimAdapter.ReceiveFileStringXboxPathStringIProgressOfXboxFileTransferMetric = (systemIpAddress, sourceFilePath, destinationFilePath, metrics) => { throw new ArgumentNullException("destinationFilePath"); }; XboxFileInfo fileInfo = new XboxFileInfo(new ShimXboxFileSystemInfoDefinition(), this.XboxConsole); fileInfo.Copy(null); }
public void TestXboxFileInfoCopyTargetDirectoryDoesNotExist() { this.shimAdapter.ReceiveFileStringXboxPathStringIProgressOfXboxFileTransferMetric = (systemIpAddress, sourceFilePath, destinationFilePath, metrics) => { throw new DirectoryNotFoundException(); }; XboxFileInfo fileInfo = new XboxFileInfo(@"xd:\file", XboxOperatingSystem.System, this.XboxConsole); fileInfo.Copy(@"c:\parentDirectoryThatDoesNotExist\file"); }