public void UpdateArchivialCloudBackupCommand_RunsCompleteUpdate() { // setup var mockedSetup = new Mock <ISetup>(); mockedSetup.Setup(x => x.IsRunningElevated()).Returns(true); mockedSetup.Setup(x => x.GetInstalledVersionAsync()).ReturnsAsync(new Version(1, 0, 0, 0)); mockedSetup.Setup(x => x.GetPowerShellModuleVersion()).Returns(new Version(1, 0, 0, 1)); var mockedCoreSettings = new Mock <ICoreSettings>(); var depedencies = new CmdletDependencies() { Setup = mockedSetup.Object, CoreSettings = mockedCoreSettings.Object }; var command = new UpdateArchivialCloudBackupCommand(depedencies); command.Force = true; // execute var result = command.Invoke().GetEnumerator().MoveNext(); // verify mockedSetup.Verify(x => x.StopClientService(), Times.Once); mockedSetup.Verify(x => x.CopyProgramFiles(), Times.Once); mockedSetup.Verify(x => x.SetDatabasePublishRequiredCoreOption(), Times.Once); mockedSetup.Verify(x => x.StartClientService(), Times.Once); mockedSetup.Verify(x => x.WaitForFirstTimeSetup(), Times.Once); }
public void UpdateArchivialCloudBackupCommand_Throws_IfUserIsNotElevated() { // setup var mockedSetup = new Mock <ISetup>(); mockedSetup.Setup(x => x.IsRunningElevated()).Returns(false); var mockedCoreSettings = new Mock <ICoreSettings>(); var depedencies = new CmdletDependencies() { Setup = mockedSetup.Object, CoreSettings = mockedCoreSettings.Object }; var command = new UpdateArchivialCloudBackupCommand(depedencies); // execute var result = command.Invoke().GetEnumerator().MoveNext(); }
public void UpdateArchivialCloudBackupCommand_Throws_IfProductIsNotInstalled() { // setup var mockedSetup = new Mock <ISetup>(); mockedSetup.Setup(x => x.IsRunningElevated()).Returns(true); mockedSetup.Setup(x => x.GetInstalledVersionAsync()).ReturnsAsync((Version)null); var mockedCoreSettings = new Mock <ICoreSettings>(); var depedencies = new CmdletDependencies() { Setup = mockedSetup.Object, CoreSettings = mockedCoreSettings.Object }; var command = new UpdateArchivialCloudBackupCommand(depedencies); // execute var result = command.Invoke().GetEnumerator().MoveNext(); }