Skip to content

Commit a8966fb

Browse files
committed
fix(tests)
Bumped FluentAssertions to 7.0.0-alpha.5 for fluentassertions/fluentassertions#2565
1 parent eec6c11 commit a8966fb

File tree

17 files changed

+98
-89
lines changed

17 files changed

+98
-89
lines changed

src/Executables/Single/Program.cs

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
using Microsoft.EntityFrameworkCore;
55
using Microsoft.Extensions.DependencyInjection;
66
using Microsoft.Extensions.DependencyInjection.Extensions;
7+
using Microsoft.Extensions.FileProviders;
8+
using Microsoft.Extensions.Options;
79
using QuantumCore;
810
using QuantumCore.Auth;
911
using QuantumCore.Auth.Extensions;
@@ -33,23 +35,31 @@ await Parser.Default.ParseArguments<SingleRunArgs>(args)
3335
typeof(InMemoryRedisStore), ServiceLifetime.Singleton));
3436
hostBuilder.Services.Replace(new ServiceDescriptor(typeof(IRedisStore), CacheStoreType.Server,
3537
typeof(InMemoryRedisStore), ServiceLifetime.Singleton));
36-
hostBuilder.Services.Configure<DatabaseOptions>("game", opts =>
38+
hostBuilder.Services.AddSingleton<IConfigureOptions<DatabaseOptions>>(provider =>
3739
{
38-
opts.Provider = DatabaseProvider.Sqlite;
39-
opts.ConnectionString = $"Data Source={dataDir}/database.db";
40+
var fileProvider = provider.GetRequiredService<IFileProvider>();
41+
var filePath = fileProvider.GetFileInfo("database.db").PhysicalPath;
42+
return new ConfigureNamedOptions<DatabaseOptions>("game", opts =>
43+
{
44+
opts.Provider = DatabaseProvider.Sqlite;
45+
opts.ConnectionString = $"Data Source={filePath}";
46+
});
4047
});
41-
hostBuilder.Services.Configure<DatabaseOptions>("auth", opts =>
48+
hostBuilder.Services.AddSingleton<IConfigureOptions<DatabaseOptions>>(provider =>
4249
{
43-
opts.Provider = DatabaseProvider.Sqlite;
44-
opts.ConnectionString = $"Data Source={dataDir}/database.db";
50+
var fileProvider = provider.GetRequiredService<IFileProvider>();
51+
var filePath = fileProvider.GetFileInfo("database.db").PhysicalPath;
52+
return new ConfigureNamedOptions<DatabaseOptions>("auth", opts =>
53+
{
54+
opts.Provider = DatabaseProvider.Sqlite;
55+
opts.ConnectionString = $"Data Source={filePath}";
56+
});
4557
});
4658
hostBuilder.Services.Configure<HostingOptions>("game", opts => { opts.Port = 13001; });
4759
hostBuilder.Services.Configure<HostingOptions>("auth", opts => { opts.Port = 11002; });
4860

4961
var host = hostBuilder.Build();
5062

51-
if (!Directory.Exists(dataDir)) Directory.CreateDirectory(dataDir);
52-
5363
using var serviceScope = host.Services.CreateScope();
5464
var gameDb = serviceScope.ServiceProvider.GetRequiredService<GameDbContext>();
5565
var accountDb = serviceScope.ServiceProvider.GetRequiredService<AuthDbContext>();
@@ -59,4 +69,4 @@ await Parser.Default.ParseArguments<SingleRunArgs>(args)
5969
await QuantumCoreHostBuilder.RunAsync<Program>(host);
6070
});
6171

62-
internal class SingleRunArgs;
72+
internal class SingleRunArgs;

src/Tests/Auth.Tests/Auth.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<ItemGroup>
4-
<PackageReference Include="FluentAssertions" Version="6.12.1"/>
4+
<PackageReference Include="FluentAssertions" Version="7.0.0-alpha.5"/>
55
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1"/>
66
<PackageReference Include="NSubstitute" Version="5.1.0"/>
77
<PackageReference Include="Serilog.Sinks.XUnit" Version="3.0.5"/>

