Esempio n. 1
0
        public void IsAutoBackupEnabled_StopService()
        {
            // Arrange
            var settingsFacadeMock = new Mock <ISettingsFacade>();

            settingsFacadeMock.SetupGet(x => x.IsBackupAutouploadEnabled).Returns(true);

            var taskStopped           = false;
            var backgroundTaskManager = new Mock <IBackgroundTaskManager>();

            backgroundTaskManager.Setup(x => x.StopBackupSyncTask()).Callback(() => taskStopped = true);

            // Act
            var vm = new SettingsBackgroundJobViewModel(settingsFacadeMock.Object, backgroundTaskManager.Object);

            vm.IsAutoBackupEnabled = false;

            // Assert
            Assert.True(taskStopped);
        }
Esempio n. 2
0
        public void BackupSyncRecurrence(int passedValue, int expectedValue)
        {
            // Arrange
            var settingsFacadeMock = new Mock <ISettingsFacade>();

            settingsFacadeMock.SetupAllProperties();

            var taskStarted           = false;
            var backgroundTaskManager = new Mock <IBackgroundTaskManager>();

            backgroundTaskManager.Setup(x => x.StartBackupSyncTask(It.IsAny <int>())).Callback(() => taskStarted = true);

            // Act
            var vm = new SettingsBackgroundJobViewModel(settingsFacadeMock.Object, backgroundTaskManager.Object);

            vm.BackupSyncRecurrence = passedValue;

            // Assert
            Assert.True(taskStarted);
            Assert.Equal(expectedValue, vm.BackupSyncRecurrence);
        }
Esempio n. 3
0
        public void IsAutoBackupEnabled_StartService()
        {
            // Arrange
            var settingsManagerMock = new Mock <ISettingsManager>();

            settingsManagerMock.SetupGet(x => x.IsBackupAutouploadEnabled).Returns(false);

            var taskStarted           = false;
            var backgroundTaskManager = new Mock <IBackgroundTaskManager>();

            backgroundTaskManager.Setup(x => x.StartBackupSyncTask(It.IsAny <int>())).Callback(() => taskStarted = true);

            // Act
            var vm = new SettingsBackgroundJobViewModel(settingsManagerMock.Object, backgroundTaskManager.Object,
                                                        new Mock <IMvxLogProvider>().Object,
                                                        new Mock <IMvxNavigationService>().Object);

            vm.IsAutoBackupEnabled = true;

            // Assert
            Assert.True(taskStarted);
        }