Skip to content

Commit 1458492

Browse files
committed
Fix formatting, remove extra tests, add qodana
1 parent eee47f5 commit 1458492

28 files changed

+498
-1208
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
global using FluentAssertions;
22
global using NSubstitute;
33
global using NUnit.Framework;
4+
45
[assembly: Parallelizable(ParallelScope.Fixtures)]

OddsCollector.Functions.Tests/Infrastructure/Data/Anonymous2Builder.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public Anonymous2Builder SetId(string id)
3636
return this;
3737
}
3838

39+
// ReSharper disable once MemberCanBePrivate.Global
3940
public Anonymous2Builder SetCommenceTime(DateTime commenceTime)
4041
{
4142
Instance.Commence_time = commenceTime;

OddsCollector.Functions.Tests/Infrastructure/Data/Anonymous3Builder.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@ public Anonymous3Builder SetHomeTeam(string? homeTeam)
3737
return this;
3838
}
3939

40+
// ReSharper disable once MemberCanBePrivate.Global
4041
public Anonymous3Builder SetId(string id)
4142
{
4243
Instance.Id = id;
4344

4445
return this;
4546
}
4647

48+
// ReSharper disable once MemberCanBePrivate.Global
4749
public Anonymous3Builder SetCommenceTime(DateTime commenceTime)
4850
{
4951
Instance.Commence_time = commenceTime;

OddsCollector.Functions.Tests/Infrastructure/ServiceBus/ServiceBusReceivedMessageFactory.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public static ServiceBusReceivedMessage CreateFromObject(object obj)
1616

1717
var ampqAnnotatedMessage = new AmqpAnnotatedMessage(ampqMessage);
1818

19-
return ServiceBusReceivedMessage.FromAmqpMessage(ampqAnnotatedMessage, new BinaryData(Array.Empty<byte>()));
19+
return ServiceBusReceivedMessage.FromAmqpMessage(
20+
ampqAnnotatedMessage, new BinaryData(Array.Empty<byte>()));
2021
}
2122
}

OddsCollector.Functions.Tests/OddsCollector.Functions.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</ItemGroup>
2424

2525
<ItemGroup>
26-
<ProjectReference Include="..\OddsCollector.Functions\OddsCollector.Functions.csproj" />
26+
<ProjectReference Include="..\OddsCollector.Functions\OddsCollector.Functions.csproj"/>
2727
</ItemGroup>
2828

2929
</Project>

