Example #1
0
 public SearchController(IPagingService pagingService,
                         IConfigurationManagerWrapper configurationManagerWrapper)
 {
     _pagingService = pagingService;
     _configurationManagerWrapper = configurationManagerWrapper;
     _pageSize = _configurationManagerWrapper.AppSetting("PageSize").ToAInt();
 }
 public SearchController(IPagingService pagingService,
                         IConfigurationManagerWrapper configurationManagerWrapper)
 {
     _pagingService = pagingService;
     _configurationManagerWrapper = configurationManagerWrapper;
     _pageSize = _configurationManagerWrapper.AppSettings.Value.PageSize;
 }
 private static ISessionFactory CreateISessionFactory(IConfigurationManagerWrapper configurationManager)
 {
     string revationConnectionString = configurationManager.ConnectionStrings["Revation"].ConnectionString;
     MsSqlConfiguration databaseConfiguration =
         MsSqlConfiguration.MsSql2008.ConnectionString(revationConnectionString);
     return RevationHistoricSessionFactoryFactory.Construct(databaseConfiguration);
 }
 public ICallCopyService Construct(IConfigurationManagerWrapper configurationManager)
 {
     string connectionString = configurationManager.ConnectionStrings["CallCopy"].ConnectionString;
     MsSqlConfiguration databaseConfiguration = MsSqlConfiguration.MsSql2008.ConnectionString(connectionString);
     ISessionFactory sessionFactory = _factory.Construct(databaseConfiguration);
     Repository = new Repository(sessionFactory);
     return new CallCopyService(GetFilters(), Repository);
 }
 public DataTransferService(IRemoteDataServiceFactory remoteDataServiceFactory,
     ICallCopyServiceFactory callCopyServiceFactory,
     ITimerWrapper timer, IConfigurationManagerWrapper configurationManager)
 {
     InitializeComponent();
     _remoteDataServiceFactory = remoteDataServiceFactory;
     _timer = timer;
     _configurationManager = configurationManager;
     _transferer = new Transferer(callCopyServiceFactory.Construct(configurationManager));
 }
        public IRemoteDataService Construct(IConfigurationManagerWrapper configurationManager)
        {
            var historicDataSessionFactory = CreateISessionFactory(configurationManager);
            var dataReadService = ConstructDataReadService(historicDataSessionFactory);
            var agentBucketTranslator = new TranslatesAgentBucketToACDAgentSplitDatum();
            var groupStatusBucketTranslator = new TranslatesGroupStatusBucketToACDSplitDatum();
            var userStatusBucketTranslator = new TranslatesUserStatusBucketToACDAgentDatum();

            return new RevationHistoricDataService(dataReadService, agentBucketTranslator,
                groupStatusBucketTranslator, userStatusBucketTranslator);
        }
        public void Setup()
        {
            _configurationManagerWrapper = A.Fake <IConfigurationManagerWrapper>();

            _numberOfYears = 100;
            A.CallTo(() => _configurationManagerWrapper.AppSettings).Returns(new NameValueCollection()
            {
                { ApplicationSettingConstants.DateOfBirthNumberOfYearsToDisplay, _numberOfYears.ToString() }
            });

            _dateOfBirthBuilder = new DateOfBirthBuilder(_configurationManagerWrapper);
        }
        public EnvironmentSettings Get(string environment)
        {
            _configurationManagerWrapper = new ConfigurationManagerWrapper(ConfigurationManager.AppSettings, ConfigurationManager.ConnectionStrings);

            if (environment == "-dev")
            {
                return(GetDevSettings());
            }
            else
            {
                return(GetProdSettings());
            }
        }
        public IEnumerable<IRemoteDataService> Construct(IConfigurationManagerWrapper configurationManager)
        {
            ISessionFactory historicDataSessionFactory = CreateISessionFactory(configurationManager);
            var daysToProcess = new List<DateTime> {DateTime.Today.AddDays(-1)};
            var readServices = daysToProcess.SelectMany(day => ConstructDataReadServices(historicDataSessionFactory, day));

            var agentBucketTranslator = new TranslatesAgentBucketToACDAgentSplitDatum();
            var groupStatusBucketTranslator = new TranslatesGroupStatusBucketToACDSplitDatum();
            var userStatusBucketTranslator = new TranslatesUserStatusBucketToACDAgentDatum();
            return
                readServices.Select(readService => new RevationHistoricDataService(readService.Name, readService, agentBucketTranslator,
                                                                                   groupStatusBucketTranslator,
                                                                                   userStatusBucketTranslator));
        }
