Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommonServices" /> class.
 /// </summary>
 /// <param name="busyService">The busy indicator service.</param>
 /// <param name="messageService">The messaging service</param>
 /// <param name="languageService">The language service.</param>
 /// <param name="telemetryService">The telemetry service.</param>
 /// <param name="dialogService">The dialog service.</param>
 /// <param name="navigationService">The navigation service.</param>
 /// <param name="fileService">The file service.</param>
 /// <param name="infoService">The information service.</param>
 /// <param name="converterService">The converter service.</param>
 /// <param name="dispatcherService">The dispatcher service.</param>
 /// <param name="authenticationService">The authentication service.</param>
 public CommonServices(
     IBusyService busyService,
     IMessageService messageService,
     ILanguageService languageService,
     ITelemetryService telemetryService,
     IDialogService dialogService,
     INavigationService navigationService,
     IFileService fileService,
     IInfoService infoService,
     IConverterService converterService,
     IDispatcherService dispatcherService,
     IAuthenticationService authenticationService)
     : base(busyService,
            messageService,
            languageService,
            telemetryService,
            dialogService,
            navigationService,
            infoService,
            converterService,
            dispatcherService)
 {
     AuthenticationService = authenticationService;
     FileService           = fileService;
 }
Esempio n. 2
0
 public ConversionController(IConverterService converterService, IHttpContextAccessor httpContextAccessor)
 {
     Converter       = converterService;
     ContextAccessor = httpContextAccessor;
     RequestUser     = ContextAccessor.HttpContext != null && ContextAccessor.HttpContext.User.Identity.IsAuthenticated ?
                       ContextAccessor.HttpContext.User.Identity.Name : "Unauthenticated";
 }
Esempio n. 3
0
        public HomeController(ITranslator translator, IConverterService conserterService)
        {
            _englishTranslator = translator ?? throw new  ArgumentNullException("translator == null");
            _conserterService  = conserterService ?? throw new  ArgumentNullException("conserterService == null");

            _conserterService.Translator = _englishTranslator;
        }
Esempio n. 4
0
        public void Setup()
        {
            var mockConfig = new Mock <IAppConfiguration>();

            mockConfig.Setup <string>(p => p.GetString("AppConfig:Conversions")).Returns("[{ 'FromUnit': 'Centimeter', 'ToUnit': 'Inch', 'Rate': 0.4, 'Type': 'Length'}, { 'FromUnit': 'Inch', 'ToUnit': 'Centimeter', 'Rate': 2.4, 'Type': 'Length'}, { 'FromUnit': 'Fahrenheit', 'ToUnit': 'Celcius', 'Formula': 'MetricConverter.Library.PluginFormulas.FahrenheitFormulaService|FromFahrenheitToCelcius', 'Type': 'Temperature'}, { 'FromUnit': 'Celcius', 'ToUnit': 'Fahrenheit', 'Formula': 'MetricConverter.Library.PluginFormulas.FahrenheitFormulaService|FromCelciusToFahrenheit', 'Type': 'Temperature'}]");
            service = new ConverterService(mockConfig.Object);
        }
Esempio n. 5
0
        public void HomePageLoadsEveryConversionRatio()
        {
            // Arrange
            var fooRatio = new CurrencyConversionRatio()
            {
                OriginalCurrency = "GBP", TargetCurrency = "FOO", Ratio = 0.10
            };
            var barRatio = new CurrencyConversionRatio()
            {
                OriginalCurrency = "GBP", TargetCurrency = "BAR", Ratio = 20.00
            };
            var fakeRatios = new List <CurrencyConversionRatio>
            {
                fooRatio,
                barRatio
            };

            _repository.Setup(x => x.GetConversionRatios()).Returns(fakeRatios);
            _service = new ConverterService(_repository.Object);
            var controller = new ConverterController(_service);

            // Act
            ViewResult result = controller.Index() as ViewResult;

            // Assert
            Assert.That(result.ViewData.Model, Is.InstanceOf(typeof(List <CurrencyConversionRatio>)));
            var ratioList = result.ViewData.Model as List <CurrencyConversionRatio>;

            Assert.That(ratioList.Count, Is.EqualTo(2));
            Assert.That(ratioList.Contains(fooRatio), Is.True);
            Assert.That(ratioList.Contains(barRatio), Is.True);
        }
