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.UserInfo()); Assert.That(ex.Error.Name, Is.EqualTo("Invalid_Key")); }
public void UserInfo_Throws_Exception_On_Invalid_ApiKey() { // Setup var apiKey = " "; // Exercise var api = new MandrillApi(apiKey); // Verify var ex = Assert.Throws<MandrillException>(() => api.UserInfo()); Assert.That(ex.Error.name, Is.EqualTo("Invalid_Key")); }
public async Task Should_Return_Info() { // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; string username = ConfigurationManager.AppSettings["Username"]; // Exercise var api = new MandrillApi(apiKey); UserInfo result = await api.UserInfo(); // Verify Assert.AreEqual(username, result.Username); }
public void UserInfo_Throws_Exception_On_Invalid_ApiKey() { // Setup var apiKey = " "; // Exercise var api = new MandrillApi(apiKey); // Verify var ex = Assert.Throws <MandrillException>(() => api.UserInfo()); 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.UserInfo()); Assert.Equal(ex.Error.Name, "Invalid_Key"); }