-
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
16 changed files
with
194 additions
and
105 deletions.
There are no files selected for viewing
53 changes: 0 additions & 53 deletions
53
OddsCollector.Common.Tests/OddsApi/Configuration/LeaguesFactoryTests.cs
This file was deleted.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
OddsCollector.Common.Tests/OddsApi/Configuration/OddsApiOptionsTests.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,57 @@ | ||
using FluentAssertions; | ||
using OddsCollector.Common.OddsApi.Configuration; | ||
|
||
namespace OddsCollector.Common.Tests.OddsApi.Configuration; | ||
|
||
internal sealed class OddsApiOptionsTests | ||
{ | ||
[Test] | ||
public void SetLeagues_WithValidLeague_ReturnsValidInstance() | ||
{ | ||
string league = nameof(league); | ||
|
||
var options = new OddsApiOptions(); | ||
options.SetLeagues(league); | ||
|
||
options.Leagues.Should().NotBeNull().And.HaveCount(1); | ||
options.Leagues.ElementAt(0).Should().NotBeNull().And.Be(league); | ||
} | ||
|
||
[Test] | ||
public void SetLeagues_WithValidLeagues_ReturnsValidInstance() | ||
{ | ||
var leagues = "league1;league2"; | ||
|
||
var options = new OddsApiOptions(); | ||
options.SetLeagues(leagues); | ||
|
||
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 SetLeagues_WithDuplicatedLeagues_ReturnsNewInstance() | ||
{ | ||
var leagues = "league1;league1"; | ||
|
||
var options = new OddsApiOptions(); | ||
options.SetLeagues(leagues); | ||
|
||
options.Leagues.Should().NotBeNull().And.HaveCount(1); | ||
options.Leagues.ElementAt(0).Should().NotBeNull().And.Be("league1"); | ||
} | ||
|
||
[TestCase("")] | ||
[TestCase(null)] | ||
public void SetLeagues_WithNullOrEmptyLeagues_ThrowsException(string? leagues) | ||
{ | ||
var action = () => | ||
{ | ||
var options = new OddsApiOptions(); | ||
options.SetLeagues(leagues); | ||
}; | ||
|
||
action.Should().Throw<ArgumentException>().WithParameterName(nameof(leagues)); | ||
} | ||
} |
14 changes: 0 additions & 14 deletions
14
OddsCollector.Common/OddsApi/Configuration/LeaguesFactory.cs
This file was deleted.
Oops, something went wrong.
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
Empty file.
28 changes: 28 additions & 0 deletions
28
OddsCollector.Functions.Notification.Tests/OddsCollector.Functions.Notification.Tests.csproj
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,28 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="FluentAssertions" Version="6.12.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" /> | ||
<PackageReference Include="NSubstitute" Version="5.1.0" /> | ||
<PackageReference Include="NUnit" Version="3.14.0" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" /> | ||
<PackageReference Include="NUnit.Analyzers" Version="3.9.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="6.0.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
</Project> |
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
12 changes: 0 additions & 12 deletions
12
OddsCollector.Functions.Notification/CosmosDb/Configuration/CosmosDbOptions.cs
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
OddsCollector.Functions.Notification/CosmosDb/ContainerFactory.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,26 @@ | ||
using Microsoft.Azure.Cosmos; | ||
|
||
namespace OddsCollector.Functions.Notification.CosmosDb; | ||
|
||
internal static class ContainerFactory | ||
{ | ||
public static Container CreateContainer(string? connectionString, string? databaseId, string? containerId) | ||
{ | ||
if (string.IsNullOrEmpty(connectionString)) | ||
{ | ||
throw new ArgumentException($"{nameof(connectionString)} cannot be null or empty", nameof(connectionString)); | ||
} | ||
|
||
if (string.IsNullOrEmpty(databaseId)) | ||
{ | ||
throw new ArgumentException($"{nameof(databaseId)} cannot be null or empty", nameof(databaseId)); | ||
} | ||
|
||
if (string.IsNullOrEmpty(containerId)) | ||
{ | ||
throw new ArgumentException($"{nameof(containerId)} cannot be null or empty", nameof(containerId)); | ||
} | ||
|
||
return new CosmosClient(connectionString).GetContainer(databaseId, containerId); | ||
} | ||
} |
7 changes: 2 additions & 5 deletions
7
OddsCollector.Functions.Notification/CosmosDb/CosmosDbClient.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
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
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