Example #10
0
        public void Setup()
        {
            _configurationManagerWrapper     = A.Fake <IConfigurationManagerWrapper>();
            _windowsTokenRoleProviderWrapper = A.Fake <IWindowsTokenRoleProviderWrapper>();
            _userPrincipalProvider           = A.Fake <IUserPrincipalProvider>();

            _administratorsgroup = "administratorsgroup";
            A.CallTo(() => _configurationManagerWrapper.AppSettings).Returns(new NameValueCollection()
            {
                { ApplicationSettingConstants.McaAdministratorsActiveDirectoryGroup, _administratorsgroup }
            });
            _username = "******";
            A.CallTo(() => _userPrincipalProvider.CurrentUserName).Returns(_username);

            _userRoleProvider = new UserRoleProvider(_configurationManagerWrapper, _windowsTokenRoleProviderWrapper, _userPrincipalProvider);
        }
        public IEnumerable<IRemoteDataService> Construct(IConfigurationManagerWrapper configurationManager)
        {
            var requests = new List<WebRequest>();
            JsonFeedSection jsonFeedSection = configurationManager.GetSection("JsonFeed") as JsonFeedSection ??
                                              new JsonFeedSection();

            foreach (WebRequest request in from Url url in jsonFeedSection.Urls select WebRequest.Create(url.Address))
            {
                request.ContentType = "application/json; charset=utf-8";

                requests.Add(request);
            }
            return requests.Select(request => new RevationLiveDataService(
                                                  new RevationLiveReadService(request, new TranslatesStringToHuntgroup()),
                                                  new TranslatesHuntgroupToSocket(), new TranslatesHuntgroupToGenerics()
                                                  ));
        }
