Ejemplo n.º 1
0
        public void Test_PeopleSetting_From_Cache_Need_AddItem()
        {
            var baseUrl       = "http://localhost/";
            var connectionStr = "fake_connection_string";
            List <PeopleSettings> lsSettings = new List <PeopleSettings>();

            lsSettings.Add(new PeopleSettings()
            {
                SelectGroups = "1234", ExcludedUser = "******", HiddenAttributres = "dks,da", serverId = 1
            });
            var retSettings = lsSettings.AsEnumerable();

            mockCacheProvider = new Mock <ICacheProvider>();
            mockCacheProvider.Setup(p => p.TryGetValue <IEnumerable <PeopleSettings> >("CMAPeopleSetting_localhost", out retSettings)).Returns(true);

            mockPeopleSettingsRepository = new Mock <IPeopleSettingsRepository>();
            mockPeopleSettingsRepository.Setup(p => p.GetPeopleSettings(2, connectionStr)).Returns(new PeopleSettings()
            {
                SelectGroups = "1234", ExcludedUser = "******", HiddenAttributres = "dks,da", serverId = 2
            });

            peopleSettingsService = new PeopleSettingsService(mockCacheProvider.Object, mockOptions.Object, mockPeopleSettingsRepository.Object);

            var settings = peopleSettingsService.GetPeopleSettings(2, baseUrl, connectionStr);

            Assert.NotNull(settings);
        }
Ejemplo n.º 2
0
 public DBPeopleRepository(IDatabaseProvider databaseProvider,
                           IDBConnectionService dbConnectionService,
                           IPeopleSettingsService peopleSettingsService,
                           IDefaultUrlService defaultUrlService)
 {
     _databaseProvider      = databaseProvider;
     _dbConnectionService   = dbConnectionService;
     _peopleSettingsService = peopleSettingsService;
     _defaultUrlService     = defaultUrlService;
 }