Exemple #1
0
 public MailingService(IMailingRepository repository, IControlEventRepository eventRepository,
                       ITextRepository textRepository)
 {
     _repository      = repository;
     _eventRepository = eventRepository;
     _textRepository  = textRepository;
 }
Exemple #2
0
        private HttpClient CreateTestHttpClient(ITextRepository textRepository)
        {
            // No setup required for these services. They are not in use by the ApplicationController
            Mock <ISasTokenProvider>           sasTokenProvider = new Mock <ISasTokenProvider>();
            Mock <IKeyVaultClientWrapper>      keyVaultWrapper  = new Mock <IKeyVaultClientWrapper>();
            Mock <IPartiesWithInstancesClient> partiesWrapper   = new Mock <IPartiesWithInstancesClient>();

            HttpClient client = _factory.WithWebHostBuilder(builder =>
            {
                builder.ConfigureTestServices(services =>
                {
                    services.AddMockRepositories();

                    services.AddSingleton(textRepository);

                    services.AddSingleton(sasTokenProvider.Object);
                    services.AddSingleton(keyVaultWrapper.Object);
                    services.AddSingleton(partiesWrapper.Object);
                    services.AddSingleton <IPDP, PepWithPDPAuthorizationMockSI>();
                    services.AddSingleton <IPostConfigureOptions <JwtCookieOptions>, JwtCookiePostConfigureOptionsStub>();
                });
            }).CreateClient();

            string token = PrincipalUtil.GetAccessToken("studio.designer");

            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

            return(client);
        }
Exemple #3
0
 public TextService(
     ITextRepository textRepository,
     IHttpClientFactory httpClientFactory)
 {
     _textRepository    = textRepository;
     _httpClientFactory = httpClientFactory;
 }
 public EfCoreUnitOfWork(WhoIsFasterDbContext context)
 {
     Context = context;
     RegularUserRepository = new RegularUserRepository(context);
     RoomRepository        = new RoomRepository(context);
     TextRepository        = new TextRepository(context);
 }
Exemple #5
0
 public PostService(IPostRepository postRepository, ITextRepository textRepository, IPictureRepository pictureRepository, IAzureStorageService azureStorageService)
 {
     _postRepository      = postRepository;
     _textRepository      = textRepository;
     _pictureRepository   = pictureRepository;
     _azureStorageService = azureStorageService;
 }
Exemple #6
0
 public TypingSessionsController(
     ITypingSessionRepository typingSessionRepository,
     ITextRepository textRepository)
 {
     _typingSessionRepository = typingSessionRepository;
     _textRepository          = textRepository;
 }
        public void SetUp()
        {
            da = new Language();
            da.Id = 1;
            da.LanguageCode = "DA";
            da.Name = "Dansk";

            en = new Language();
            en.Id = 2;
            en.LanguageCode = "EN";
            en.Name = "English";

            texts = new[] {
                new Text{Language = da,TextId = "TextId1",Value = "Text1Da"},
                new Text{Language = en,TextId = "TextId1",Value = "Text1En"},
                new Text{Language = da,TextId = "TextId2",Value = "Text2Da"},
            };

            textRepository = MockRepository.GenerateStub<ITextRepository>();
            textRepository.Stub(t => t.Query).Return(texts.AsQueryable());

            var sessionProvider = MockRepository.GenerateStub<ISessionProvider>();
            sessionProvider.Stub(sp => sp.GetSession()).Return(MockRepository.GenerateStub<IDisposable>());

            textService = new TextService(textRepository,sessionProvider);
        }
Exemple #8
0
 public LocalizationCacheInitialize(
     IDistributedCache <LocalizationCacheItem> cache,
     ITextRepository textRepository)
 {
     Cache          = cache;
     TextRepository = textRepository;
 }
