public async Task <IActionResult> CreateClientConfiguration(string login, string password, string loginUrl) { try { _ingestionContext.ClientConfigurations.Add(ClientConfiguration.Create(login, password, loginUrl, true)); int saveResult = await _ingestionContext.SaveChangesAsync(); return(Ok(saveResult)); } catch (Exception ex) { _logger.LogError(ex.Message); return(Problem(ex.Message)); } }
public void ShouldBeAbleToLoadThePropertiesBackFromXml() { ClientConfiguration expected_configuration = new ClientConfiguration() { UserName = "******", Password = "******", Host = "smtp.google.com", Port = 445, Ssl = true }; expected_configuration.Save(configurationFileName); ClientConfiguration configuration = ClientConfiguration.Create(configurationFileName); Assert.AreEqual(expected_configuration.UserName, configuration.UserName); Assert.AreEqual(expected_configuration.Password, configuration.Password); Assert.AreEqual(expected_configuration.Host, configuration.Host); Assert.AreEqual(expected_configuration.Port, configuration.Port); Assert.AreEqual(expected_configuration.Ssl, configuration.Ssl); File.Delete(configurationFileName); }
static void Main(string[] args) { ClientConfiguration configuration; Options options = Options.Create(args, new CommandLineParserSettings(Console.Out)); Mail smtpMail; if (!String.IsNullOrEmpty(options.SampleConfigurationFilePath)) { configuration = ClientConfiguration.CreateSampleConfiguration(); configuration.Save(options.SampleConfigurationFilePath); Console.WriteLine("Sample configuration file generated at {0}", Path.GetFullPath(options.SampleConfigurationFilePath)); return; } ErrorList optionErrors = options.Validate(); if (optionErrors.HasErrors) { PrintErrors(optionErrors); return; } configuration = ClientConfiguration.Create(options.ConfigurationFile); ErrorList configurationErrors = options.Validate(); if (configurationErrors.HasErrors) { PrintErrors(configurationErrors); return; } try { smtpMail = new Mail(options, new NativeSmtpClient(configuration)); smtpMail.Send(); } catch (Exception ex) { Console.WriteLine("Unable to send the email reason: {0}", ex.Message); } }
public void ShouldThrowFileNotFoundException() { ClientConfiguration configuration = ClientConfiguration.Create(configurationFileName); }
public static IEngine <TModel> For <TModel>(string clientIdentifier) where TModel : Model, new() { var config = ClientConfiguration.Create(clientIdentifier); return(config.GetClient <TModel>()); }