public void SetUp()
        {
            _interactionRequest = new UnitTestInteractionRequest();

            _timeServerAccounts = new ObservableCollection <TimeServerAccount>();
            var settings = new PdfCreatorSettings();

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

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

            _timeServerAccountAddCommand = new TimeServerAccountAddCommand(_interactionRequest, _accountsProvider, translationUpdater);
        }
        public void SetUp()
        {
            _interactionRequest = new UnitTestInteractionRequest();
            _translation        = new TimeServerTranslation();
            _profilesProvider   = Substitute.For <ICurrentSettings <ObservableCollection <ConversionProfile> > >();
            _timeServerAccounts = new ObservableCollection <TimeServerAccount>();

            _usedAccount           = new TimeServerAccount();
            _usedAccount.AccountId = nameof(_usedAccount);
            _usedAccount.UserName  = "******";
            _usedAccount.Url       = "Url1";
            _timeServerAccounts.Add(_usedAccount);

            _unusedAccount           = new TimeServerAccount();
            _unusedAccount.AccountId = nameof(_unusedAccount);
            _unusedAccount.UserName  = "******";
            _unusedAccount.Url       = "Url2";
            _timeServerAccounts.Add(_unusedAccount);

            _profiles = new ObservableCollection <ConversionProfile>();

            _profileWithTimeServerAccountEnabled      = new ConversionProfile();
            _profileWithTimeServerAccountEnabled.Name = nameof(_profileWithTimeServerAccountEnabled);
            _profileWithTimeServerAccountEnabled.PdfSettings.Signature.Enabled             = true;
            _profileWithTimeServerAccountEnabled.PdfSettings.Signature.TimeServerAccountId = _usedAccount.AccountId;
            _profiles.Add(_profileWithTimeServerAccountEnabled);

            _profileWithTimeServerAccountDisabled      = new ConversionProfile();
            _profileWithTimeServerAccountDisabled.Name = nameof(_profileWithTimeServerAccountDisabled);
            _profileWithTimeServerAccountDisabled.PdfSettings.Signature.Enabled             = false;
            _profileWithTimeServerAccountDisabled.PdfSettings.Signature.TimeServerAccountId = _usedAccount.AccountId;
            _profiles.Add(_profileWithTimeServerAccountDisabled);

            var settings = new PdfCreatorSettings();

            settings.ApplicationSettings.Accounts.TimeServerAccounts = _timeServerAccounts;
            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());

            _timeServerAccountRemoveCommand = new TimeServerAccountRemoveCommand(_interactionRequest, _profilesProvider, _accountsProvider, translationUpdater);
        }
Пример #3
0
        public void SetUp()
        {
            _interactionRequest       = new UnitTestInteractionRequest();
            _translation              = new TimeServerTranslation();
            _currentTimeServerAccount = new TimeServerAccount {
                UserName = "******"
            };

            _timeServerAccounts = new ObservableCollection <TimeServerAccount>();
            _timeServerAccounts.Add(_currentTimeServerAccount);

            var settings = new PdfCreatorSettings(null);

            settings.ApplicationSettings.Accounts.TimeServerAccounts = _timeServerAccounts;
            var currentSettingsProvider = Substitute.For <ICurrentSettingsProvider>();

            currentSettingsProvider.Settings.Returns(settings);

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

            _timeServerAccountEditCommand = new TimeServerAccountEditCommand(_interactionRequest, currentSettingsProvider, translationUpdater);
        }