Esempio n. 6
0
 public ProviderPlugin(ShippoSettings ShippoSettings, IConverterService converterService,
                       IStateOrProvinceService stateProvinceService)
 {
     _shippoSettings       = ShippoSettings;
     _converterService     = converterService;
     _stateProvinceService = stateProvinceService;
 }
Esempio n. 7
0
 /// <summary>
 /// Initialises a new instance of the <c>MainWindowViewModel</c> class.
 /// </summary>
 /// <param name="converter"><c>ConverterService</c> instance.</param>
 public MainWindowViewModel(IConverterService converter)
 {
     if (converter == null)
     {
         throw new ArgumentNullException("converter");
     }
     this._converter = converter;
 }
Esempio n. 8
0
        public Workspace(WorkspaceSettings settings, IFileSystem fileSystem, IConverterService converterService)
        {
            FileSystem       = fileSystem;
            Settings         = settings;
            ConverterService = converterService;

            debouncedChange = UIUtility.Debounce(ExecuteChanges, 1000);
        }
        public TemplatesController(IRepository <Template> templatesRepository, IRepository <FormTemplate> formTemplatesRepository, IHostingEnvironment hostingEnvironment, IConverterService converterService)
        {
            _templatesRepository = templatesRepository;

            _formTemplatesRepository = formTemplatesRepository;

            _hostingEnvironment = hostingEnvironment;

            _converterService = converterService;
        }
Esempio n. 10
0
        public ConsumeRabbitMqService(ILogger <ConsumeRabbitMqService> logger, CacheService cacheService,
                                      ITelegramBotService telegramBotService, IConverterService converterService, IGiphyService giphyService)
        {
            _logger             = logger;
            _cacheService       = cacheService;
            _telegramBotService = telegramBotService;
            _converterService   = converterService;
            _giphyService       = giphyService;

            InitRabbitMq();
        }
Esempio n. 11
0
 public SheduleService(IMapper mapper,
                       IDbContextFactory contextFactory,
                       IEMailService eMailService,
                       IConverterService converterService, IUserService userService)
 {
     _eJContext        = contextFactory.CreateReadonlyDbContext <EJContext>();
     _eMailService     = eMailService;
     _converterService = converterService;
     _userService      = userService;
     Mapper            = mapper;
 }
Esempio n. 12
0
        /// <summary>
        /// Initialises a new instance of the <c>MainWindow</c> class.
        /// </summary>
        /// <param name="converter"><c>ConverterService</c> instance.</param>
        public MainWindow(IConverterService converter)
        {
            InitializeComponent();

            if (converter == null)
            {
                throw new ArgumentNullException("converter");
            }
            this._converter = converter;

            this._vm = new MainWindowViewModel();

            this.DataContext = this._vm;
        }
Esempio n. 13
0
 public ContractManager(IJSRuntime jsRuntime, HttpClient httpClient,
                        IConverterService converterService, IContractStorage contractStorage,
                        SaveManager saveManager, IDataModelManager dataModelManager, IUserModelManager userModelManager,
                        IProcessModelManager processModelManager)
 {
     _jsRuntime           = jsRuntime;
     _converterService    = converterService;
     _httpClient          = httpClient;
     _contractStorage     = contractStorage;
     _saveManager         = saveManager;
     _dataModelManager    = dataModelManager;
     _userModelManager    = userModelManager;
     _processModelManager = processModelManager;
 }