src/Tests/Auth.Tests/MigrateTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private async Task ExecuteMigrate(DatabaseProvider provider, string connectionSt
6161
.AddQuantumCoreTestLogger(_testOutputHelper)
6262
.AddSingleton<IConfiguration>(_ => new ConfigurationBuilder().Build())
6363
.AddAuthDatabase()
64-
.Configure<DatabaseOptions>(opts =>
64+
.Configure<DatabaseOptions>("auth", opts =>
6565
{
6666
opts.ConnectionString = connectionString;
6767
opts.Provider = provider;
@@ -71,4 +71,4 @@ private async Task ExecuteMigrate(DatabaseProvider provider, string connectionSt
7171
var db = scope.ServiceProvider.GetRequiredService<AuthDbContext>();
7272
await db.Database.MigrateAsync();
7373
}
74-
}
74+
}

src/Tests/Core.Caching.Tests/Core.Caching.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<ItemGroup>
1414
<PackageReference Include="coverlet.collector" Version="6.0.0"/>
15-
<PackageReference Include="FluentAssertions" Version="6.12.1"/>
15+
<PackageReference Include="FluentAssertions" Version="7.0.0-alpha.5"/>
1616
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
1717
<PackageReference Include="xunit" Version="2.5.3"/>
1818
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3"/>

src/Tests/Core.Networking.Generators.Tests/Core.Networking.Generators.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<ItemGroup>
4-
<PackageReference Include="FluentAssertions" Version="6.12.1"/>
4+
<PackageReference Include="FluentAssertions" Version="7.0.0-alpha.5"/>
55
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.11.0"/>
66
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0"/>
77
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1"/>

src/Tests/Core.Networking.Generators.Tests/SerializerGeneratorTests.cs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
139139
}
140140
}
141141
}
142-
}");
142+
}", o => o.IgnoringNewlineStyle());
143143
}
144144

145145
[Fact]
@@ -257,7 +257,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
257257
}
258258
}
259259
}
260-
}");
260+
}", o => o.IgnoringNewlineStyle());
261261
}
262262

263263
[Fact]
@@ -368,7 +368,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
368368
}
369369
}
370370
}
371-
}");
371+
}", o => o.IgnoringNewlineStyle());
372372
}
373373

374374
[Fact]
@@ -482,7 +482,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
482482
}
483483
}
484484
}
485-
}");
485+
}", o => o.IgnoringNewlineStyle());
486486
}
487487

488488
[Fact]
@@ -601,7 +601,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
601601
}
602602
}
603603
}
604-
}");
604+
}", o => o.IgnoringNewlineStyle());
605605
}
606606

607607
[Fact]
@@ -714,7 +714,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
714714
}
715715
}
716716
}
717-
}");
717+
}", o => o.IgnoringNewlineStyle());
718718
}
719719

720720
[Fact]
@@ -827,7 +827,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
827827
}
828828
}
829829
}
830-
}");
830+
}", o => o.IgnoringNewlineStyle());
831831
}
832832

833833
[Fact]
@@ -938,7 +938,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
938938
}
939939
}
940940
}
941-
}");
941+
}", o => o.IgnoringNewlineStyle());
942942
}
943943

944944
[Fact]
@@ -1060,7 +1060,7 @@ await stream.ReadValueFromStreamAsync<UInt16>(buffer)
10601060
}
10611061
}
10621062
}
1063-
}");
1063+
}", o => o.IgnoringNewlineStyle());
10641064
}
10651065

10661066
[Fact]
@@ -1168,7 +1168,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
11681168
}
11691169
}
11701170
}
1171-
}");
1171+
}", o => o.IgnoringNewlineStyle());
11721172
}
11731173

11741174
[Fact]
@@ -1288,7 +1288,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
12881288
}
12891289
}
12901290
}
1291-
}");
1291+
}", o => o.IgnoringNewlineStyle());
12921292
}
12931293

12941294
[Fact]
@@ -1404,7 +1404,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
14041404
}
14051405
}
14061406
}
1407-
}");
1407+
}", o => o.IgnoringNewlineStyle());
14081408
}
14091409

14101410
[Fact]
@@ -1498,7 +1498,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
14981498
}
14991499
}
15001500
}
1501-
}");
1501+
}", o => o.IgnoringNewlineStyle());
15021502
}
15031503

15041504
[Fact]
@@ -1640,7 +1640,7 @@ await stream.ReadStringFromStreamAsync(buffer, (int)13)
16401640
}
16411641
}
16421642
}
1643-
}");
1643+
}", o => o.IgnoringNewlineStyle());
16441644
}
16451645

