Пример #1
0
        public void ValidPathTest1()
        {
            ValidPathTest test = new ValidPathTest()
            {
                Value = "C:\\"
            };

            test = ValidateSettings <ValidPathTest> .Validate(test);
        }
Пример #2
0
        public void ValidUri()
        {
            // can not perform this test as my router intervienes
            UriTest test = new UriTest()
            {
                Value = "http://www.microsoft.com"
            };

            test = ValidateSettings <UriTest> .Validate(test);
        }
Пример #3
0
        public void Validate_SettingError_Success()
        {
            TestSettingError       tse = new TestSettingError();
            TestSettingErrorValues sut = ValidateSettings <TestSettingErrorValues> .Validate(new TestSettingErrorValues(), tse);

            Assert.IsNotNull(sut);
            Assert.IsTrue(tse.ErrorsRaised.ContainsKey("PathNotExists"));
            Assert.IsTrue(tse.ErrorsRaised.ContainsKey("PathInvalidChars"));
            Assert.IsTrue(sut.ValidateSettingsCalled);
        }
Пример #4
0
 public IndexModel(ILogger <IndexModel> logger, IOptions <DefaultPagingOptions> defaultPagingOptions,
                   IOptionsSnapshot <FeatureSettings> featureSettings, IOptions <ValidateSettings> validateSettings,
                   MonitorService monitorService)
 {
     _logger               = logger;
     _monitorService       = monitorService;
     _validateSettings     = validateSettings.Value;
     _featureSettings      = featureSettings.Value;
     _defaultPagingOptions = defaultPagingOptions.Value;
 }
Пример #5
0
        public void RetrieveEnvironmentalVariable()
        {
            Environment.SetEnvironmentVariable("GeoIpKey", "123456789");
            Environment.SetEnvironmentVariable("connstandard", "the connection string");
            StringEnvironmentVariable environmentVariable = new StringEnvironmentVariable();

            environmentVariable = ValidateSettings <StringEnvironmentVariable> .Validate(environmentVariable);

            Assert.AreEqual(environmentVariable.Value, "123456789");
        }
Пример #6
0
        public void ValidDefaultEnvVar()
        {
            //System.Environment.SetEnvironmentVariable("GeoIpKey", "123456789");
            //System.Environment.SetEnvironmentVariable("connstandard", "the connection string");
            DefaultTestStringEnvVar test = new DefaultTestStringEnvVar();

            test = ValidateSettings <DefaultTestStringEnvVar> .Validate(test);

            Assert.AreEqual(test.Value, "C:\\WINDOWS\\system32", true);
        }
Пример #7
0
        public void TestValidOptional2()
        {
            ValidEmail emailSettings = new ValidEmail()
            {
                Email = "*****@*****.**"
            };

            emailSettings = ValidateSettings <ValidEmail> .Validate(emailSettings);

            Assert.IsTrue(emailSettings.Email == "*****@*****.**");
        }
Пример #8
0
        public void Validate_OverrideSettings_Success()
        {
            TestSettingOverride tso = new TestSettingOverride("MyValue", "A string", true);
            TestSettingValues   sut = ValidateSettings <TestSettingValues> .Validate(new TestSettingValues(), tso);

            Assert.IsNotNull(sut);

            Assert.IsTrue(tso.OverrideCalled);

            Assert.AreEqual("A string", sut.MyValue);
            Assert.IsNull(sut.UnsetValue);
        }
Пример #9
0
        public void Validate_ApplicationOverride_Success()
        {
            TestSettingError tse = new TestSettingError();
            TestAppOverride  tao = new TestAppOverride();

            tao.AppOverrides.Add("MyIntValue", 123);
            tao.AppOverrides.Add("DefaultUser", "Joe Bloggs");
            TestAppOverrideValues sut = ValidateSettings <TestAppOverrideValues> .Validate(new TestAppOverrideValues(), null, tse, tao);

            Assert.IsNotNull(sut);
            Assert.AreEqual(0, sut.IntValueNotFound);
            Assert.AreEqual(123, sut.IntValueFound);
            Assert.AreEqual("Joe Bloggs", sut.DefaultUser);
            Assert.AreEqual("", sut.Password);
            Assert.IsTrue(tse.ErrorsRaised.ContainsKey("IntValueNotFound"));
        }
Пример #10
0
        public void InvalidNVP1()
        {
            NameValuePairInvalid nameValuePair = new NameValuePairInvalid();

            nameValuePair = ValidateSettings <NameValuePairInvalid> .Validate(nameValuePair);
        }
Пример #11
0
 public void Validate_NullSettings_Throws_ArgumentNullException()
 {
     ValidateSettings <string> .Validate(null);
 }
Пример #12
0
 public void TestInvalidEmailMultile()
 {
     InvalidEmailMultiple emailSettings = new InvalidEmailMultiple();
     InvalidEmailMultiple validEmail    = ValidateSettings <InvalidEmailMultiple> .Validate(emailSettings);
 }
Пример #13
0
 public void TestInvalidEmailSingle()
 {
     InvalidEmail emailSettings = new InvalidEmail();
     InvalidEmail validEmail    = ValidateSettings <InvalidEmail> .Validate(emailSettings);
 }
Пример #14
0
 public void TestInvalidEmailSingle()
 {
     InvalidGuid valid     = new InvalidGuid();
     InvalidGuid validGuid = ValidateSettings <InvalidGuid> .Validate(valid);
 }
Пример #15
0
 public void TestValidGuid()
 {
     ValidGuid valid     = new ValidGuid();
     ValidGuid validGuid = ValidateSettings <ValidGuid> .Validate(valid);
 }