Esempio n. 14
0
        public ApplicationForm(IRecorderService recorderService,
                               IConverterService converterService,
                               IEncryptionService encryptionService)
        {
            if (recorderService == null)
            {
                throw new ArgumentException("recorderService");
            }
            if (converterService == null)
            {
                throw new ArgumentException("converterService");
            }
            if (encryptionService == null)
            {
                throw new ArgumentException("encryptionService");
            }

            _recorderService   = recorderService;
            _converterService  = converterService;
            _encryptionService = encryptionService;

            AppParameters = new Parameters {
                TemporaryFolder = ApplicationConfiguration.TemporaryFolder.GetProgramDataSubFolder()
            };

            InitializeComponent();

            _devices = new Dictionary <string, Device>();

            MMDeviceEnumerator enumerator = new MMDeviceEnumerator();

            foreach (MMDevice device in enumerator.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.Active))
            {
                _devices.Add(device.ID, new Device(device.ID, device.FriendlyName, false));
            }

            MMDevice loopbackDevice = WasapiLoopbackCapture.GetDefaultLoopbackCaptureDevice();

            _devices.Add(loopbackDevice.ID, new Device(loopbackDevice.ID, string.Format("Windows mixed output - {0}", loopbackDevice.FriendlyName), true));

            _devices.ForEach(device => cb_soundcard.Items.Add(new ComboboxItem {
                Text = device.Value.ProductName, Value = device.Key
            }));

            LoadConfiguration();
        }
Esempio n. 15
0
 public AcmeController(
     IDirectoryService directoryService,
     INonceService nonceService,
     IAccountService accountService,
     IOrderService orderService,
     IChallengeService challengeService,
     IAuthorizationService authorizationService,
     IConverterService converterService,
     IOptions <ServerOptions> options)
 {
     DirectoryService     = directoryService ?? throw new ArgumentNullException(nameof(directoryService));
     NonceService         = nonceService ?? throw new ArgumentNullException(nameof(nonceService));
     AccountService       = accountService ?? throw new ArgumentNullException(nameof(accountService));
     OrderService         = orderService ?? throw new ArgumentNullException(nameof(orderService));
     ChallengeService     = challengeService ?? throw new ArgumentNullException(nameof(challengeService));
     AuthorizationService = authorizationService ?? throw new ArgumentNullException(nameof(authorizationService));
     ConverterService     = converterService ?? throw new ArgumentNullException(nameof(converterService));
     Options = options?.Value ?? throw new ArgumentNullException(nameof(options));
 }