Exemple #9
0
        public void SetUp()
        {
            da              = new Language();
            da.Id           = 1;
            da.LanguageCode = "DA";
            da.Name         = "Dansk";

            en              = new Language();
            en.Id           = 2;
            en.LanguageCode = "EN";
            en.Name         = "English";

            texts = new[] {
                new Text {
                    Language = da, TextId = "TextId1", Value = "Text1Da"
                },
                new Text {
                    Language = en, TextId = "TextId1", Value = "Text1En"
                },
                new Text {
                    Language = da, TextId = "TextId2", Value = "Text2Da"
                },
            };

            textRepository = MockRepository.GenerateStub <ITextRepository>();
            textRepository.Stub(t => t.Query).Return(texts.AsQueryable());

            var sessionProvider = MockRepository.GenerateStub <ISessionProvider>();

            sessionProvider.Stub(sp => sp.GetSession()).Return(MockRepository.GenerateStub <IDisposable>());

            textService = new TextService(textRepository, sessionProvider);
        }
Exemple #10
0
        internal Collection(string tag, ITextRepository textRepository, ITextConverter textConverter)
        {
            ValidateCollectionName(tag);

            this.tag            = tag;
            this.textRepository = textRepository;
            TextConverter       = textConverter;
        }
        public GetWelcomeText()
        {
            var mapper = A.Fake <IMapper>();

            repository = new TextRepository(mapper);

            A.CallTo(() => mapper.Map <TextEntity>(A <TextData> ._))
            .Returns(new TextEntity("TEST"));
        }
        public IncludeTextProcessor(ITextRepository textRepository)
        {
            if (textRepository == null)
            {
                throw new ArgumentNullException("textRepository");
            }

            this._textRepository = textRepository;
        }
Exemple #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReaderBusinessLogic"/> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="sharedLocalizer">The shared localizer.</param>
 public ReaderBusinessLogic(ILogger <ReaderBusinessLogic> logger, ISharedLocalizer sharedLocalizer, IMapper mapper, ICalculationService calculationService, ITextRepository textRepository)
     : base(logger, sharedLocalizer)
 {
     _logger             = logger;
     _sharedLocalizer    = sharedLocalizer;
     _mapper             = mapper;
     _calculationService = calculationService;
     _textRepository     = textRepository;
 }
Exemple #14
0
        public GetWelcomeText()
        {
            var mapper = A.Fake <IMapper>();

            repository = new TextRepository(mapper);

            A.CallTo(() => mapper.Map <TextEntity>(A <TextData> .That.Matches(td => td.Text == "Hello World!")))
            .Returns(new TextEntity("Hello World!"));
        }
 public LocalizationStore(
     ILanguageRepository languageRepository,
     ITextRepository textRepository,
     IResourceRepository resourceRepository)
 {
     TextRepository     = textRepository;
     LanguageRepository = languageRepository;
     ResourceRepository = resourceRepository;
 }
Exemple #16
0
        public TextAppService(ITextRepository repository) : base(repository)
        {
            _textRepository = repository;

            GetPolicyName     = LocalizationManagementPermissions.Text.Default;
            GetListPolicyName = LocalizationManagementPermissions.Text.Default;
            CreatePolicyName  = LocalizationManagementPermissions.Text.Create;
            UpdatePolicyName  = LocalizationManagementPermissions.Text.Update;
            DeletePolicyName  = LocalizationManagementPermissions.Text.Delete;
        }
 public ActionsViewModel(ITextRepository repo)
 {
     _repo             = repo;
     IsCalculated      = false;
     IsMerged          = false;
     HasEmployees      = _repo.Count() != 0;
     CalculateCommand  = new RelayCommand(OnCalculate);
     MergeFilesCommand = new RelayCommand(OnMergeFiles);
     Messenger.Default.Register <UpdateMergeButtonMessage>(this, OnUpdateMergeButtonMessageReceived);
 }
