public void CancelRestorePoint() { var service = new SystemRestoreTestService(); try { var restorePoint = SystemRestorePoint.Create(RestorePointType.ApplicationInstall, service: service); restorePoint.Rollback(); // Tests the default description since it shouldn't show up (cancelled). Assert.AreEqual<string>("Windows Installer PowerShell Module", restorePoint.Description); Assert.AreEqual<long>(service.SequenceNumber, restorePoint.SequenceNumber); } catch (Win32Exception ex) { if (NativeMethods.ERROR_ACCESS_DENIED == ex.NativeErrorCode) { Assert.Inconclusive("Elevation required."); } else { throw; } } }
public void FailRestorePointThrows() { var service = new SystemRestoreTestService(); service.SetNextErrorCode(NativeMethods.ERROR_INVALID_DATA); try { SystemRestorePoint.Create(RestorePointType.ApplicationInstall, service: service); } catch (Win32Exception ex) { if (NativeMethods.ERROR_ACCESS_DENIED == ex.NativeErrorCode) { Assert.Inconclusive("Elevation required."); } else { throw; } } }
public void CreateRestorePoint() { var service = new SystemRestoreTestService(); try { var restorePoint = SystemRestorePoint.Create(RestorePointType.ApplicationInstall, "CreateRestorePoint test", service); restorePoint.Commit(); Assert.AreEqual <string>("CreateRestorePoint test", restorePoint.Description); Assert.AreEqual <long>(service.SequenceNumber, restorePoint.SequenceNumber); } catch (Win32Exception ex) { if (NativeMethods.ERROR_ACCESS_DENIED == ex.NativeErrorCode) { Assert.Inconclusive("Elevation required."); } else { throw; } } }
public void CreateRestorePoint() { var service = new SystemRestoreTestService(); try { var restorePoint = SystemRestorePoint.Create(RestorePointType.ApplicationInstall, "CreateRestorePoint test", service); restorePoint.Commit(); Assert.AreEqual<string>("CreateRestorePoint test", restorePoint.Description); Assert.AreEqual<long>(service.SequenceNumber, restorePoint.SequenceNumber); } catch (Win32Exception ex) { if (NativeMethods.ERROR_ACCESS_DENIED == ex.NativeErrorCode) { Assert.Inconclusive("Elevation required."); } else { throw; } } }