コード例 #1
0
        public void SetUp()
        {
            _interactionRequest = new UnitTestInteractionRequest();
            _translation        = new HttpTranslation();

            _httpAccounts = new ObservableCollection <HttpAccount>();

            _usedAccount           = new HttpAccount();
            _usedAccount.AccountId = nameof(_usedAccount);
            _usedAccount.Url       = "www.pdfforge1.org";
            _usedAccount.UserName  = "******";
            _httpAccounts.Add(_usedAccount);

            _unusedAccount           = new HttpAccount();
            _unusedAccount.AccountId = nameof(_unusedAccount);
            _unusedAccount.Url       = "www.pdfforge2.org";
            _unusedAccount.UserName  = "******";
            _httpAccounts.Add(_unusedAccount);

            _profiles = new ObservableCollection <ConversionProfile>();

            _profileWithHttpAccountEnabled      = new ConversionProfile();
            _profileWithHttpAccountEnabled.Name = nameof(_profileWithHttpAccountEnabled);
            _profileWithHttpAccountEnabled.HttpSettings.Enabled   = true;
            _profileWithHttpAccountEnabled.HttpSettings.AccountId = _usedAccount.AccountId;
            _profiles.Add(_profileWithHttpAccountEnabled);

            _profileWithHttpAccountDisabled      = new ConversionProfile();
            _profileWithHttpAccountDisabled.Name = nameof(_profileWithHttpAccountDisabled);
            _profileWithHttpAccountDisabled.HttpSettings.Enabled   = false;
            _profileWithHttpAccountDisabled.HttpSettings.AccountId = _usedAccount.AccountId;
            _profiles.Add(_profileWithHttpAccountDisabled);

            var settings = new PdfCreatorSettings(null);

            settings.ApplicationSettings.Accounts.HttpAccounts = _httpAccounts;
            settings.ConversionProfiles = _profiles;
            var currentSettingsProvider = Substitute.For <ICurrentSettingsProvider>();

            currentSettingsProvider.Settings.Returns(settings);
            currentSettingsProvider.Profiles.Returns(_profiles);

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

            _httpAccountRemoveCommand = new HttpAccountRemoveCommand(_interactionRequest, currentSettingsProvider, translationUpdater);
        }
コード例 #2
0
        public void SetUp()
        {
            _interactionRequest = new UnitTestInteractionRequest();
            _translation        = new HttpTranslation();
            _currentHttpAccount = new HttpAccount()
            {
                UserName = "******"
            };
            _httpAccounts = new ObservableCollection <HttpAccount>();
            _httpAccounts.Add(_currentHttpAccount);
            var settings = new PdfCreatorSettings();

            settings.ApplicationSettings.Accounts.HttpAccounts = _httpAccounts;
            _accountsProvider = Substitute.For <ICurrentSettings <Accounts> >();
            _accountsProvider.Settings.Returns(settings.ApplicationSettings.Accounts);

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

            _httpAccountEditCommand = new HttpAccountEditCommand(_interactionRequest, _accountsProvider, translationUpdater);
        }