Пример #1
0
        public void Update_Pizzly_With_ConfigurationSetup_Null()
        {
            var setupId            = "Github";
            var configurationSetup = new ConfigurationSetup();

            Assert.ThrowsAsync <ArgumentNullException>(() => _pizzly.UpdateConfiguration(setupId, configurationSetup));
        }
        public static void Main(string[] args)
        {
            var contentRoot = Directory.GetCurrentDirectory();
            var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");

            var configuration = ConfigurationSetup.Configure(contentRoot, environment, (confBuilder) =>
            {
                if ("Development".Equals(environment, StringComparison.OrdinalIgnoreCase))
                {
                    confBuilder.AddUserSecrets <Startup>();
                }

                confBuilder.AddCommandLine(args);
            });

            var hostConfig = configuration.GetSection("Host");

            var hostBuilder = new WebHostBuilder()
                              .UseUrls(hostConfig["Urls"])
                              .UseContentRoot(Directory.GetCurrentDirectory())
                              //.UseConfiguration(configuration.GetSection("Kestrel"))
                              .UseKestrel()
                              .ConfigureLogging(f => f.AddConsole(configuration.GetSection("Logging")))
                              .UseStartup <Startup>();

            if (!String.IsNullOrWhiteSpace(hostConfig["UseIISIntegration"]))
            {
                hostBuilder = hostBuilder.UseIISIntegration();
            }

            hostBuilder.Build().Run();
        }
Пример #3
0
        public void SetUp()
        {
            Assembly asm  = Assembly.GetExecutingAssembly();
            string   path = System.IO.Path.GetDirectoryName(asm.Location);

            _hostingEnvironmentMock = new Mock <IHostingEnvironment>();
            _configuration          = ConfigurationSetup.SetUpConfiguration();
            _hostingEnvironmentMock.Setup(c => c.WebRootPath).Returns(() => path);
            _dataSerializer = new TestDataSerializer();
            _dataRepository = new TestCsvRepository(_dataSerializer, _hostingEnvironmentMock.Object, _configuration);
            _idInfos        = new List <ValidIDInfo>
            {
                new ValidIDInfo("8709046424188", new DateTime(1987, 9, 4), "Non-SA Citizen", "Male"),
                new ValidIDInfo("8605065397083", new DateTime(1986, 5, 6), "SA Citizen", "Male"),
            };
            _invalidIdInfos = new List <InvalidIDInfo>
            {
                new InvalidIDInfo("870904642489", "The identity number contains " +
                                  "characters that are not numbers|The Identity number has " +
                                  "less than 13 digits"),
                new InvalidIDInfo("870904642489001", "The identity number contains " +
                                  "characters that are not numbers|The Identity number has " +
                                  "more than 13 digits"),
            };
        }
Пример #4
0
        public void InitializeTest()
        {
            var mapper        = new AutoMapperSetup().CreateAutoMapperConfig();
            var configuration = new ConfigurationSetup().CreateConfiguration();

            taxCalculator = new TaxCalculatorTaxJarApi(configuration, mapper);
        }
Пример #5
0
 public Hooks(IObjectContainer container, ScenarioContext scenarioContext)
 {
     this.container = container;
     config         = ConfigurationSetup.InitConfiguration();
     container.RegisterInstanceAs(config);
     _scenarioContext = scenarioContext;
     driverHelper     = new DriverHelper();
 }
Пример #6
0
        public void Should_Raise_SolException_When_Project_Is_Null_Or_Empty()
        {
            // Arrange
            IConfiguration     config   = ConfigurationSetup.BuildConfiguration(SolTestsConstants.NoProjectAppSettings);
            IServiceCollection services = ContainerSetup.EmptyServiceCollection();

            // Act/Assert
            Assert.Throws <SolException>(() => services.AddSol(config));
        }