Example #12
0
        public void Initialise()
        {
            _windowsTokenRoleProviderWrapper = A.Fake <IWindowsTokenRoleProviderWrapper>();
            _userPrincipalProvider           = A.Fake <IUserPrincipalProvider>();
            _configurationManagerWrapper     = ConfigurationManagerWrapper(GroupName);

            var context  = A.Fake <HttpContextBase>();
            var request  = A.Fake <HttpRequestBase>();
            var response = A.Fake <HttpResponseBase>();
            var session  = A.Fake <HttpSessionStateBase>();
            var server   = A.Fake <HttpServerUtilityBase>();
            var cache    = A.Fake <HttpCachePolicyBase>();

            A.CallTo(() => context.Items).Returns(new Dictionary <string, string>());
            A.CallTo(() => request.Form).Returns(new NameValueCollection());
            A.CallTo(() => request.QueryString).Returns(new NameValueCollection());
            A.CallTo(() => response.Cache).Returns(cache);
            A.CallTo(() => context.Request).Returns(request);
            A.CallTo(() => context.Response).Returns(response);
            A.CallTo(() => context.Session).Returns(session);
            A.CallTo(() => context.Server).Returns(server);

            var principal = new GenericPrincipal(new GenericIdentity("user"), new string[] { });

            A.CallTo(() => context.User).Returns(principal);

            var actionDescriptor         = A.Fake <ActionDescriptor>();
            var controllerDescriptorMock = A.Fake <ControllerDescriptor>();

            A.CallTo(() => actionDescriptor.ControllerDescriptor).Returns(controllerDescriptorMock);
            A.CallTo(() => actionDescriptor.ActionName).Returns("action");

            var controller = A.Fake <ControllerBase>();

            var controllercontext = new ControllerContext(new RequestContext(context, new RouteData()), controller);

            _authorisationContext = new AuthorizationContext(controllercontext, actionDescriptor);

            _authoriseMcaUsersAttribute = new AuthorizeMcaUsersAttribute(_configurationManagerWrapper, _windowsTokenRoleProviderWrapper, _userPrincipalProvider);
        }
        public AddCompetentAuthorityUserHandlerTests()
        {
            UsersDbSet = A.Fake <DbSet <User> >();

            var users = new[]
            {
                FakeUserData(),
                FakeInternalUserData()
            };

            UsersDbSet = helper.GetAsyncEnabledDbSet(users);

            UKCompetentAuthoritiesDbSet = A.Fake <DbSet <UKCompetentAuthority> >();

            var competentAuthorites = new[]
            {
                FakeCompetentAuthorityData()
            };

            UKCompetentAuthoritiesDbSet = helper.GetAsyncEnabledDbSet(competentAuthorites);

            var roles = new[]
            {
                new Role("InternalUser", "Standard user")
            };

            configurationManagerWrapper = A.Fake <IConfigurationManagerWrapper>();

            context = A.Fake <WeeeContext>();

            A.CallTo(() => context.Users).Returns(UsersDbSet);
            A.CallTo(() => context.UKCompetentAuthorities).Returns(UKCompetentAuthoritiesDbSet);
            A.CallTo(() => context.Roles).Returns(helper.GetAsyncEnabledDbSet(roles));

            testInternalUserEmailDomains = A.Fake <ITestUserEmailDomains>();

            handler = new AddCompetentAuthorityUserHandler(context, testInternalUserEmailDomains);
        }
        public AddCompetentAuthorityUserHandlerTests()
        {
            UsersDbSet = A.Fake<DbSet<User>>();

            var users = new[]
            {
                FakeUserData(),
                FakeInternalUserData()
            };

            UsersDbSet = helper.GetAsyncEnabledDbSet(users);

            UKCompetentAuthoritiesDbSet = A.Fake<DbSet<UKCompetentAuthority>>();

            var competentAuthorites = new[]
            {
                FakeCompetentAuthorityData()
            };

            UKCompetentAuthoritiesDbSet = helper.GetAsyncEnabledDbSet(competentAuthorites);

            var roles = new[]
            {
                new Role("InternalUser", "Standard user")
            };

            configurationManagerWrapper = A.Fake<IConfigurationManagerWrapper>();

            context = A.Fake<WeeeContext>();

            A.CallTo(() => context.Users).Returns(UsersDbSet);
            A.CallTo(() => context.UKCompetentAuthorities).Returns(UKCompetentAuthoritiesDbSet);
            A.CallTo(() => context.Roles).Returns(helper.GetAsyncEnabledDbSet(roles));

            testInternalUserEmailDomains = A.Fake<ITestUserEmailDomains>();

            handler = new AddCompetentAuthorityUserHandler(context, testInternalUserEmailDomains);
        }
        public void Setup()
        {
            _configurationManagerWrapper = A.Fake <IConfigurationManagerWrapper>();

            _configurableEmailLinkProvider = new ConfigurableEmailLinkProvider(_configurationManagerWrapper);
        }
Example #16
0
 public ArchiveService(IConfigurationManagerWrapper configurationManagerWrapper)
 {
     _configurationManagerWrapper = configurationManagerWrapper;
     _archiveMonths = _configurationManagerWrapper.AppSetting("ArchiveMonths").ToAInt();
 }
Example #17
0
 public DateOfBirthBuilder(IConfigurationManagerWrapper configurationManagerWrapper)
 {
     _configurationManagerWrapper = configurationManagerWrapper;
 }
Example #18
0
 public HomeController(IConfigurationManagerWrapper configurationManagerWrapper)
 {
     this.configurationManagerWrapper = configurationManagerWrapper;
 }
Example #19
0
 public SortingAppApi(IConfigurationManagerWrapper configurationManager, IHttpClientWrapper httpClientWrapper)
 {
     _httpClientWrapper = httpClientWrapper;
     _httpClientWrapper.Initialize(configurationManager.GetAppSetting("SortingAppApiUrl"), "Sorting App Api");
 }
