public bool TryInitialize() { try { var api = new MandrillApi(_ctx.Setting.MandrillApiKey); api.Ping(); } catch (Exception ex) { _ctx.Logger.Fatal(ex, "Unable to connect to Mandrill api. Check MandrillApiKey setting."); } return(false); }
public void Ping_Throws_Exception_On_Invalid_ApiKey() { // Setup var apiKey = " "; // Exercise var api = new MandrillApi(apiKey); // Verify var ex = Assert.Throws<MandrillException>(() => api.Ping()); Assert.That(ex.Error.name, Is.EqualTo("Invalid_Key")); }
public async Task Should_Throw_Exception_On_Invalid_ApiKey() { // Setup string apiKey = " "; // Exercise var api = new MandrillApi(apiKey); // Verify var ex = Assert.Throws<MandrillException>(async () => await api.Ping()); Assert.That(ex.Error.Name, Is.EqualTo("Invalid_Key")); }
public async Task Should_Throw_Exception_On_Invalid_ApiKey() { // Setup var apiKey = " "; // Exercise var api = new MandrillApi(apiKey); // Verify var ex = await Assert.ThrowsAsync <MandrillException>(async() => await api.Ping()); Assert.Equal(ex.Error.Name, "Invalid_Key"); }
public void Ping_Throws_Exception_On_Invalid_ApiKey() { // Setup var apiKey = " "; // Exercise var api = new MandrillApi(apiKey); // Verify var ex = Assert.Throws <MandrillException>(() => api.Ping()); Assert.That(ex.Error.name, Is.EqualTo("Invalid_Key")); }
public async Task Should_Return_Pong_On_Valid_ApiKey() { // Setup var apiKey = Settings.ApiKey; // Exercise var api = new MandrillApi(apiKey); var result = await api.Ping(); var expected = "PONG!"; // Verify Assert.Equal(expected, result); }
public async Task Should_Return_Pong_On_Valid_ApiKey() { // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; // Exercise var api = new MandrillApi(apiKey); string result = await api.Ping(); string expected = "PONG!"; // Verify Assert.AreEqual(expected, result); }
public void Ping_Returns_Pong_On_Valid_ApiKey() { // Setup var apiKey = ConfigurationManager.AppSettings["APIKey"]; // Exercise var api = new MandrillApi(apiKey); string result = api.Ping(); string expected = "\"PONG!\""; // Verify Assert.AreEqual(expected, result); }