public void Setup()
        {
            var translationUpdater = new TranslationUpdater(new TranslationFactory(), new ThreadManager());

            _translation    = new DropboxTranslation();
            _dropboxService = Substitute.For <IDropboxService>();
            _dropboxService.ParseAccessToken(Arg.Any <Uri>()).Returns("AccessAccount");
            _dropboxAppData     = new DropboxAppData("DummieAppKeyForTest", _redirectUri);
            _viewModel          = new DropboxAccountViewModel(_dropboxService, _dropboxAppData, translationUpdater);
            _accountInteraction = new DropboxAccountInteraction();
            _viewModel.SetInteraction(_accountInteraction);
        }
        public void SetUp()
        {
            _interactionRequest = new UnitTestInteractionRequest();
            _translation        = new DropboxTranslation();

            _dropboxAccounts = new ObservableCollection <DropboxAccount>();

            _usedAccount             = new DropboxAccount();
            _usedAccount.AccountId   = nameof(_usedAccount);
            _usedAccount.AccountInfo = "AI1";
            _usedAccount.AccessToken = "AT1";
            _dropboxAccounts.Add(_usedAccount);

            _unusedAccount             = new DropboxAccount();
            _unusedAccount.AccountId   = nameof(_unusedAccount);
            _unusedAccount.AccountInfo = "AI2";
            _unusedAccount.AccessToken = "AT2";
            _dropboxAccounts.Add(_unusedAccount);

            _profilesProvider = Substitute.For <ICurrentSettings <ObservableCollection <ConversionProfile> > >();
            _profiles         = new ObservableCollection <ConversionProfile>();

            _profileWithDropboxActionEnabled      = new ConversionProfile();
            _profileWithDropboxActionEnabled.Name = nameof(_profileWithDropboxActionEnabled);
            _profileWithDropboxActionEnabled.DropboxSettings.Enabled   = true;
            _profileWithDropboxActionEnabled.DropboxSettings.AccountId = _usedAccount.AccountId;
            _profiles.Add(_profileWithDropboxActionEnabled);

            _profileWithDropboxActionDisabled      = new ConversionProfile();
            _profileWithDropboxActionDisabled.Name = nameof(_profileWithDropboxActionDisabled);
            _profileWithDropboxActionDisabled.DropboxSettings.Enabled   = false;
            _profileWithDropboxActionDisabled.DropboxSettings.AccountId = _usedAccount.AccountId;
            _profiles.Add(_profileWithDropboxActionDisabled);

            var settings = new PdfCreatorSettings();

            settings.ApplicationSettings.Accounts.DropboxAccounts = _dropboxAccounts;
            settings.ConversionProfiles = _profiles;
            _accountsProvider           = Substitute.For <ICurrentSettings <Accounts> >();
            _accountsProvider.Settings.Returns(settings.ApplicationSettings.Accounts);
            _profilesProvider.Settings.Returns(_profiles);

            var translationUpdater = new TranslationUpdater(new TranslationFactory(), new ThreadManager());

            _dropboxService = Substitute.For <IDropboxService>();

            _dropboxAccountRemoveCommand = new DropboxAccountRemoveCommand(_interactionRequest, _accountsProvider, _profilesProvider, _dropboxService, translationUpdater);
        }
Ejemplo n.º 3
0
        public void SetUp()
        {
            _interactionInvoker = Substitute.For <IInteractionInvoker>();
            _interactionRequest = new UnitTestInteractionRequest();
            _dropboxAccounts    = new ObservableCollection <DropboxAccount>();
            var settings = new PdfCreatorSettings(null);

            settings.ApplicationSettings.Accounts.DropboxAccounts = _dropboxAccounts;
            var currentSettingsProvider = Substitute.For <ICurrentSettingsProvider>();

            currentSettingsProvider.Settings.Returns(settings);

            var translationUpdater = new TranslationUpdater(new TranslationFactory(), new ThreadManager());

            _dropboxAccountAddCommand = new DropboxAccountAddCommand(_interactionInvoker, _interactionRequest, currentSettingsProvider, translationUpdater);

            _translation = new DropboxTranslation();
        }