1 // Licensed to the .NET Foundation under one or more agreements. 2 // The .NET Foundation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using Xunit; 6 7 namespace System.IO.Tests 8 { 9 public class FileInfo_MoveTo : File_Move 10 { Move(string sourceFile, string destFile)11 public override void Move(string sourceFile, string destFile) 12 { 13 new FileInfo(sourceFile).MoveTo(destFile); 14 } 15 16 [Fact] NonExistentPath()17 public override void NonExistentPath() 18 { 19 FileInfo testFile = new FileInfo(GetTestFilePath()); 20 testFile.Create().Dispose(); 21 Assert.Throws<FileNotFoundException>(() => Move(GetTestFilePath(), testFile.FullName)); 22 Assert.Throws<DirectoryNotFoundException>(() => Move(testFile.FullName, Path.Combine(TestDirectory, GetTestFileName(), GetTestFileName()))); 23 Assert.Throws<DirectoryNotFoundException>(() => Move(Path.Combine(TestDirectory, GetTestFileName(), GetTestFileName()), testFile.FullName)); 24 } 25 } 26 } 27