Skip to content

Commit

Permalink
close #3 (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
picolino authored Jun 6, 2021
1 parent 16f7d40 commit ec0ef27
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions isdayoff.Tests/IsDayOffApiClientTests/WhenGetData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ private static IEnumerable UrlConstructionTestData()
{TestName = "Ukraine passes correctly", ExpectedResult = $"{ApiBaseUrlStub}getdata?date1=20200804&date2=20200804&cc=ua"};
yield return new TestCaseData(04.08.Of(2020), 04.08.Of(2020), Country.USA, "0")
{TestName = "USA passes correctly", ExpectedResult = $"{ApiBaseUrlStub}getdata?date1=20200804&date2=20200804&cc=us"};
yield return new TestCaseData(04.08.Of(2020), 04.08.Of(2020), Country.Uzbekistan, "0")
{TestName = "Uzbekistan passes correctly", ExpectedResult = $"{ApiBaseUrlStub}getdata?date1=20200804&date2=20200804&cc=uz"};
yield return new TestCaseData(04.08.Of(2020), 04.08.Of(2020), Country.Turkey, "0")
{TestName = "Turkey passes correctly", ExpectedResult = $"{ApiBaseUrlStub}getdata?date1=20200804&date2=20200804&cc=tr"};
}

[Test]
Expand Down
7 changes: 4 additions & 3 deletions isdayoff/Contract/Country.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@

namespace isdayoff.Contract
namespace isdayoff.Contract
{
public enum Country
{
Russia,
Belarus,
Ukraine,
Kazakhstan,
USA
USA,
Uzbekistan,
Turkey
}
}
4 changes: 4 additions & 0 deletions isdayoff/Core/IsDayOffApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ private static string GetCountryCode(Country country)
return "kz";
case Country.USA:
return "us";
case Country.Uzbekistan:
return "uz";
case Country.Turkey:
return "tr";
default:
throw new ArgumentOutOfRangeException(nameof(country), country, ErrorsMessages.UnknownCountry());
}
Expand Down

0 comments on commit ec0ef27

Please sign in to comment.