16461646
[Fact]
@@ -1766,7 +1766,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
17661766
}
17671767
}
17681768
}
1769-
}");
1769+
}", o => o.IgnoringNewlineStyle());
17701770
}
17711771

17721772
[Fact]
@@ -1910,7 +1910,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
19101910
}
19111911
}
19121912
}
1913-
}");
1913+
}", o => o.IgnoringNewlineStyle());
19141914
}
19151915

19161916
[Fact]
@@ -2033,7 +2033,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
20332033
}
20342034
}
20352035
}
2036-
}");
2036+
}", o => o.IgnoringNewlineStyle());
20372037
runResult.Results[0].GeneratedSources.First(x => x.SourceText.ToString().Contains("GCPhase"))
20382038
.SourceText.ToString().Should().BeEquivalentTo(@"/// <auto-generated/>
20392039
using System;
@@ -2103,7 +2103,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
21032103
}
21042104
}
21052105
}
2106-
}");
2106+
}", o => o.IgnoringNewlineStyle());
21072107
}
21082108

21092109
[Fact]
@@ -2224,7 +2224,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
22242224
}
22252225
}
22262226
}
2227-
}");
2227+
}", o => o.IgnoringNewlineStyle());
22282228
}
22292229

22302230
[Fact]
@@ -2345,7 +2345,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
23452345
}
23462346
}
23472347
}
2348-
}");
2348+
}", o => o.IgnoringNewlineStyle());
23492349
}
23502350

23512351
[Fact]
@@ -2445,7 +2445,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
24452445
}
24462446
}
24472447
}
2448-
}");
2448+
}", o => o.IgnoringNewlineStyle());
24492449
}
24502450

24512451
[Fact]
@@ -2562,7 +2562,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
25622562
}
25632563
}
25642564
}
2565-
}");
2565+
}", o => o.IgnoringNewlineStyle());
25662566
}
25672567

25682568
[Fact]
@@ -2659,7 +2659,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
26592659
}
26602660
}
26612661
}
2662-
}");
2662+
}", o => o.IgnoringNewlineStyle());
26632663
}
26642664

26652665
[Fact]
@@ -2799,7 +2799,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
27992799
}
28002800
}
28012801
}
2802-
}");
2802+
}", o => o.IgnoringNewlineStyle());
28032803
}
28042804

28052805
[Fact]
@@ -2923,7 +2923,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
29232923
}
29242924
}
29252925
}
2926-
}");
2926+
}", o => o.IgnoringNewlineStyle());
29272927
}
29282928

29292929
[Fact]
@@ -3130,7 +3130,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
31303130
}
31313131
}
31323132
}
3133-
}");
3133+
}", o => o.IgnoringNewlineStyle());
31343134
}
31353135

31363136
[Fact]
@@ -3286,7 +3286,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
32863286
}
32873287
}
32883288
}
3289-
}");
3289+
}", o => o.IgnoringNewlineStyle());
32903290
}
32913291

32923292
[Fact]
@@ -3430,7 +3430,7 @@ await stream.ReadValueFromStreamAsync<UInt16>(buffer)
34303430
}
34313431
}
34323432
}
3433-
}");
3433+
}", o => o.IgnoringNewlineStyle());
34343434
}
34353435

34363436
[Fact]
@@ -3590,7 +3590,7 @@ await stream.ReadValueFromStreamAsync<UInt32>(buffer)
35903590
}
35913591
}
35923592
}
3593-
}");
3593+
}", o => o.IgnoringNewlineStyle());
35943594
}
35953595

35963596
[Fact]
@@ -3692,7 +3692,7 @@ public static async ValueTask<object> DeserializeFromStreamAsync(Stream stream)
36923692
}
36933693
}
36943694
}
3695-
}");
3695+
}", o => o.IgnoringNewlineStyle());
36963696
}
36973697

36983698
[Fact]

src/Tests/Core.Tests/Core.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<ItemGroup>
33
<PackageReference Include="AutoBogus" Version="2.13.1" />
4-
<PackageReference Include="FluentAssertions" Version="6.12.1"/>
4+
<PackageReference Include="FluentAssertions" Version="7.0.0-alpha.5"/>
55
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1"/>
66
<PackageReference Include="NSubstitute" Version="5.1.0" />
77
<PackageReference Include="Serilog.Sinks.XUnit" Version="3.0.5" />

0 commit comments

Comments
 (0)