public void SetUp() { _interactionRequest = new UnitTestInteractionRequest(); _tabSwitchSettingsCheck = Substitute.For <ITabSwitchSettingsCheck>(); _evaluateSavingCommand = new EvaluateSavingRelevantSettingsAndNotifyUserCommand( _interactionRequest, new DesignTimeTranslationUpdater(), _tabSwitchSettingsCheck); _commandTester = new WaitableCommandTester <EvaluateSavingRelevantSettingsAndNotifyUserCommand>(_evaluateSavingCommand); }
public void SetUp() { _interactionRequest = new UnitTestInteractionRequest(); _tabSwitchSettingsCheck = Substitute.For <ITabSwitchSettingsCheck>(); _currentSettingsProvider = Substitute.For <ICurrentSettingsProvider>(); _beforeEvaluateTabSwitchCommand = new EvaluateTabSwitchRelevantSettingsAndNotifyUserCommand( _interactionRequest, new DesignTimeTranslationUpdater(), _tabSwitchSettingsCheck, _currentSettingsProvider); _commandTester = new WaitableCommandTester <EvaluateTabSwitchRelevantSettingsAndNotifyUserCommand>(_beforeEvaluateTabSwitchCommand); }
public void Execute_WithNoErrors_CallsIsDoneWithSuccess() { var command = BuildCommand(); var commandTester = new WaitableCommandTester <CheckProfileCommand>(command); _profileChecker.ProfileCheckDict(null, null).ReturnsForAnyArgs(new ActionResultDict()); command.Execute(null); Assert.IsTrue(commandTester.IsDoneWasRaised); Assert.AreEqual(ResponseStatus.Success, commandTester.LastResponseStatus); }
public void Execute_WithErrors_UserChoosesToCancel_CallsIsDoneWithCancel() { var command = BuildCommand(); var commandTester = new WaitableCommandTester <CheckProfileCommand>(command); var actionResult = new ActionResultDict(); actionResult.Add("a", new ActionResult(ErrorCode.Processing_GenericError)); _profileChecker.ProfileCheckDict(null, null).ReturnsForAnyArgs(actionResult); _interactionRequest.RegisterInteractionHandler <ProfileProblemsInteraction>(i => i.IgnoreProblems = false); command.Execute(null); Assert.IsTrue(commandTester.IsDoneWasRaised); Assert.AreEqual(ResponseStatus.Cancel, commandTester.LastResponseStatus); }
public void Setup() { _interactionRequest = new UnitTestInteractionRequest(); _settings = new PdfCreatorSettings(null); _currentSettingsProvider = Substitute.For <ICurrentSettingsProvider>(); _currentSettingsProvider.Settings.Returns(_settings); _currentSettingsProvider.Profiles.Returns(_settings.ConversionProfiles); _currentSettingsProvider.SelectedProfile.Returns(_settings.ConversionProfiles.FirstOrDefault()); var translationUpdater = new DesignTimeTranslationUpdater(); _regionHelper = Substitute.For <IRegionHelper>(); _profileChecker = Substitute.For <IProfileChecker>(); _profileChecker.CheckProfileList(_settings.ConversionProfiles, _settings.ApplicationSettings.Accounts) .Returns(new ActionResultDict()); _appSettingsChecker = Substitute.For <IAppSettingsChecker>(); _appSettingsChecker.CheckDefaultViewers(Arg.Any <ApplicationSettings>()) .Returns(new ActionResult()); _settingsChanged = Substitute.For <ISettingsChanged>(); _command = new EvaluateSettingsAndNotifyUserCommand(_interactionRequest, _currentSettingsProvider, translationUpdater, _regionHelper, _profileChecker, _appSettingsChecker, _settingsChanged); _commandTester = new WaitableCommandTester <EvaluateSettingsAndNotifyUserCommand>(_command); _translation = new EvaluateSettingsAndNotifyUserTranslation(); _actionResultWithError = new ActionResult((ErrorCode)123456789); _errorsInProfile = new ActionResultDict(); _errorsInProfile.Add("Some Profile", _actionResultWithError); }