public void ValidPathTest1() { ValidPathTest test = new ValidPathTest() { Value = "C:\\" }; test = ValidateSettings <ValidPathTest> .Validate(test); }
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); }
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); }
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; }
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"); }
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); }
public void TestValidOptional2() { ValidEmail emailSettings = new ValidEmail() { Email = "*****@*****.**" }; emailSettings = ValidateSettings <ValidEmail> .Validate(emailSettings); Assert.IsTrue(emailSettings.Email == "*****@*****.**"); }
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); }
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")); }
public void InvalidNVP1() { NameValuePairInvalid nameValuePair = new NameValuePairInvalid(); nameValuePair = ValidateSettings <NameValuePairInvalid> .Validate(nameValuePair); }
public void Validate_NullSettings_Throws_ArgumentNullException() { ValidateSettings <string> .Validate(null); }
public void TestInvalidEmailMultile() { InvalidEmailMultiple emailSettings = new InvalidEmailMultiple(); InvalidEmailMultiple validEmail = ValidateSettings <InvalidEmailMultiple> .Validate(emailSettings); }
public void TestInvalidEmailSingle() { InvalidEmail emailSettings = new InvalidEmail(); InvalidEmail validEmail = ValidateSettings <InvalidEmail> .Validate(emailSettings); }
public void TestInvalidEmailSingle() { InvalidGuid valid = new InvalidGuid(); InvalidGuid validGuid = ValidateSettings <InvalidGuid> .Validate(valid); }
public void TestValidGuid() { ValidGuid valid = new ValidGuid(); ValidGuid validGuid = ValidateSettings <ValidGuid> .Validate(valid); }