public void CopyFileTest_ThrowsWin32Exception_FailIfExists() { WimgApi.CopyFile(TestWimPath, _destinationPath, WimCopyFileOptions.None); File.Exists(_destinationPath).ShouldBeTrue(); Win32Exception win32Exception = Should.Throw <Win32Exception>(() => WimgApi.CopyFile(TestWimPath, _destinationPath, WimCopyFileOptions.FailIfExists)); win32Exception.Message.ShouldBe("The file exists"); }
public void CopyFileWithCallbackTest() { StringBuilder stringBuilder = new StringBuilder(); CopyFileProgressAction CopyFileProgressCallback(CopyFileProgress progress, object userData) { _callbackCalled = true; ((StringBuilder)userData).Append(CallbackText); return(CopyFileProgressAction.Quiet); } WimgApi.CopyFile(TestWimPath, _destinationPath, WimCopyFileOptions.None, CopyFileProgressCallback, stringBuilder); _callbackCalled.ShouldBeTrue("The callback should have been called"); stringBuilder.ToString().ShouldBe(CallbackText); }
public void CopyFileTest_ThrowsArgumentNullException_destinationFile() { ShouldThrow <ArgumentNullException>("destinationFile", () => WimgApi.CopyFile("", null, WimCopyFileOptions.None)); }
public void CopyFileTest_ThrowsArgumentNullException_sourceFile() { ShouldThrow <ArgumentNullException>("sourceFile", () => WimgApi.CopyFile(null, "", WimCopyFileOptions.None)); }
public void CopyFileTest() { WimgApi.CopyFile(TestWimPath, _destinationPath, WimCopyFileOptions.None); File.Exists(_destinationPath).ShouldBe(true); }