Skip to content

Commit d9aa5af

Browse files
committed
Fix: Codecleanup
1 parent 8e0a3a3 commit d9aa5af

File tree

13 files changed

+24
-29
lines changed

13 files changed

+24
-29
lines changed

src/CodeOfChaos.Types.DataSeeder/CodeOfChaos.Types.DataSeeder.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
<ItemGroup Label="InternalsVisibleTo">
2626
<InternalsVisibleTo Include="Tests.CodeOfChaos.Types.DataSeeder"/>
27-
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" />
27+
<InternalsVisibleTo Include="DynamicProxyGenAssembly2"/>
2828
</ItemGroup>
2929

3030
<ItemGroup>
@@ -34,8 +34,8 @@
3434
</ItemGroup>
3535

3636
<ItemGroup>
37-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
38-
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.0" />
37+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0"/>
38+
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.0"/>
3939
</ItemGroup>
4040

4141
</Project>

src/CodeOfChaos.Types.DataSeeder/IDataSeeder.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.Reflection;
66

77
namespace CodeOfChaos.Types;
8-
98
// ---------------------------------------------------------------------------------------------------------------------
109
// Code
1110
// ---------------------------------------------------------------------------------------------------------------------
@@ -14,7 +13,7 @@ public interface IDataSeederService : IHostedService {
1413
IDataSeederService AddSeederGroup(params ISeeder[] seeders);
1514
IDataSeederService AddSeederGroup(Action<SeederGroup> group);
1615
IDataSeederService AddSeederGroup(SeederGroup group);
17-
16+
1817
void AddRemainderSeeders(Assembly assembly);
1918
void AddRemainderSeedersAsOneGroup(Assembly assembly);
2019
}

src/CodeOfChaos.Types.DataSeeder/ISeeder.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using Microsoft.Extensions.Logging;
55

66
namespace CodeOfChaos.Types;
7-
87
// ---------------------------------------------------------------------------------------------------------------------
98
// Code
109
// ---------------------------------------------------------------------------------------------------------------------

src/CodeOfChaos.Types.DataSeeder/OneTimeDataSeederService.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// ---------------------------------------------------------------------------------------------------------------------
22
// Imports
33
// ---------------------------------------------------------------------------------------------------------------------
4-
using Microsoft.Extensions.DependencyInjection;
54
using Microsoft.Extensions.Logging;
65
using System.Collections.Concurrent;
76
using System.Reflection;
@@ -58,8 +57,6 @@ public Task StopAsync(CancellationToken ct = default) {
5857
return Task.CompletedTask;
5958
}
6059

61-
protected virtual Task CollectAsync(CancellationToken ct = default) => Task.CompletedTask;
62-
6360
// -----------------------------------------------------------------------------------------------------------------
6461
// Seeder manipulation Methods
6562
// -----------------------------------------------------------------------------------------------------------------
@@ -138,6 +135,8 @@ public void AddRemainderSeedersAsOneGroup(Assembly assembly) {
138135
_collectedRemainders = true;
139136
}
140137

138+
protected virtual Task CollectAsync(CancellationToken ct = default) => Task.CompletedTask;
139+
141140
private static Type[] CollectTypes(Assembly assembly)
142141
=> assembly.GetTypes()
143142
// order is deterministic

src/CodeOfChaos.Types.DataSeeder/Seeder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using Microsoft.Extensions.Logging;
55

66
namespace CodeOfChaos.Types;
7-
87
// ---------------------------------------------------------------------------------------------------------------------
98
// Code
109
// ---------------------------------------------------------------------------------------------------------------------
@@ -14,6 +13,7 @@ public async Task StartAsync(ILogger logger, CancellationToken ct = default) {
1413
logger.LogInformation("Skipping seeding");
1514
return;
1615
}
16+
1717
ct.ThrowIfCancellationRequested();
1818
await SeedAsync(ct);
1919
}

