コード例 #1
0
        public void TestInvalidCustomPropertyConstraintNotSatisfied()
        {
            var config = new CustomEnvsSchema()
            {
                USERID_HEADER_KEY                 = "userheaderkey",
                USER_PROPERTIES_HEADER_KEY        = "userproperties",
                GROUPS_HEADER_KEY                 = "usergroups",
                CLIENTTYPE_HEADER_KEY             = "clienttype",
                BACKOFFICE_HEADER_KEY             = "isbackoffice",
                MICROSERVICE_GATEWAY_SERVICE_NAME = "microservice-gateway",
                MyCustomEnvVariable               = "customEnvVariable",
                MyNumberVariable = 1
            };

            Assert.Throws(typeof(ValidationException), () => config.Validate());
        }
コード例 #2
0
        public void TestValidConfigDefaultMicroserviceGateway()
        {
            var config = new CustomEnvsSchema
            {
                USERID_HEADER_KEY          = "userheaderkey",
                USER_PROPERTIES_HEADER_KEY = "userproperties",
                GROUPS_HEADER_KEY          = "usergroups",
                CLIENTTYPE_HEADER_KEY      = "clienttype",
                BACKOFFICE_HEADER_KEY      = "isbackoffice",
                MyCustomEnvVariable        = "customEnvVariable",
                MyMandatoryVariable        = "var",
                MyNumberVariable           = 54
            };

            Assert.DoesNotThrow(() => config.Validate());
            Assert.AreEqual("microservice-gateway", config.MICROSERVICE_GATEWAY_SERVICE_NAME);
        }
コード例 #3
0
        public void TestInvalidConfigAllPropsNull()
        {
            var config = new CustomEnvsSchema();

            Assert.Throws(typeof(ValidationException), () => config.Validate());
        }