Esempio n. 16
0
        public ApplicationForm(IRecorderService recorderService,
                               IConverterService converterService,
                               IEncryptionService encryptionService)
        {
            if (recorderService == null)
            {
                throw new ArgumentException("recorderService");
            }
            if (converterService == null)
            {
                throw new ArgumentException("converterService");
            }
            if (encryptionService == null)
            {
                throw new ArgumentException("encryptionService");
            }

            _recorderService   = recorderService;
            _converterService  = converterService;
            _encryptionService = encryptionService;

            AppParameters = new Parameters {
                TemporaryFolder = ApplicationConfiguration.TemporaryFolder.GetProgramDataSubFolder()
            };

            InitializeComponent();

            _devices = new Dictionary <int, Device>();
            var deviceCount = WaveIn.DeviceCount;

            for (var deviceId = 0; deviceId < deviceCount; deviceId++)
            {
                _devices.Add(deviceId, new Device(WaveIn.GetCapabilities(deviceId), deviceId));
            }
            _devices.Add(deviceCount + 1, new Device {
                ProductName = "Windows mixed output", DeviceId = int.MaxValue
            });
            _devices.ForEach(device => cb_soundcard.Items.Add(new ComboboxItem {
                Text = device.Value.ProductName, Value = device.Key
            }));

            LoadConfiguration();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseCommonService"/> class.
 /// </summary>
 /// <param name="busyService">The busy.</param>
 /// <param name="messageService"></param>
 /// <param name="languageService">The language.</param>
 /// <param name="telemetryService">The telemetry.</param>
 /// <param name="dialogService">The dialog.</param>
 /// <param name="navigationService">The navigation.</param>
 /// <param name="infoService">The information.</param>
 /// <param name="converterService">The converter.</param>
 /// <param name="dispatcherService"></param>
 protected BaseCommonService(
     IBusyService busyService,
     IMessageService messageService,
     ILanguageService languageService,
     ITelemetryService telemetryService,
     IDialogService dialogService,
     INavigationService navigationService,
     IInfoService infoService,
     IConverterService converterService,
     IDispatcherService dispatcherService)
 {
     BusyService       = busyService;
     MessageService    = messageService;
     LanguageService   = languageService;
     TelemetryService  = telemetryService;
     DialogService     = dialogService;
     NavigationService = navigationService;
     InfoService       = infoService;
     ConverterService  = converterService;
     DispatcherService = dispatcherService;
 }
Esempio n. 18
0
        public void ConvertCorrectlyCalculates(double amountToConvert, string originalCurrency, string targetCurrency, double convertedAmount)
        {
            // Arrange
            var fakeRatios = new List <CurrencyConversionRatio>
            {
                new CurrencyConversionRatio()
                {
                    OriginalCurrency = "GBP", TargetCurrency = "FOO", Ratio = 0.10
                },
                new CurrencyConversionRatio()
                {
                    OriginalCurrency = "GBP", TargetCurrency = "BAR", Ratio = 20.00
                }
            };

            _repository.Setup(x => x.GetConversionRatios()).Returns(fakeRatios);
            _service = new ConverterService(_repository.Object);

            // Act
            var result = _service.Convert(amountToConvert, originalCurrency, targetCurrency);

            // Assert
            Assert.That(result, Is.EqualTo(convertedAmount));
        }
        /// <summary>
        /// Initialises a new instance of the <c>MailWindow</c> class.
        /// </summary>
        /// <param name="settings"><c>TextEncodingConverterSettings</c> instance.</param>
        /// <param name="conveter"><c>ConverterService</c> instance.</param>
        /// <param name="vm"><c>MainWindowViewModel</c> instance.</param>
        public MainWindow(ITextEncodingConverterSettings settings, IConverterService conveter, MainWindowViewModel vm)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            this._settings = settings;

            if (conveter == null)
            {
                throw new ArgumentNullException("conveter");
            }
            this._converter = conveter;

            if (vm == null)
            {
                throw new ArgumentNullException("vm");
            }
            this._vm = vm;

            InitializeComponent();

            this.DataContext = this._vm;
        }
Esempio n. 20
0
 public ConverterController(IConverterService service)
 => _service = service;
 public void Init()
 {
     this._parameterService = Substitute.For<IParameterService>();
     this._converterService = new ConverterService(this._parameterService);
 }
 public ConverterController(IConverterService converterService)
 {
     _converterService = converterService;
 }
