public async Task ExecuteRestartMainWindowAsync_RestartMainWindow_Correct() { var initTrigger = false; var showTrigger = false; A.CallTo(() => _settingsService.GetByUserIdAsync(A <int> .Ignored)).Returns(new SettingsModel { Language = Language.English }); A.CallTo(() => _authorizationService.GetCurrentUser()).Returns(new UserModel { Id = 10 }); var mainWindow = A.Fake <MainWindow>(); A.CallTo(() => mainWindow.InitAsync()).Invokes(() => initTrigger = true); A.CallTo(() => mainWindow.ShowWindow()).Invokes(() => showTrigger = true); A.CallTo(() => _windowFactory.Create <MainWindow>()).Returns(mainWindow); await _settingsViewModel.ExecuteRestartMainWindowAsync(new object()); A.CallTo(() => _settingsHelper.SetLanguage(A <SettingsModel> .Ignored)).MustHaveHappened(); A.CallTo(() => _windowFactory.Close <MainWindow>()).MustHaveHappened(); A.CallTo(() => _windowFactory.Create <MainWindow>()).MustHaveHappened(); Assert.IsTrue(initTrigger); Assert.IsTrue(showTrigger); }
public async Task CreateMainWindowAsync() { var settings = await _settingsService.GetByUserIdAsync(_authorizationService.GetCurrentUser().Id); _settingsHelper.SetLanguage(settings); _settingsHelper.SetTheme(settings); var mainWindow = _windowFactory.Create <MainWindow>(); await mainWindow.InitAsync(); mainWindow.ShowWindow(); }