private PrintJobViewModel CreateMockedPrintJobViewModel(IJobInfoQueue jobInfoQueue, JobInfo jobInfo, string applicationName = "PDFCreator")
        {
            var appSettings = new ApplicationSettings();
            var profiles    = new List <ConversionProfile>();

            var selectedProfile = new ConversionProfile();

            profiles.Add(selectedProfile);

            var interaction = new PrintJobInteraction(jobInfo, selectedProfile);

            var settings = new PdfCreatorSettings(MockRepository.GenerateStub <IStorage>());

            settings.ApplicationSettings = appSettings;
            settings.ConversionProfiles  = profiles;

            var settingsHelper = Substitute.For <ISettingsProvider>();

            settingsHelper.Settings.Returns(settings);

            var settingsManager = Substitute.For <ISettingsManager>();

            settingsManager.GetSettingsProvider().Returns(settingsHelper);

            var translator = new TranslationFactory();

            var userGuideHelper = Substitute.For <IUserGuideHelper>();

            var printJobViewModel = new PrintJobViewModel(settingsManager, jobInfoQueue, new PrintJobViewModelTranslation(), new DragAndDropEventHandler(MockRepository.GenerateStub <IFileConversionHandler>()), MockRepository.GenerateStub <IInteractionInvoker>(), userGuideHelper, new ApplicationNameProvider(applicationName), new InvokeImmediatelyDispatcher());

            printJobViewModel.SetInteraction(interaction);
            printJobViewModel.FinishInteraction = () => { };

            return(printJobViewModel);
        }
Beispiel #2
0
        /// <summary>
        /// Returns true if ComAdobeGraniteTranslationConnectorMsftCoreImplMicrosoftTranslProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of ComAdobeGraniteTranslationConnectorMsftCoreImplMicrosoftTranslProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ComAdobeGraniteTranslationConnectorMsftCoreImplMicrosoftTranslProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     TranslationFactory == other.TranslationFactory ||
                     TranslationFactory != null &&
                     TranslationFactory.Equals(other.TranslationFactory)
                     ) &&
                 (
                     DefaultConnectorLabel == other.DefaultConnectorLabel ||
                     DefaultConnectorLabel != null &&
                     DefaultConnectorLabel.Equals(other.DefaultConnectorLabel)
                 ) &&
                 (
                     DefaultConnectorAttribution == other.DefaultConnectorAttribution ||
                     DefaultConnectorAttribution != null &&
                     DefaultConnectorAttribution.Equals(other.DefaultConnectorAttribution)
                 ) &&
                 (
                     DefaultConnectorWorkspaceId == other.DefaultConnectorWorkspaceId ||
                     DefaultConnectorWorkspaceId != null &&
                     DefaultConnectorWorkspaceId.Equals(other.DefaultConnectorWorkspaceId)
                 ) &&
                 (
                     DefaultConnectorSubscriptionKey == other.DefaultConnectorSubscriptionKey ||
                     DefaultConnectorSubscriptionKey != null &&
                     DefaultConnectorSubscriptionKey.Equals(other.DefaultConnectorSubscriptionKey)
                 ) &&
                 (
                     LanguageMapLocation == other.LanguageMapLocation ||
                     LanguageMapLocation != null &&
                     LanguageMapLocation.Equals(other.LanguageMapLocation)
                 ) &&
                 (
                     CategoryMapLocation == other.CategoryMapLocation ||
                     CategoryMapLocation != null &&
                     CategoryMapLocation.Equals(other.CategoryMapLocation)
                 ) &&
                 (
                     RetryAttempts == other.RetryAttempts ||
                     RetryAttempts != null &&
                     RetryAttempts.Equals(other.RetryAttempts)
                 ) &&
                 (
                     TimeoutCount == other.TimeoutCount ||
                     TimeoutCount != null &&
                     TimeoutCount.Equals(other.TimeoutCount)
                 ));
        }
Beispiel #3
0
        public async Task <TranslateRequestResult> Translate(TranslateQueryDto translateData)
        {
            var translator = TranslationFactory.GetProvider(GetLogger(), GetLanguage(translateData.SourceLanguage), GetLanguage(translateData.TargetLanguage), translateData.Original, translateData.Provider);
            var result     = await translator.Request();

            result.IsExisting = (await _unitOfWork.Repository <Word>().GetFilteredAsync(w => w.Text == translateData.Original)).Any();

            return(result);
        }