src/CodeOfChaos.Types.DataSeeder/ServiceCollectionExtensions.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@
55

66
// ReSharper disable once CheckNamespace
77
namespace Microsoft.Extensions.DependencyInjection;
8-
98
// ---------------------------------------------------------------------------------------------------------------------
109
// Code
1110
// ---------------------------------------------------------------------------------------------------------------------
1211
public static class ServiceCollectionExtensions {
1312
public static IServiceCollection AddOneTimeDataSeeder<TDataSeeder>(this IServiceCollection services)
14-
where TDataSeeder : class, IDataSeederService
13+
where TDataSeeder : class, IDataSeederService
1514
=> services.AddHostedService<TDataSeeder>();
16-
17-
public static IServiceCollection AddOneTimeDataSeeder<TDataSeeder>(this IServiceCollection services, Func<IServiceProvider, TDataSeeder> implementationFactory)
18-
where TDataSeeder : class, IDataSeederService
15+
16+
public static IServiceCollection AddOneTimeDataSeeder<TDataSeeder>(this IServiceCollection services, Func<IServiceProvider, TDataSeeder> implementationFactory)
17+
where TDataSeeder : class, IDataSeederService
1918
=> services.AddHostedService(implementationFactory);
2019
}

src/CodeOfChaos.Types/AsynLazy.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class AsyncLazy<T>(Func<CancellationToken, Task<T>> valueFactory) : IAsyn
1010
private readonly SemaphoreSlim _semaphore = new(1, 1);
1111
private bool _disposed;
1212
private Task<T>? _value;
13-
13+
1414
// -----------------------------------------------------------------------------------------------------------------
1515
// Methods
1616
// -----------------------------------------------------------------------------------------------------------------
@@ -38,7 +38,7 @@ public async ValueTask DisposeAsync() {
3838

3939
_value = null;
4040
}
41-
41+
4242
public async ValueTask<T> GetValueAsync(CancellationToken ct = default) {
4343
ct.ThrowIfCancellationRequested();
4444

src/CodeOfChaos.Types/CodeOfChaos.Types.csproj.DotSettings

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<wpf:ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib"
1+
<wpf:ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
2+
xmlns:s="clr-namespace:System;assembly=mscorlib"
23
xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
34
xml:space="preserve">
45
<s:Boolean

tests/Tests.CodeOfChaos.Types.DataSeeder/SeederGroupTests.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using Moq;
88

99
namespace Tests.CodeOfChaos.Types.DataSeeder;
10-
1110
// ---------------------------------------------------------------------------------------------------------------------
1211
// Code
1312
// ---------------------------------------------------------------------------------------------------------------------
@@ -25,7 +24,7 @@ await Assert.That(seederGroup)
2524
.IsEmpty()
2625
.And.HasCount().EqualToZero();
2726
}
28-
27+
2928
[Test]
3029
public async Task Constructor_ShouldInitializeSeederGroupFromArray() {
3130
// Arrange
@@ -44,7 +43,7 @@ await Assert.That(seederGroup)
4443
.And.Contains(mockSeeder1)
4544
.And.Contains(mockSeeder2);
4645
}
47-
46+
4847
[Test]
4948
public async Task AddSeeder_ShouldAddSeederInstance() {
5049
// Arrange
@@ -111,7 +110,7 @@ await Assert.That(seederGroup)
111110
.And.HasCount().EqualTo(1)
112111
.And.Contains(mockSeeder);
113112
}
114-
113+
115114
[Test]
116115
public async Task AddSeeder_WithFactory_ShouldAddFactoryCreatedSeeder_WithAction() {
117116
// Arrange

tests/Tests.CodeOfChaos.Types.DataSeeder/SeederTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,4 @@ public override Task SeedAsync(CancellationToken ct = default) {
8787
return Task.CompletedTask;
8888
}
8989
}
90-
}
90+
}

0 commit comments

Comments
 (0)