-
Notifications
You must be signed in to change notification settings - Fork 0
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
31 changed files
with
1,393 additions
and
284 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
OddsCollector.Common.Tests/OddsApi/Configuration/OddsApiOptionsFactoryTests.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,56 @@ | ||
using FluentAssertions; | ||
using OddsCollector.Common.OddsApi.Configuration; | ||
|
||
namespace OddsCollector.Common.Tests.OddsApi.Configuration; | ||
|
||
internal sealed class OddsApiOptionsFactoryTests | ||
{ | ||
[Test] | ||
public void CreateOddsApiOptions_WithValidLeague_ReturnsNewInstance() | ||
{ | ||
string league = nameof(league); | ||
|
||
var options = OddsApiOptionsFactory.CreateOddsApiOptions(league); | ||
|
||
options.Should().NotBeNull(); | ||
options.Leagues.Should().NotBeNull().And.HaveCount(1); | ||
options.Leagues.ElementAt(0).Should().NotBeNull().And.Be(league); | ||
} | ||
|
||
[Test] | ||
public void CreateOddsApiOptions_WithValidLeagues_ReturnsNewInstance() | ||
{ | ||
var leagues = "league1;league2"; | ||
|
||
var options = OddsApiOptionsFactory.CreateOddsApiOptions(leagues); | ||
|
||
options.Should().NotBeNull(); | ||
options.Leagues.Should().NotBeNull().And.HaveCount(2); | ||
options.Leagues.ElementAt(0).Should().NotBeNull().And.Be("league1"); | ||
options.Leagues.ElementAt(1).Should().NotBeNull().And.Be("league2"); | ||
} | ||
|
||
[Test] | ||
public void CreateOddsApiOptions_WithDuplicatedLeagues_ReturnsNewInstance() | ||
{ | ||
var leagues = "league1;league1"; | ||
|
||
var options = OddsApiOptionsFactory.CreateOddsApiOptions(leagues); | ||
|
||
options.Should().NotBeNull(); | ||
options.Leagues.Should().NotBeNull().And.HaveCount(1); | ||
options.Leagues.ElementAt(0).Should().NotBeNull().And.Be("league1"); | ||
} | ||
|
||
[TestCase("")] | ||
[TestCase(null)] | ||
public void CreateOddsApiOptions_WithNullOrEmptyLeagues_ThrowsException(string? leagues) | ||
{ | ||
var action = () => | ||
{ | ||
_ = OddsApiOptionsFactory.CreateOddsApiOptions(leagues); | ||
}; | ||
|
||
action.Should().Throw<ArgumentException>().WithParameterName(nameof(leagues)); | ||
} | ||
} |
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
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
Oops, something went wrong.