OddsCollector.Functions.Tests/Tests/Functions/EventResultsFunction.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Microsoft.Extensions.Logging;
1+
using System.Diagnostics.CodeAnalysis;
2+
using Microsoft.Extensions.Logging;
23
using NSubstitute.ExceptionExtensions;
34
using OddsCollector.Functions.Models;
45
using OddsCollector.Functions.OddsApi;
@@ -8,10 +9,11 @@ namespace OddsCollector.Functions.Tests.Tests.Functions;
89
internal class EventResultsFunction
910
{
1011
[Test]
12+
[SuppressMessage("Usage", "CA2254:Template should be a static expression")]
1113
public async Task Run_WithValidParameters_ReturnsEventResults()
1214
{
1315
// Arrange
14-
IEnumerable<EventResult> expectedEventResults = new List<EventResult>() { new() };
16+
IEnumerable<EventResult> expectedEventResults = new List<EventResult> { new() };
1517

1618
var loggerMock = Substitute.For<ILogger<OddsCollector.Functions.Functions.EventResultsFunction>>();
1719

@@ -58,6 +60,7 @@ public async Task Run_WithException_ReturnsEmptyEventResults()
5860
}
5961

6062
[Test]
63+
[SuppressMessage("Usage", "CA2254:Template should be a static expression")]
6164
public async Task Run_WithValidParameters_ReturnsNoEventResults()
6265
{
6366
// Arrange

OddsCollector.Functions.Tests/Tests/Functions/PredictionsHttpFunction.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@ public void Run_WithValidArguments_ReturnsValidResponse()
3434

3535
var timestamp = DateTime.UtcNow;
3636

37-
var predictions = new[]
38-
{
39-
new EventPredictionBuilder().SetSampleData().SetTimestamp(timestamp).Instance,
40-
};
37+
var predictions =
38+
new[] { new EventPredictionBuilder().SetSampleData().SetTimestamp(timestamp).Instance };
4139

4240
// Act
4341
var response = function.Run(requestStub, predictions);

OddsCollector.Functions.Tests/Tests/Functions/UpcomingEventsFunction.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Microsoft.Extensions.Logging;
1+
using System.Diagnostics.CodeAnalysis;
2+
using Microsoft.Extensions.Logging;
23
using NSubstitute.ExceptionExtensions;
34
using OddsCollector.Functions.Models;
45
using OddsCollector.Functions.OddsApi;
@@ -8,10 +9,11 @@ namespace OddsCollector.Functions.Tests.Tests.Functions;
89
internal class UpcomingEventsFunction
910
{
1011
[Test]
12+
[SuppressMessage("Usage", "CA2254:Template should be a static expression")]
1113
public async Task Run_WithValidParameters_ReturnsEventResults()
1214
{
1315
// Arrange
14-
IEnumerable<UpcomingEvent> expectedEventResults = new List<UpcomingEvent>() { new() };
16+
IEnumerable<UpcomingEvent> expectedEventResults = new List<UpcomingEvent> { new() };
1517

1618
var loggerMock = Substitute.For<ILogger<OddsCollector.Functions.Functions.UpcomingEventsFunction>>();
1719

@@ -54,6 +56,7 @@ public async Task Run_WithException_ReturnsEmptyEventResults()
5456
}
5557

5658
[Test]
59+
[SuppressMessage("Usage", "CA2254:Template should be a static expression")]
5760
public async Task Run_WithValidParameters_ReturnsNoEventResults()
5861
{
5962
// Arrange

OddsCollector.Functions.Tests/Tests/OddsApi/Configuration/OddsApiOptions.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ internal class OddsApiOptions
66
{
77
private static readonly IEnumerable<(string LeagueString, HashSet<string> ExpectedLeagues)>
88
TestCases = new List<(string LeagueString, HashSet<string> ExpectedLeagues)>
9-
{
10-
("league", new HashSet<string>() { "league" }),
11-
("league1;league2", new HashSet<string>() { "league1", "league2" }),
12-
("league1;;league2", new HashSet<string>() { "league1", "league2" }),
13-
("league1;league1", new HashSet<string>() { "league1" })
14-
};
9+
{
10+
("league", ["league"]),
11+
("league1;league2", ["league1", "league2"]),
12+
("league1;;league2", ["league1", "league2"]),
13+
("league1;league1", ["league1"])
14+
};
1515

1616
[TestCaseSource(nameof(TestCases))]
1717
public void SetLeagues_WithValidLeagueInputString_ReturnsCorrectLeagues(

OddsCollector.Functions.Tests/Tests/OddsApi/Configuration/ServiceCollectionExtensions.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,37 @@ public void AddOddsApiClientWithDependencies_AddsProperlyConfiguredOddsApiClient
1515
var services = new ServiceCollection();
1616

1717
// Act
18-
services.AddOddsApiClientWithDependencies();
18+
services.AddOddsApiClientWithDependencies("leagues", "key");
1919

2020
// Assert
21-
var options =
21+
var optionsDescriptor =
2222
services.FirstOrDefault(
2323
x => x.ServiceType == typeof(IConfigureOptions<OddsApiClientOptions>)
2424
&& x.Lifetime == ServiceLifetime.Singleton);
2525

26-
options.Should().NotBeNull();
26+
optionsDescriptor.Should().NotBeNull();
2727

28-
var httpClient =
28+
var httpClientDescriptor =
2929
services.FirstOrDefault(
3030
x => x.ServiceType == typeof(HttpClient)
3131
&& x.Lifetime == ServiceLifetime.Transient);
3232

33-
httpClient.Should().NotBeNull();
33+
httpClientDescriptor.Should().NotBeNull();
3434

35-
var client =
35+
var clientDescriptor =
3636
services.FirstOrDefault(
3737
x => x.ImplementationType == typeof(Client)
3838
&& x.ServiceType == typeof(IClient)
3939
&& x.Lifetime == ServiceLifetime.Singleton);
4040

41-
client.Should().NotBeNull();
41+
clientDescriptor.Should().NotBeNull();
4242

43-
var oddsApiClient =
43+
var oddsApiClientDescriptor =
4444
services.FirstOrDefault(
4545
x => x.ImplementationType == typeof(OddsCollector.Functions.OddsApi.OddsApiClient)
4646
&& x.ServiceType == typeof(IOddsApiClient)
4747
&& x.Lifetime == ServiceLifetime.Singleton);
4848

49-
oddsApiClient.Should().NotBeNull();
49+
oddsApiClientDescriptor.Should().NotBeNull();
5050
}
5151
}

0 commit comments

Comments
 (0)