Exemple #18
0
 public ContentController(ITextRepository textRepository,
                          ILogger <ContentController> logger, IMemoryCache memoryCache, IMapper mapper,
                          IContentRepository contentRepository, IOptions <ContentOptions> options)
 {
     _textRepository    = textRepository;
     _logger            = logger;
     _memoryCache       = memoryCache;
     _mapper            = mapper;
     _contentRepository = contentRepository;
     _options           = options;
 }
 public InterestingTextList(PropertyTable propertyTable, ITextRepository repo,
                            IStTextRepository stTextRepo, bool includeScripture)
 {
     m_textRepository   = repo;
     m_propertyTable    = propertyTable;
     m_stTextRepository = stTextRepo;
     CoreTexts          = GetCoreTexts();
     m_scriptureTexts   = GetScriptureTexts();
     IncludeScripture   = includeScripture;
     GetCache();
 }
		public InterestingTextList(PropertyTable propertyTable, ITextRepository repo,
			IStTextRepository stTextRepo, bool includeScripture)
		{
			m_textRepository = repo;
			m_propertyTable = propertyTable;
			m_stTextRepository = stTextRepo;
			CoreTexts = GetCoreTexts();
			m_scriptureTexts = GetScriptureTexts();
			IncludeScripture = includeScripture;
			GetCache();
		}
 public TextsController(
     ITextRepository textRepository,
     ITypingReportGenerator typingReportGenerator,
     ITextsClient textsClient,
     ILogger <TextsController> logger)
 {
     _textRepository        = textRepository;
     _typingReportGerenator = typingReportGenerator;
     _textsClient           = textsClient;
     _logger = logger;
 }
 public TypingResultProcessor(
     ITextTypingResultValidator textTypingResultValidator,
     IUserSessionRepository userSessionRepository,
     ITypingSessionRepository typingSessionRepository,
     ITextRepository textRepository)
 {
     _textTypingResultValidator = textTypingResultValidator;
     _userSessionRepository     = userSessionRepository;
     _typingSessionRepository   = typingSessionRepository;
     _textRepository            = textRepository;
 }
Exemple #23
0
        public void TestSetUp()
        {
            _cityRepository  = new CityRepository(_dbConnStr);
            _textRepository  = new TextRepository(_dbConnStr);
            _apiService      = new ApiService();
            _locationService = new LocationService(_cityRepository, _apiService);
            _textService     = new TextService(_cityRepository, _textRepository, _locationService);

            _textController               = new TextController(_textService);
            _textController.Request       = new HttpRequestMessage();
            _textController.Configuration = new HttpConfiguration();
        }
Exemple #24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MessageBoxInstancesController"/> class
 /// </summary>
 /// <param name="instanceRepository">the instance repository handler</param>
 /// <param name="instanceEventRepository">the instance event repository service</param>
 /// <param name="textRepository">the text repository handler</param>
 /// <param name="pdp">the policy decision point</param>
 /// <param name="logger">The logger to be used to perform logging from the controller.</param>
 public MessageBoxInstancesController(
     IInstanceRepository instanceRepository,
     IInstanceEventRepository instanceEventRepository,
     ITextRepository textRepository,
     IPDP pdp,
     ILogger <AuthorizationHelper> logger)
 {
     _instanceRepository      = instanceRepository;
     _instanceEventRepository = instanceEventRepository;
     _textRepository          = textRepository;
     _authorizationHelper     = new AuthorizationHelper(pdp, logger);
 }
Exemple #25
0
 public TypingReportGenerator(
     IUserSessionRepository userSessionRepository,
     ITypingSessionRepository typingSessionRepository,
     ITextTypingResultValidator textTypingResultValidator,
     IUserTypingStatisticsStore userTypingStatisticsStore,
     ITextRepository textRepository)
 {
     _userSessionRepository     = userSessionRepository;
     _typingSessionRepository   = typingSessionRepository;
     _textTypingResultValidator = textTypingResultValidator;
     _userTypingStatisticsStore = userTypingStatisticsStore;
     _textRepository            = textRepository;
 }
Exemple #26
0
        public FileAccess(ITextRepository textRepository, ITextService textService)
        {
            if (textRepository == null)
            {
                throw new ArgumentNullException(nameof(textRepository));
            }

            if (textService == null)
            {
                throw new ArgumentNullException(nameof(textService));
            }

            this.textRepository = textRepository;
            this.textService    = textService;
        }
