Skip to content

Commit 552c030

Browse files
committed
Improved exception on missing source files in TestFileSystem.Copy()
1 parent 4b809b2 commit 552c030

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/GitVersionCore.Tests/TestFileSystem.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ public void Copy(string @from, string to, bool overwrite)
1818
else
1919
throw new IOException("File already exists");
2020
}
21-
fileSystem.Add(to, fileSystem[from]);
21+
22+
string source;
23+
if (!fileSystem.TryGetValue(from, out source))
24+
throw new FileNotFoundException(string.Format("The source file '{0}' was not found", from), from);
25+
26+
fileSystem.Add(to, source);
2227
}
2328

2429
public void Move(string @from, string to)

0 commit comments

Comments
 (0)