Beispiel #4
0
        public void SetUp()
        {
            var translator = new TranslationFactory();

            _dateTimeProvider  = Substitute.For <IDateTimeProvider>();
            _viewCustomization = ViewCustomization.DefaultCustomization;

            _trialStartupCondition = new TrialStartupCondition(translator, _dateTimeProvider, _viewCustomization);
        }
        public ApplicationSettingsWindow(ApplicationSettingsViewModel applicationSettingsViewModel, IUserGuideHelper userGuideHelper, TranslationFactory translationFactory)
        {
            _userGuideHelper              = userGuideHelper;
            _translationFactory           = translationFactory;
            DataContext                   = applicationSettingsViewModel;
            _applicationSettingsViewModel = applicationSettingsViewModel;

            InitializeComponent();

            GeneralTabUserControl.PreviewLanguageAction = UpdateTranslations;
        }
        public TokenHintPanel()
        {
            // Initialize TokenHelper with empty Translator to avoid exception in converter
            TokenHelper = new TokenHelper(new TokenPlaceHoldersTranslation());

            InitializeComponent();

            var translation = TranslationFactory.CreateTranslation <TokenHintPanelTranslation>();

            InsecureTokenTextBlock.Text = translation.InsecureTokenText;
        }
        public void SetUp()
        {
            _profileChecker = Substitute.For <IProfileChecker>();
            var translationFactory = new TranslationFactory();

            _interactionRequest = new UnitTestInteractionRequest();
            _interactionInvoker = Substitute.For <IInteractionInvoker>();

            _interactiveProfileChecker = new InteractiveProfileChecker(_profileChecker, _interactionRequest, _interactionInvoker, translationFactory);

            _job = new Job(null, new ConversionProfile {
                Name = ProfileName
            }, null, null);
        }
Beispiel #8
0
        public MainWindowViewModel()
        {
            _translationFolder = GetTranslationFolder();

            if (_translationFolder != null)
            {
                LoadLanguages(_translationFolder);
            }

            _translationFactory = new TranslationFactory();
            _translationFactory.TranslationChanged += OnTranslationChanged;

            Language = new CultureInfo("en-US");

            SelectedTestEnum = TestEnum.FirstValue;
        }
Beispiel #9
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (TranslationFactory != null)
         {
             hashCode = hashCode * 59 + TranslationFactory.GetHashCode();
         }
         if (DefaultConnectorLabel != null)
         {
             hashCode = hashCode * 59 + DefaultConnectorLabel.GetHashCode();
         }
         if (DefaultConnectorAttribution != null)
         {
             hashCode = hashCode * 59 + DefaultConnectorAttribution.GetHashCode();
         }
         if (DefaultConnectorWorkspaceId != null)
         {
             hashCode = hashCode * 59 + DefaultConnectorWorkspaceId.GetHashCode();
         }
         if (DefaultConnectorSubscriptionKey != null)
         {
             hashCode = hashCode * 59 + DefaultConnectorSubscriptionKey.GetHashCode();
         }
         if (LanguageMapLocation != null)
         {
             hashCode = hashCode * 59 + LanguageMapLocation.GetHashCode();
         }
         if (CategoryMapLocation != null)
         {
             hashCode = hashCode * 59 + CategoryMapLocation.GetHashCode();
         }
         if (RetryAttempts != null)
         {
             hashCode = hashCode * 59 + RetryAttempts.GetHashCode();
         }
         if (TimeoutCount != null)
         {
             hashCode = hashCode * 59 + TimeoutCount.GetHashCode();
         }
         return(hashCode);
     }
 }
Beispiel #10
0
 /// <summary>
 ///     Translates a profile list by searching for predefined translations based on their GUID and apply the translated
 ///     name to them
 /// </summary>
 /// <param name="profiles">The profile list</param>
 public void TranslateProfileList(IList <ConversionProfile> profiles)
 {
     foreach (var p in profiles)
     {
         try
         {
             var translation = TranslationFactory.CreateTranslation <ProfileNameByGuidTranslation>().GetProfileGuidTranslation(p.Guid);
             if (!string.IsNullOrEmpty(translation))
             {
                 p.Name = translation;
             }
         }
         catch (ArgumentException)
         {
             //do nothing, profile must not be renamed
         }
     }
 }
Beispiel #11
0
        private void RegisterTranslator(Container container)
        {
            var registration = Lifestyle.Singleton.CreateRegistration <TranslationHelper>(container);

            container.AddRegistration(typeof(BaseTranslationHelper), registration);
            container.AddRegistration(typeof(TranslationHelper), registration);
            container.AddRegistration(typeof(ILanguageProvider), registration);
            container.AddRegistration(typeof(ITranslationHelper), registration);

            var translationFactory = new TranslationFactory();

            container.RegisterSingleton(() => translationFactory);
            var cachedTranslationFactory = new CachedTranslationFactory(translationFactory);

            registration = Lifestyle.Singleton.CreateRegistration(() => cachedTranslationFactory, container);
            container.AddRegistration(typeof(CachedTranslationFactory), registration);
            container.AddRegistration(typeof(ITranslationFactory), registration);
        }