Пример #7
0
        public void Should_Raise_SolException_When_Application_IConfigurationSection_Does_Not_Exists()
        {
            // Arrange
            IConfiguration     config   = ConfigurationSetup.BuildConfiguration(SolTestsConstants.NoAppSectionAppSettings);
            IServiceCollection services = ContainerSetup.EmptyServiceCollection();

            // Act/Assert
            Assert.Throws <SolException>(() => services.AddSol(config));
        }
Пример #8
0
        public async Task <ConfigurationResponse> CreateConfiguration(ConfigurationSetup setup)
        {
            if (setup == null)
            {
                throw new ArgumentNullException($"{nameof(ConfigurationSetup)} must me not null");
            }

            var url = $"api/{_integrationId}/configurations";

            return(await TriggerCreateOrUpdateConfiguration(url, setup, true).ConfigureAwait(false));
        }
Пример #9
0
        public void SetUp()
        {
            _dataRepository = new Mock <IDataRepository>();
            //_dataRepository.Setup(x => x.Save(It.IsAny<List<ValidIDInfo>>(), It.IsAny<FileCsvType>()));
            _hostingEnvironment = new Mock <IHostingEnvironment>();
            _formFile           = new Mock <IFormFile>();
            _logger             = new Mock <ILogger <IdentityNumberController> >();
            _configuration      = ConfigurationSetup.SetUpConfiguration();

            _identityNumberService    = new TestIdentityNumberService(_configuration);
            _identityNumberValidator  = new TestIdentityNumberValidator(_identityNumberService);
            _identityNumberController = new IdentityNumberController(_dataRepository.Object, _identityNumberValidator,
                                                                     _identityNumberService, _hostingEnvironment.Object, _logger.Object);
            SetUpDataRepository();
        }
Пример #10
0
        public Startup(
            IHostingEnvironment environment,
            ILoggerFactory loggerFactory)
        {
            _logger        = loggerFactory.CreateLogger <Startup>();
            _configuration = ConfigurationSetup.Configure(environment, (confBuilder) =>
            {
                if (environment.IsDevelopment())
                {
                    confBuilder.AddUserSecrets <Startup>();
                }
            });

            _environment = environment;
        }
Пример #11
0
        public void Create_Pizzly_Null_Configuration()
        {
            var configurationSetup = new ConfigurationSetup();

            Assert.ThrowsAsync <ArgumentNullException>(() => _pizzly.CreateConfiguration(configurationSetup));
        }
Пример #12
0
        public async Task <ConfigurationResponse> UpdateConfiguration(string setupId, ConfigurationSetup setup)
        {
            if (string.IsNullOrWhiteSpace(setupId))
            {
                throw new ArgumentNullException($"{nameof(setupId)} must be not null or empty");
            }
            if (setup == null)
            {
                throw new ArgumentNullException($"{nameof(ConfigurationSetup)} must me not null");
            }

            var url = $"api/{_integrationId}/configurations/{setupId}";

            return(await TriggerCreateOrUpdateConfiguration(url, setup, false).ConfigureAwait(false));
        }
Пример #13
0
        private async Task <ConfigurationResponse> TriggerCreateOrUpdateConfiguration(string url, ConfigurationSetup setup, bool isCreate)
        {
            object body = new
            {
                credentials = new
                {
                    clientId     = setup.ClientId,
                    clientSecret = setup.ClientSecret
                },
                scopes = GetScopeListFormattedForRequest(setup.Scopes)
            };

            ConfigurationResponse result;

            if (isCreate)
            {
                result = await _baseUrl.AppendPathSegment(url)
                         .PostJsonAsync(body)
                         .ReceiveJson <ConfigurationResponse>().ConfigureAwait(false);
            }
            else
            {
                result = await _baseUrl.AppendPathSegment(url)
                         .PutJsonAsync(body)
                         .ReceiveJson <ConfigurationResponse>().ConfigureAwait(false);
            }

            return(result);
        }
Пример #14
0
 public void SetUp()
 {
     _configuration           = ConfigurationSetup.SetUpConfiguration();
     _identityNumberService   = new TestIdentityNumberService(_configuration);
     _identityNumberValidator = new TestIdentityNumberValidator(_identityNumberService);
 }