-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
Develappers.RedmineHourglassApi.Tests/HourglassClientTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using Xunit; | ||
|
||
namespace Develappers.RedmineHourglassApi.Tests | ||
{ | ||
public class HourglassClientTests | ||
{ | ||
[Fact] | ||
public void ValidConfiguration_ShouldSetProperties() | ||
{ | ||
var config = Helpers.GetTestConfiguration(); | ||
var hourglassClient = new HourglassClient(config); | ||
|
||
Assert.NotNull(hourglassClient.TimeBookings); | ||
Assert.NotNull(hourglassClient.TimeLogs); | ||
Assert.NotNull(hourglassClient.TimeTrackers); | ||
} | ||
|
||
[Fact] | ||
public void NullConfiguration_ShouldThrowArgumentNullException() | ||
{ | ||
Assert.Throws<ArgumentNullException>(() => new HourglassClient(null)); | ||
} | ||
|
||
[Fact] | ||
public void InvalidApiKey_ShouldThrowArgumentException() | ||
{ | ||
var config = new Configuration("https://redmineTest.de", ""); | ||
|
||
var exception = Assert.Throws<ArgumentException>(() => new HourglassClient(config)); | ||
Assert.Equal("invalid api key (Parameter 'configuration')", exception.Message); | ||
} | ||
|
||
[Fact] | ||
public void InvalidRedmineUrl_ShouldThrowArgumentException() | ||
{ | ||
var config = new Configuration("", "ApiKey"); | ||
|
||
var exception = Assert.Throws<ArgumentException>(() => new HourglassClient(config)); | ||
Assert.Equal("invalid base url (Parameter 'configuration')", exception.Message); | ||
} | ||
} | ||
} |