Beispiel #12
0
        private void RegisterTranslator(Container container)
        {
            var registration = Lifestyle.Singleton.CreateRegistration <TranslationHelper>(container);

            container.AddRegistration(typeof(BaseTranslationHelper), registration);
            container.AddRegistration(typeof(TranslationHelper), registration);
            container.AddRegistration(typeof(ILanguageProvider), registration);

            var translationFactory = new TranslationFactory();

            registration = Lifestyle.Singleton.CreateRegistration(() => translationFactory, container);
            container.AddRegistration(typeof(TranslationFactory), registration);
            container.AddRegistration(typeof(ITranslationFactory), registration);

            var translatables = AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes()).Where(t => typeof(ITranslatable).IsAssignableFrom(t) && !t.IsAbstract).ToList();

            foreach (var t in translatables)
            {
                var reg = Lifestyle.Transient.CreateRegistration(t, () => translationFactory.CreateTranslation(t), container);
                container.AddRegistration(t, reg);
            }
        }
        public void SetUp()
        {
            _openFileInteractionHelper = Substitute.For <IOpenFileInteractionHelper>();
            _editionHintOptionProvider = new EditionHintOptionProvider(false, false);

            _translationFactory = new TranslationFactory();
            _translationUpdater = new TranslationUpdater(_translationFactory, new ThreadManager());

            _currentSettingsProvider = Substitute.For <ICurrentSettingsProvider>();
            _profile = new ConversionProfile();
            _currentSettingsProvider.SelectedProfile.Returns(_profile);

            var settings = new PdfCreatorSettings(null);

            _timeServerAccounts = new ObservableCollection <TimeServerAccount>();
            settings.ApplicationSettings.Accounts.TimeServerAccounts = _timeServerAccounts;
            _currentSettingsProvider.Settings.Returns(settings);
            _currentSettingsProvider.SelectedProfile.Returns(new ConversionProfile());

            _tokenHelper   = new TokenHelper(_translationUpdater);
            _tokenReplacer = _tokenHelper.TokenReplacerWithPlaceHolders;

            _commandLocator = Substitute.For <ICommandLocator>();
            _commandLocator.CreateMacroCommand().Returns(x => new MacroCommandBuilder(_commandLocator));

            _timeServerAddCommand = Substitute.For <ICommand>();
            _commandLocator.GetCommand <TimeServerAccountAddCommand>().Returns(_timeServerAddCommand);

            _timeServerEditCommand = Substitute.For <ICommand>();
            _commandLocator.GetCommand <TimeServerAccountEditCommand>().Returns(_timeServerEditCommand);

            _signaturePasswordCheck = Substitute.For <ISignaturePasswordCheck>();

            _file = Substitute.For <IFile>();

            InitViewModel();
        }
Beispiel #14
0
 public void Setup()
 {
     _profile            = new ConversionProfile();
     _translationFactory = new TranslationFactory();
 }
Beispiel #15
0
 public TranslationFactoryTest()
 {
     _catalog            = new Catalog();
     _translationFactory = new TranslationFactory(new GettextTranslationSource(_catalog));
     _defaultTranslation = new TestTranslation();
 }
Beispiel #16
0
 public CachedTranslationFactoryTest()
 {
     _translationFactory       = new TranslationFactory(new GettextTranslationSource(new Catalog()));
     _cachedTranslationFactory = new CachedTranslationFactory(_translationFactory);
 }
Beispiel #17
0
 public TranslationHelper(ISettingsProvider settingsProvider, IAssemblyHelper assemblyHelper, TranslationFactory translationFactory, IGpoSettings gpoSettings) : base(assemblyHelper, translationFactory)
 {
     _gpoSettings = gpoSettings;
     settingsProvider.LanguageChanged += SettingsProviderOnLanguageChanged;
 }
Beispiel #18
0
 public PlayerInput(KeyboardAdvanced keyboard, int playerID, int playerIndex) : base(keyboard)
 {
     Translation = TranslationFactory.GetTranslationForPlayerIndex(playerIndex);
     ID          = playerID;
 }
Beispiel #19
0
 // ReSharper disable once MemberCanBeProtected.Global
 public BaseTranslationHelper(IAssemblyHelper assemblyHelper, TranslationFactory translationFactory)
 {
     _assemblyHelper    = assemblyHelper;
     TranslationFactory = translationFactory;
 }
Beispiel #20
0
        public TranslationHelper(ISettingsProvider settingsProvider, IAssemblyHelper assemblyHelper, TranslationFactory translationFactory) : base(assemblyHelper, translationFactory)
        {
            _settingsProvider = settingsProvider;

            _settingsProvider.LanguageChanged += SettingsProviderOnLanguageChanged;
        }