NEO-146: simplify using declarations in outcome persistence tests
Apply IDE0063 where braced scopes have no name clashes with later blocks.pull/187/head
parent
6c4221072a
commit
237e39c8ca
|
|
@ -39,19 +39,17 @@ public sealed class ContractOutcomePersistenceIntegrationTests(PostgresIntegrati
|
|||
RecordedAt);
|
||||
|
||||
// Act — write through first host
|
||||
using (var firstScope = Factory.Services.CreateScope())
|
||||
{
|
||||
var instanceStore = firstScope.ServiceProvider.GetRequiredService<IContractInstanceStore>();
|
||||
var outcomeStore = firstScope.ServiceProvider.GetRequiredService<IContractOutcomeStore>();
|
||||
Assert.True(instanceStore.TryCreateActive(
|
||||
PlayerId,
|
||||
InstanceId,
|
||||
TemplateId,
|
||||
SeedBucket,
|
||||
IssuedAt,
|
||||
out _));
|
||||
Assert.True(outcomeStore.TryAppend(outcomeRow));
|
||||
}
|
||||
using var firstScope = Factory.Services.CreateScope();
|
||||
var instanceStore = firstScope.ServiceProvider.GetRequiredService<IContractInstanceStore>();
|
||||
var outcomeStore = firstScope.ServiceProvider.GetRequiredService<IContractOutcomeStore>();
|
||||
Assert.True(instanceStore.TryCreateActive(
|
||||
PlayerId,
|
||||
InstanceId,
|
||||
TemplateId,
|
||||
SeedBucket,
|
||||
IssuedAt,
|
||||
out _));
|
||||
Assert.True(outcomeStore.TryAppend(outcomeRow));
|
||||
|
||||
ContractOutcomeRow readBack;
|
||||
await using var secondFactory = new PostgresWebApplicationFactory();
|
||||
|
|
@ -145,24 +143,22 @@ public sealed class ContractOutcomePersistenceIntegrationTests(PostgresIntegrati
|
|||
[],
|
||||
[],
|
||||
RecordedAt);
|
||||
using (var scope = Factory.Services.CreateScope())
|
||||
{
|
||||
var instanceStore = scope.ServiceProvider.GetRequiredService<IContractInstanceStore>();
|
||||
var outcomeStore = scope.ServiceProvider.GetRequiredService<IContractOutcomeStore>();
|
||||
Assert.True(instanceStore.TryCreateActive(
|
||||
PlayerId,
|
||||
InstanceId,
|
||||
TemplateId,
|
||||
SeedBucket,
|
||||
IssuedAt,
|
||||
out _));
|
||||
await SeedPostgresPlayerAsync(otherPlayerId);
|
||||
// Act
|
||||
var appended = outcomeStore.TryAppend(outcomeRow);
|
||||
// Assert
|
||||
Assert.False(appended);
|
||||
Assert.Empty(outcomeStore.GetOutcomesForInstance(InstanceId));
|
||||
}
|
||||
using var scope = Factory.Services.CreateScope();
|
||||
var instanceStore = scope.ServiceProvider.GetRequiredService<IContractInstanceStore>();
|
||||
var outcomeStore = scope.ServiceProvider.GetRequiredService<IContractOutcomeStore>();
|
||||
Assert.True(instanceStore.TryCreateActive(
|
||||
PlayerId,
|
||||
InstanceId,
|
||||
TemplateId,
|
||||
SeedBucket,
|
||||
IssuedAt,
|
||||
out _));
|
||||
await SeedPostgresPlayerAsync(otherPlayerId);
|
||||
// Act
|
||||
var appended = outcomeStore.TryAppend(outcomeRow);
|
||||
// Assert
|
||||
Assert.False(appended);
|
||||
Assert.Empty(outcomeStore.GetOutcomesForInstance(InstanceId));
|
||||
}
|
||||
|
||||
[RequirePostgresFact]
|
||||
|
|
@ -180,17 +176,15 @@ public sealed class ContractOutcomePersistenceIntegrationTests(PostgresIntegrati
|
|||
[],
|
||||
[],
|
||||
RecordedAt);
|
||||
using (var scope = Factory.Services.CreateScope())
|
||||
{
|
||||
var instanceStore = scope.ServiceProvider.GetRequiredService<IContractInstanceStore>();
|
||||
Assert.True(instanceStore.TryCreateActive(
|
||||
PlayerId,
|
||||
InstanceId,
|
||||
TemplateId,
|
||||
SeedBucket,
|
||||
IssuedAt,
|
||||
out _));
|
||||
}
|
||||
using var seedScope = Factory.Services.CreateScope();
|
||||
var instanceStore = seedScope.ServiceProvider.GetRequiredService<IContractInstanceStore>();
|
||||
Assert.True(instanceStore.TryCreateActive(
|
||||
PlayerId,
|
||||
InstanceId,
|
||||
TemplateId,
|
||||
SeedBucket,
|
||||
IssuedAt,
|
||||
out _));
|
||||
|
||||
// Act
|
||||
var results = await Task.WhenAll(
|
||||
|
|
|
|||
Loading…
Reference in New Issue