Exemple #27
0
        public void SaveTextRepository(ITextRepository <Dictionary <string, string> > textRepository)
        {
            // After, run all the translations, and add
            foreach (KeyValuePair <string, string> _idiomTranslation in textRepository.translations())
            {
                var sqlCommand = new SqlCommand("INSERT INTO TEXT_TRANSLATIONS(DOM_ELEMENT_ID, IDIOM, TRANSLATION) VALUES(@DOM_ELEMENT_ID, @IDIOM, @TRANSLATION)");

                // Set parameters
                sqlCommand.Parameters.AddWithValue("DOM_ELEMENT_ID", textRepository.DOMElementID);
                sqlCommand.Parameters.AddWithValue("IDIOM", _idiomTranslation.Key);
                sqlCommand.Parameters.AddWithValue("TRANSLATION", _idiomTranslation.Value);

                SQLOperation.ExecuteSQLCommand(sqlCommand);
            }
        }
Exemple #28
0
 public CacheTestController(ISoundRepository sr,
                            IRawSoundRepository rsr,
                            ITextRepository tr,
                            IRawTextRepository rtr,
                            IImageRepository ir,
                            IRawImageRepository rir,
                            IVideoRepository vr)
 {
     _sr  = sr;
     _rsr = rsr;
     _tr  = tr;
     _rtr = rtr;
     _ir  = ir;
     _rir = rir;
     _vr  = vr;
 }
Exemple #29
0
 public bool Save(ITextRepository textRepository, string filepath)
 {
     try
     {
         using (System.IO.StreamWriter file =
                    new System.IO.StreamWriter(filepath))
         {
             foreach (var myText in textRepository.Get())
             {
                 file.WriteLine(myText.Name);
             }
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #30
0
        public TextService(ICityRepository cityRepository, ITextRepository textRepository, ILocationService locationService)
        {
            if (cityRepository == null)
            {
                throw new ArgumentNullException("cityRepository");
            }
            if (textRepository == null)
            {
                throw new ArgumentNullException("textRepository");
            }
            if (locationService == null)
            {
                throw new ArgumentNullException("locationService");
            }

            _cityRepository  = cityRepository;
            _textRepository  = textRepository;
            _locationService = locationService;
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Press enter key to start.....");
            var keyinfo = Console.ReadKey();

            if (keyinfo.Key.Equals(ConsoleKey.Enter))
            {
                Console.WriteLine("Give number of text classes you want to create");
                int numberOfTexts;
                int.TryParse(Console.ReadLine(), out numberOfTexts);
                if (numberOfTexts == 0)
                {
                    Console.WriteLine("Should be more than 0....press any key to exit");
                    System.Console.ReadKey();
                }
                else
                {
                    var listOfTexts = CreateTexts(numberOfTexts);
                    textRepository = new TextRepository(listOfTexts);
                    Console.WriteLine("Give path to save the file....full qulified path with file name");
                    var filePath   = Console.ReadLine();
                    var fileAccess = new FileAccess(textRepository, textService);
                    fileAccess.Save(filePath);

                    //Now all the name will show line by line

                    var texts = fileAccess.Get(filePath);
                    foreach (var text in texts)
                    {
                        // Use a tab to indent each line of the file.
                        Console.WriteLine("\t" + text.Name);
                    }

                    Console.WriteLine("Press any key to exit");
                    System.Console.ReadKey();
                    //if (Console.KeyAvailable)
                    //{
                    //	Environment.Exit(0);
                    //}
                }
            }
        }
Exemple #32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TextsController"/> class.
 /// </summary>
 /// <param name="textRepository">the text repository handler</param>
 /// <param name="logger">dependency injection of logger</param>
 public TextsController(ITextRepository textRepository, ILogger <TextsController> logger)
 {
     _textRepository = textRepository;
     _logger         = logger;
 }
		public InterestingTextList(PropertyTable propertyTable, ITextRepository repo, IStTextRepository stTextRepo)
			: this(propertyTable, repo, stTextRepo, true)
		{
		}
        public TextServices(ITextRepository textRepository)
        {
            if (textRepository == null) throw new ArgumentNullException(nameof(textRepository));

            _textRepository = textRepository;
        }
 public TextService(ITextRepository textRepository, ISessionProvider sessionProvider)
 {
     this.textRepository = textRepository;
     this.sessionProvider = sessionProvider;
 }