public void SetArchivialCloudBackupOptionsCommand_SetsMasterExclusions_WhenOptionIsProvided()
        {
            // setup

            var mockedDb = new Mock <IClientDatabase>();

            var mockedCoreSettings = new Mock <ICoreSettings>();

            var depedencies = new CmdletDependencies()
            {
                ClientDatabase = mockedDb.Object,
                CoreSettings   = mockedCoreSettings.Object
            };

            var command = new SetArchivialCloudBackupOptionsCommand(depedencies);

            command.MasterExclusionMatches = new string[] { "^._", ".DS_Store" };

            // execute

            var result = command.Invoke().GetEnumerator().MoveNext();

            // verify

            mockedDb.Verify(x => x.SetApplicationOptionAsync(
                                It.Is <string>(z => z == RuntimeSettingNames.MasterExclusionMatches), It.Is <string>(z => z == "^._;.DS_Store")), Times.Once);
        }
        public void SetArchivialCloudBackupOptionsCommand_SetsHighPriScanFrequency_WhenOptionIsProvided()
        {
            // setup

            var mockedDb = new Mock <IClientDatabase>();

            var mockedCoreSettings = new Mock <ICoreSettings>();

            var depedencies = new CmdletDependencies()
            {
                ClientDatabase = mockedDb.Object,
                CoreSettings   = mockedCoreSettings.Object
            };

            var command = new SetArchivialCloudBackupOptionsCommand(depedencies);

            command.HighPriorityScanFrequencyInHours = 2;

            // execute

            var result = command.Invoke().GetEnumerator().MoveNext();

            // verify

            mockedDb.Verify(x => x.SetApplicationOptionAsync(
                                It.Is <string>(z => z == RuntimeSettingNames.HighPriorityScanFrequencyInHours), It.Is <string>(z => z == "2")), Times.Once);
        }
        public void SetArchivialCloudBackupOptionsCommand_SetsStatusUpdateSchedule_WhenOptionIsProvided()
        {
            // setup

            var mockedDb = new Mock <IClientDatabase>();

            var mockedCoreSettings = new Mock <ICoreSettings>();

            var depedencies = new CmdletDependencies()
            {
                ClientDatabase = mockedDb.Object,
                CoreSettings   = mockedCoreSettings.Object
            };

            var command = new SetArchivialCloudBackupOptionsCommand(depedencies);

            command.StatusUpdateSchedule = "0 8 * * *";

            // execute

            var result = command.Invoke().GetEnumerator().MoveNext();

            // verify

            mockedDb.Verify(x => x.SetApplicationOptionAsync(
                                It.Is <string>(z => z == RuntimeSettingNames.StatusUpdateSchedule), It.Is <string>(z => z == "0 8 * * *")), Times.Once);
        }
        public void SetArchivialCloudBackupOptionsCommand_DoesNotSetAnyOptions_WhenNoOptionsAreProvided()
        {
            // setup

            var mockedDb = new Mock <IClientDatabase>();

            var mockedCoreSettings = new Mock <ICoreSettings>();

            var depedencies = new CmdletDependencies()
            {
                ClientDatabase = mockedDb.Object,
                CoreSettings   = mockedCoreSettings.Object
            };

            var command = new SetArchivialCloudBackupOptionsCommand(depedencies);

            // execute

            var result = command.Invoke().GetEnumerator().MoveNext();

            // verify

            mockedDb.Verify(x => x.SetApplicationOptionAsync(
                                It.Is <string>(z => z == RuntimeSettingNames.LogFilesRetentionInDays), It.IsAny <string>()), Times.Never);

            mockedDb.Verify(x => x.SetApplicationOptionAsync(
                                It.Is <string>(z => z == RuntimeSettingNames.DatabaseBackupsRetentionInDays), It.IsAny <string>()), Times.Never);

            mockedDb.Verify(x => x.SetApplicationOptionAsync(
                                It.Is <string>(z => z == RuntimeSettingNames.BackupEngineInstancesCount), It.IsAny <string>()), Times.Never);

            mockedDb.Verify(x => x.SetApplicationOptionAsync(
                                It.Is <string>(z => z == RuntimeSettingNames.BackupEngineStartupDelayInSeconds), It.IsAny <string>()), Times.Never);

            mockedDb.Verify(x => x.SetApplicationOptionAsync(
                                It.Is <string>(z => z == RuntimeSettingNames.LowPriorityScanFrequencyInHours), It.IsAny <string>()), Times.Never);

            mockedDb.Verify(x => x.SetApplicationOptionAsync(
                                It.Is <string>(z => z == RuntimeSettingNames.MedPriorityScanFrequencyInHours), It.IsAny <string>()), Times.Never);

            mockedDb.Verify(x => x.SetApplicationOptionAsync(
                                It.Is <string>(z => z == RuntimeSettingNames.HighPriorityScanFrequencyInHours), It.IsAny <string>()), Times.Never);

            mockedDb.Verify(x => x.SetApplicationOptionAsync(
                                It.Is <string>(z => z == RuntimeSettingNames.ProtectionIV), It.IsAny <string>()), Times.Never);

            mockedDb.Verify(x => x.SetApplicationOptionAsync(
                                It.Is <string>(z => z == RuntimeSettingNames.StatusUpdateSchedule), It.IsAny <string>()), Times.Never);

            mockedDb.Verify(x => x.SetApplicationOptionAsync(
                                It.Is <string>(z => z == RuntimeSettingNames.MasterExclusionMatches), It.IsAny <string>()), Times.Never);
        }