public void Initialize_ConnectivityLoggedIn_MethodsCalled() { // Setup IConnectivityAdapter connectivitySetup = Substitute.For <IConnectivityAdapter>(); connectivitySetup.IsConnected.Returns(true); ISettingsFacade settingsManagerMock = Substitute.For <ISettingsFacade>(); settingsManagerMock.IsLoggedInToBackupService.Returns(true); DateTime returnDate = DateTime.Today; IBackupService backupServiceMock = Substitute.For <IBackupService>(); backupServiceMock.IsBackupExistingAsync().Returns(true); backupServiceMock.GetBackupDateAsync().Returns(returnDate); //execute var vm = new BackupViewModel(backupServiceMock, null, connectivitySetup, settingsManagerMock, null); vm.InitializeCommand.Execute(null); //assert vm.IsLoadingBackupAvailability.Should().BeFalse(); vm.BackupAvailable.Should().BeTrue(); vm.BackupLastModified.Should().Be(returnDate); }
public async Task Initialize_ConnectivityNotLoggedIn_NothingCalled() { // Setup IConnectivityAdapter connectivitySetup = Substitute.For <IConnectivityAdapter>(); connectivitySetup.IsConnected.Returns(true); ISettingsFacade settingsManagerMock = Substitute.For <ISettingsFacade>(); IBackupService backupServiceMock = Substitute.For <IBackupService>(); //execute var vm = new BackupViewModel(backupServiceMock, null, connectivitySetup, settingsManagerMock, null); vm.InitializeCommand.Execute(null); //assert vm.IsLoadingBackupAvailability.Should().BeFalse(); await backupServiceMock.Received(0).IsBackupExistingAsync(); await backupServiceMock.Received(0).GetBackupDateAsync(); }
public void Logout_PropertiesSet() { // Setup IConnectivityAdapter connectivitySetup = Substitute.For <IConnectivityAdapter>(); ISettingsFacade settingsManagerMock = Substitute.For <ISettingsFacade>(); bool logoutCommandCalled = false; IBackupService backupServiceMock = Substitute.For <IBackupService>(); backupServiceMock.When(x => x.LogoutAsync()) .Do(x => logoutCommandCalled = true); //execute var vm = new BackupViewModel(backupServiceMock, null, connectivitySetup, settingsManagerMock, null); vm.LogoutCommand.Execute(null); //assert logoutCommandCalled.Should().BeTrue(); settingsManagerMock.IsLoggedInToBackupService.Should().BeFalse(); }
public BackupManager(ICloudBackupService cloudBackupService, IMvxFileStore fileStore, IConnectivityAdapter connectivity) { this.cloudBackupService = cloudBackupService; this.fileStore = fileStore; this.connectivity = connectivity; }
public BackupViewModel(IBackupService backupService, IDialogService dialogService, IConnectivityAdapter connectivity, ISettingsFacade settingsFacade) { this.backupService = backupService; this.dialogService = dialogService; this.connectivity = connectivity; this.settingsFacade = settingsFacade; }
public BackupViewModel(IBackupService backupService, IDialogService dialogService, IConnectivityAdapter connectivity, ISettingsFacade settingsFacade, IMvxLogProvider logProvider, IMvxNavigationService navigationService) : base(logProvider, navigationService) { this.backupService = backupService; this.dialogService = dialogService; this.connectivity = connectivity; this.settingsFacade = settingsFacade; }
public BackupService(ICloudBackupService cloudBackupService, IFileStore fileStore, ISettingsFacade settingsFacade, IConnectivityAdapter connectivity, IContextAdapter contextAdapter) { this.cloudBackupService = cloudBackupService; this.fileStore = fileStore; this.settingsFacade = settingsFacade; this.connectivity = connectivity; this.contextAdapter = contextAdapter; }
public BackupViewModel(IBackupService backupService, IDialogService dialogService, IConnectivityAdapter connectivity, ISettingsFacade settingsFacade, IToastService toastService) { this.backupService = backupService; this.dialogService = dialogService; this.connectivity = connectivity; this.settingsFacade = settingsFacade; this.toastService = toastService; userAccount = new UserAccount(); }
public BackupService(ICloudBackupService cloudBackupService, IFileStore fileStore, ISettingsFacade settingsFacade, IConnectivityAdapter connectivity, IContextAdapter contextAdapter, IMessenger messenger, IToastService toastService) { this.cloudBackupService = cloudBackupService; this.fileStore = fileStore; this.settingsFacade = settingsFacade; this.connectivity = connectivity; this.contextAdapter = contextAdapter; this.messenger = messenger; this.toastService = toastService; }