Example #20
0
 public AuthorizeMcaUsersAttribute(IConfigurationManagerWrapper configurationManagerWrapper, IWindowsTokenRoleProviderWrapper windowsTokenRoleProviderWrapper, IUserPrincipalProvider userPrincipalProvider)
     : base(windowsTokenRoleProviderWrapper, userPrincipalProvider)
 {
     _configurationManagerWrapper = configurationManagerWrapper;
 }
 public ConfigurableEmailLinkProvider(IConfigurationManagerWrapper configurationManagerWrapper)
 {
     _configurationManagerWrapper = configurationManagerWrapper;
 }
Example #22
0
 public UpdatePcsSubmissionWindowSettingsHandler(IDateFactory dateFactory, IConfigurationManagerWrapper configurationManagerWrapper)
 {
     this.dateFactory = dateFactory;
     this.configurationManagerWrapper = configurationManagerWrapper;
 }
Example #23
0
 public ConnectionStringProvider(IConfigurationManagerWrapper configurationManagerWrapper)
 {
     _configurationManagerWrapper = configurationManagerWrapper;
 }
Example #24
0
 public UserRoleProvider(IConfigurationManagerWrapper configurationManagerWrapper, IWindowsTokenRoleProviderWrapper windowsTokenRoleProviderWrapper, IUserPrincipalProvider userPrincipalProvider)
 {
     _configurationManagerWrapper     = configurationManagerWrapper;
     _windowsTokenRoleProviderWrapper = windowsTokenRoleProviderWrapper;
     _userPrincipalProvider           = userPrincipalProvider;
 }
Example #25
0
 public MyProjectApi(IConfigurationManagerWrapper configurationManager, IHttpClientWrapper httpClientWrapper)
 {
     _httpClientWrapper = httpClientWrapper;
     _httpClientWrapper.Initialize(configurationManager.GetAppSetting(Constants.Constants.MyProjectApiUrlKey),
                                   Constants.Constants.MyProjectApiName);
 }
Example #26
0
 public EmployeesRepository(IConfigurationManagerWrapper configurationManagerWrapper)
 {
     this.configurationManagerWrapper = configurationManagerWrapper;
 }
 private ISessionFactory CreateISessionFactory(IConfigurationManagerWrapper configurationManager)
 {
     var revationConnectionString = configurationManager.ConnectionStrings["revation"].ConnectionString;
     var databaseConfiguration = MsSqlConfiguration.MsSql2008.ConnectionString(revationConnectionString);
     return RevationSessionFactoryFactory.Construct(databaseConfiguration);
 }
Example #28
0
 public Configuration(IConfigurationManagerWrapper configurationManagerWrapper = null)
 {
     _configurationManagerWrapper = configurationManagerWrapper ?? new ConfigurationManagerWrapper();
 }
        public void Setup()
        {
            _configurationManagerWrapper = A.Fake <IConfigurationManagerWrapper>();

            _clinicalSystemIdDescriptionProvider = new ClinicalSystemIdDescriptionProvider(_configurationManagerWrapper);
        }
 public VehicleIdentificationApi(IConfigurationManagerWrapper configurationManager, IHttpClientWrapper httpClientWrapper)
 {
     _httpClientWrapper = httpClientWrapper;
     _httpClientWrapper.Initialize(configurationManager.GetAppSetting("VehicleIdentificationApiUrl"), "Vehicle Identification Api");
 }
Example #31
0
 public ArchiveService(IConfigurationManagerWrapper configurationManagerWrapper)
 {
     _configurationManagerWrapper = configurationManagerWrapper;
     _archiveMonths = _configurationManagerWrapper.AppSettings.Value.ArchiveMonths;
 }
Example #32
0
 public MyProjectOData(IConfigurationManagerWrapper configurationManager, IHttpClientWrapper httpClientWrapper)
 {
     _httpClientWrapper = httpClientWrapper;
     _httpClientWrapper.Initialize(configurationManager.GetAppSetting("MyProjectODataUrl"), "My Project OData");
 }
 public ClinicalSystemIdDescriptionProvider(IConfigurationManagerWrapper configurationManagerWrapper)
 {
     _configurationManagerWrapper = configurationManagerWrapper;
 }