public void ThrowExceptionIfSecretNotValid(string invalidSecret) { // [Setup] // setup webhost using appsettings with specific path var appSettingsValidator = new AppSettingsValidator(); var appSettings = new AppSettings(); appSettings.JwtSecret = invalidSecret; // [Verify] // we expect to have a appsettings invalid exception Assert.Throws <InvalidAppSettingsException>(() => { appSettingsValidator.EnsureValid(appSettings); }); // [Teardown] // nothing to tear down }
public void ThrowExceptionIfProductTypeNotValid(Type productType) { // [Setup] // setup webhost using appsettings with specific path var appSettingsValidator = new AppSettingsValidator(); var appSettings = new AppSettings(); appSettings.ProductType = productType; // [Verify] // we expect to have a appsettings invalid exception var exception = Assert.Throws <InvalidAppSettingsException>(() => { appSettingsValidator.EnsureValid(appSettings); }); Assert.Equal(nameof(appSettings.ProductType), exception.PropertyName); // [Teardown] // nothing to tear down }