示例#1
0
        public void DoesNotProduceFaultsForValidOptions()
        {
            var validator = new BackendOptionsValidator();
            var options   = OptionsTestHelper.CreateValidOptions();
            var result    = validator.Validate(string.Empty, options);

            result.Failed.Should().BeFalse("because the provided options are valid");
        }
示例#2
0
        public void DoesProduceFaultForEmptyHereMapsApiKey()
        {
            var validator = new BackendOptionsValidator();
            var options   = OptionsTestHelper.CreateValidOptions();

            options.Geo.HereMapsAPIKey = string.Empty;

            var result = validator.Validate(string.Empty, options);

            result.Failed.Should().BeTrue("because the provided options are not valid.");
        }
示例#3
0
        public void DoesProduceFaultForEmptySqlServerConnectionString()
        {
            var validator = new BackendOptionsValidator();
            var options   = OptionsTestHelper.CreateValidOptions();

            options.Database.SQLServerConnectionString = string.Empty;

            var result = validator.Validate(string.Empty, options);

            result.Failed.Should().BeTrue("because the provided options are not valid");
        }
示例#4
0
        public void DoesProduceFaultForHEREMapImageServiceEndpointNull()
        {
            var validator = new BackendOptionsValidator();
            var options   = OptionsTestHelper.CreateValidOptions();

            options.Geo.HEREMapImageServiceBaseUri = null !;

            var result = validator.Validate(string.Empty, options);

            result.Failed.Should()
            .BeTrue(
                because: "the HERE Map Image service endpoint Uri is null.");
        }
示例#5
0
        public void DoesProduceFaultForTooShortJwtSecret()
        {
            var validator = new BackendOptionsValidator();
            var options   = OptionsTestHelper.CreateValidOptions();

            options.AuthNR.JWTSigningKey = string.Concat(
                Enumerable.Range(0, 15).Select(n => "c"));

            var result = validator.Validate(string.Empty, options);

            result.Failed.Should()
            .BeTrue(
                because: "the JWT signing key was not at least 16 characters long.");
        }
示例#6
0
        public void DoesProduceFaultForHEREGeocodeServiceEndpointWithInvalidScheme()
        {
            var validator = new BackendOptionsValidator();
            var options   = OptionsTestHelper.CreateValidOptions();

            var uriBuilder = new UriBuilder("https://google.com/")
            {
                Scheme = Uri.UriSchemeFtp,
            };

            options.Geo.HEREGeocodeServiceBaseUri = uriBuilder.Uri;

            var result = validator.Validate(string.Empty, options);

            result.Failed.Should()
            .BeTrue(
                because: "the HERE Geocode Service Endpoint has an invalid URI.");
        }