Skip to content

Commit

Permalink
Refactor errors tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jm-mailosaur committed Aug 1, 2024
1 parent 4fafc04 commit 4ac2c69
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Mailosaur.Test/ErrorsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ namespace Mailosaur.Test
{
public class ErrorsTests
{
private static string s_ApiKey = Environment.GetEnvironmentVariable("MAILOSAUR_API_KEY");
private string s_BaseUrl = Environment.GetEnvironmentVariable("MAILOSAUR_BASE_URL") ?? "https://mailosaur.com/";

[Fact]
public void UnauthorizedTest()
{
using (var client = new MailosaurClient("invalid_key", Environment.GetEnvironmentVariable("MAILOSAUR_BASE_URL")))
using (var client = new MailosaurClient("invalid_key", s_BaseUrl))
{
var ex = Assert.Throws<MailosaurException>(delegate
{
Expand All @@ -23,7 +26,7 @@ public void UnauthorizedTest()
[Fact]
public void NotFoundTest()
{
using (var client = new MailosaurClient(Environment.GetEnvironmentVariable("MAILOSAUR_API_KEY")))
using (var client = new MailosaurClient(s_ApiKey, s_BaseUrl))
{
var ex = Assert.Throws<MailosaurException>(delegate
{
Expand All @@ -37,7 +40,7 @@ public void NotFoundTest()
[Fact]
public void BadRequestTest()
{
using (var client = new MailosaurClient(Environment.GetEnvironmentVariable("MAILOSAUR_API_KEY")))
using (var client = new MailosaurClient(s_ApiKey, s_BaseUrl))
{
var options = new ServerCreateOptions("");
var ex = Assert.Throws<MailosaurException>(delegate
Expand Down

0 comments on commit 4ac2c69

Please sign in to comment.