Skip to content

Commit 4234144

Browse files
committed
Feat: Package Updates
1 parent 067ec6f commit 4234144

File tree

11 files changed

+27
-28
lines changed

11 files changed

+27
-28
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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.1" />
38+
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.1" />
3939
</ItemGroup>
4040

4141
</Project>

src/CodeOfChaos.Types.TypedValueStore/IValueContainer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ public interface IValueContainer {
1212

1313
bool TryGetAsValue<T>([NotNullWhen(true)] out T? output) where T : notnull;
1414
T GetAsValue<T>() where T : notnull;
15+
16+
object? GetBoxedValue();
1517
}

src/CodeOfChaos.Types.TypedValueStore/TypedValueStore.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,15 @@ public bool TryUpdate<T>(TKey key, T newValue) where T : notnull =>
206206
/// </summary>
207207
/// <param name="other">The TypedValueStore to compare with the current TypedValueStore.</param>
208208
/// <returns>true if the specified TypedValueStore is equal to the current TypedValueStore; otherwise, false.</returns>
209-
public bool Equals(TypedValueStore<TKey> other) {
209+
public bool Equals(TypedValueStore<TKey>? other) {
210+
if (other is null) return false;
211+
if (ReferenceEquals(this, other)) return true;
210212
if (other._storage.Count != _storage.Count) return false;
211213

214+
// Check if all key-value pairs are equal
212215
foreach (KeyValuePair<TKey, IValueContainer> kvp in _storage) {
213-
if (!other._storage.TryGetValue(kvp.Key, out IValueContainer? otherValue) ||
214-
!Equals(kvp.Value, otherValue)) {
215-
return false;
216-
}
216+
if (!other._storage.TryGetValue(kvp.Key, out IValueContainer? otherValue)) return false;
217+
if (!Equals(kvp.Value.GetBoxedValue(), otherValue.GetBoxedValue())) return false;
217218
}
218219

219220
return true;

src/CodeOfChaos.Types.TypedValueStore/ValueContainer.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@ public bool TryGetAsValue<T1>([NotNullWhen(true)] out T1? output) where T1 : not
2222
}
2323
}
2424

25-
// ReSharper disable once ConvertSwitchStatementToSwitchExpression
2625
public T1 GetAsValue<T1>() where T1 : notnull {
27-
switch (Value) {
28-
case T1 castedValue:
29-
return castedValue;
30-
default:
31-
throw new InvalidCastException($"Value of type {UnderlyingType} cannot be casted to {typeof(T1)}");
32-
}
26+
return Value switch {
27+
T1 castedValue => castedValue,
28+
_ => throw new InvalidCastException($"Value of type {UnderlyingType} cannot be casted to {typeof(T1)}")
29+
};
3330
}
31+
32+
public object? GetBoxedValue() => Value;
3433
}

src/CodeOfChaos.Types/CodeOfChaos.Types.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
</ItemGroup>
3434

3535
<ItemGroup>
36-
<PackageReference Include="AterraEngine.Unions" Version="2.7.1" />
37-
<PackageReference Include="AterraEngine.Unions.Generators" Version="2.7.1">
36+
<PackageReference Include="AterraEngine.Unions" Version="3.6.0" />
37+
<PackageReference Include="AterraEngine.Unions.Generators" Version="3.6.0">
3838
<PrivateAssets>all</PrivateAssets>
3939
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
4040
</PackageReference>
41-
<PackageReference Include="CodeOfChaos.Extensions" Version="0.28.2" />
41+
<PackageReference Include="CodeOfChaos.Extensions" Version="0.30.0" />
4242
</ItemGroup>
4343

4444
<ItemGroup>

src/Tools.CodeOfChaos.Types/Tools.CodeOfChaos.Types.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="CodeOfChaos.CliArgsParser.Library" Version="4.3.4" />
12+
<PackageReference Include="CodeOfChaos.CliArgsParser.Library" Version="4.4.0" />
1313
</ItemGroup>
1414

1515
</Project>

tests/Benchmarks.CodeOfChaos.Types.TypedValueStore/Benchmarks.CodeOfChaos.Types.TypedValueStore.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
<ItemGroup>
1111
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
12+
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.1" />
1213
</ItemGroup>
1314

1415
<ItemGroup>

tests/Benchmarks.CodeOfChaos.Types.TypedValueStore/ValueContainerBenchmarks.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,8 @@ public readonly record struct NewValueContainer<T>(T Value) {
6565

6666
public bool TryGetAsValue<T1>([NotNullWhen(true)] out T1? output) where T1 : notnull {
6767
switch (Value) {
68-
case T1 castedValue:
69-
output = castedValue;
70-
return true;
71-
default:
72-
output = default;
73-
return false;
68+
case T1 castedValue: return (output = castedValue) is not null;
69+
default: return (output = default) is not null;
7470
}
7571
}
7672
}

tests/Tests.CodeOfChaos.Types.DataSeeder/Tests.CodeOfChaos.Types.DataSeeder.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212

1313
<ItemGroup>
1414
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0"/>
15-
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0"/>
15+
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.1" />
1616
<PackageReference Include="Moq" Version="4.20.72"/>
17-
<PackageReference Include="TUnit" Version="0.6.15"/>
17+
<PackageReference Include="TUnit" Version="0.6.154" />
1818
<PackageReference Include="Bogus" Version="35.6.1"/>
1919
</ItemGroup>
2020

tests/Tests.CodeOfChaos.Types.TypedValueStore/Tests.CodeOfChaos.Types.TypedValueStore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<ItemGroup>
1515
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0"/>
1616
<PackageReference Include="Moq" Version="4.20.72"/>
17-
<PackageReference Include="TUnit" Version="0.6.15"/>
17+
<PackageReference Include="TUnit" Version="0.6.154" />
1818
<PackageReference Include="Bogus" Version="35.6.1"/>
1919
</ItemGroup>
2020

0 commit comments

Comments
 (0)