Esempio n. 23
0
        public ActionService(IRepository <WorkflowAssociation> workflowAssociationsRepository, IRepository <Template> templatesRepository, IEmailService emailService, IConverterService converterService, IStorageService storageService, IRepository <FormTemplate> formTemplateRepository)
        {
            _workflowAssociationsRepository = workflowAssociationsRepository;

            _templatesRepository = templatesRepository;


            _emailService = emailService;

            _converterService = converterService;

            _storageService = storageService;

            _formTemplateRepository = formTemplateRepository;


            _asyncActions.Add(nameof(LoadTemplate), LoadTemplate);

            _asyncActions.Add(nameof(TemplateToPdf), TemplateToPdf);

            _asyncActions.Add(nameof(SendEmail), SendEmail);

            _asyncActions.Add(nameof(AmazonS3UploadFile), AmazonS3UploadFile);

            _asyncActions.Add(nameof(GetEntity), GetEntity);

            _asyncActions.Add(nameof(OnErrorSendEmail), OnErrorSendEmail);

            _asyncActions.Add(nameof(ApiRequestAsync), ApiRequestAsync);

            _asyncActions.Add(nameof(LoadFormTemplatePath), LoadFormTemplatePath);



            _actions.Add(nameof(Start), Start);

            _actions.Add(nameof(End), End);

            _actions.Add(nameof(FillTemplate), FillTemplate);

            _actions.Add(nameof(SetAttribute), SetAttribute);

            _actions.Add(nameof(FillPdfForm), FillPdfForm);

            _actions.Add(nameof(ApiRequest), ApiRequest);

            _actions.Add(nameof(SetEntityAttribute), SetEntityAttribute);

            _actions.Add(nameof(UpdateEntityAttribute), UpdateEntityAttribute);

            _actions.Add(nameof(RemoveEntityAttribute), RemoveEntityAttribute);

            _actions.Add(nameof(SetUserRoles), SetUserRoles);

            _actions.Add(nameof(RemoveUserRoles), RemoveUserRoles);

            _actions.Add(nameof(UpdateUserRoles), UpdateUserRoles);


            _conditions.Add(nameof(IsAnyErrorOccurred), IsAnyErrorOccurred);

            _conditions.Add(nameof(IsCurrentErrorOccurred), IsCurrentErrorOccurred);

            _conditions.Add(nameof(IsUserCertified), IsUserCertified);
        }
Esempio n. 24
0
 public ConvertController(IConverterService converterService, ICommandLineParser commandLineParser)
 {
     _converterService  = converterService;
     _commandLineParser = commandLineParser;
 }
Esempio n. 25
0
        public static async Task <IWorkspace> Create(string path, IFileSystem fileSystem, IConverterService converterService)
        {
            if (fileSystem == null)
            {
                throw new ArgumentNullException(nameof(fileSystem));
            }
            if (!fileSystem.Directory.Exists(path))
            {
                throw new ArgumentException("Path does not exist in specified file system: " + (path ?? "<null>"));
            }

            var settings  = WorkspaceSettings.Create(fileSystem, path);
            var workspace = new Workspace(settings, fileSystem, converterService);

            workspace.Handlers.Add(new FileWorkspaceItemHandler());
            //if (!string.IsNullOrEmpty(settings.Sync))
            //{
            //    var user = AppViewModel.Instance.User;
            //    if (user.EnsureLoggedIn())
            //    {
            //        var webHandler = new WebWorkspaceItemHandler(user.Data);
            //        workspace.Handlers.Add(webHandler);
            //    }
            //}

            await workspace.Initialize();

            return(workspace);
        }
Esempio n. 26
0
 public ConverterController(IConverterService converterService)
 {
     this.convertService = converterService;
 }
 public ConverterController(ILogger <ConverterController> logger,
                            IConverterService converterService)
 {
     _converterService = converterService;
     _logger           = logger;
 }
Esempio n. 28
0
 public UnitTests()
 {
     _service = new ConverterService();
 }
 public ConverterController()
 {
     _converterService = new ConverterService(new ConverterRepository());
 }
Esempio n. 30
0
 public UPSProviderPlugin(UPSSettings upsSettings, IConverterService converterService)
 {
     _upsSettings      = upsSettings;
     _converterService = converterService;
 }
 public AppliancesDistribution(IRepository <Product> productContext, IDataSerialization serializer, ICacheable cacheProvider, IConverterService converterProvider, IUnitOfWork unitOfWork)
 {
     _productRepository = productContext ?? throw new ArgumentNullException(nameof(productContext));
     _dataSerializer    = serializer ?? throw new ArgumentNullException(nameof(serializer));
     _cache             = cacheProvider ?? throw new ArgumentNullException(nameof(cacheProvider));
     converterProvider.GetExchengesRateAsync(new CancellationToken());
     _cache.SetInstance(_productRepository.GetAll().ToList());
     _unitOfWork = unitOfWork;
 }
Esempio n. 32
0
 public SearchService(IConverterService converterService, IRepository repository)
 {
     _converterService = converterService;
     _repository       = repository;
 }