Skip to content

Commit e6501a3

Browse files
committed
2 parents aff09ab + 559f0c6 commit e6501a3

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

.github/workflows/build-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/checkout@v5
1717

1818
- name: Setup .NET
19-
uses: actions/setup-dotnet@v4
19+
uses: actions/setup-dotnet@v5
2020
with:
2121
dotnet-version: 9.0.x
2222

.github/workflows/publish-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
echo "BUILD_VERSION=3.0.$version" >> ${GITHUB_ENV}
2424
2525
- name: Setup .NET
26-
uses: actions/setup-dotnet@v4
26+
uses: actions/setup-dotnet@v5
2727
with:
2828
dotnet-version: 9.0.x
2929

src/Generators/Types/Enums/SmartEnumGenerator.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Collections;
77
using System.Linq;
88
using System.Reflection;
9+
using Soenneker.Reflection.Cache.Constructors;
910

1011
namespace Soenneker.Utils.AutoBogus.Generators.Types.Enums;
1112

@@ -36,7 +37,7 @@ object IAutoFakerGenerator.Generate(AutoFakerContext context)
3637
return null!;
3738

3839
// Convert IEnumerable to a more efficient indexed collection (avoid multiple enumerations)
39-
var valueArray = values.Cast<object>().ToArray();
40+
object[] valueArray = values.Cast<object>().ToArray();
4041
if (valueArray.Length == 0)
4142
return null!;
4243

@@ -50,7 +51,7 @@ object IAutoFakerGenerator.Generate(AutoFakerContext context)
5051
return selectedValue;
5152

5253
// Attempt to create an instance of the derived type
53-
var ctor = context.CachedType.GetCachedConstructor([typeof(string), typeof(int)]);
54+
CachedConstructor? ctor = context.CachedType.GetCachedConstructor([typeof(string), typeof(int)]);
5455
if (ctor == null)
5556
return null!;
5657

src/Generators/Types/Immutables/ImmutableDictionaryGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ internal sealed class ImmutableDictionaryGenerator<TKey, TValue> : IAutoFakerGen
1010
{
1111
object IAutoFakerGenerator.Generate(AutoFakerContext context)
1212
{
13-
var builder = ImmutableDictionary.CreateBuilder<TKey, TValue>();
13+
ImmutableDictionary<TKey, TValue>.Builder builder = ImmutableDictionary.CreateBuilder<TKey, TValue>();
1414

1515
List<TKey> keys = context.GenerateUniqueMany<TKey>();
1616
int length = keys.Count;

test/Soenneker.Utils.AutoBogus.Tests/AutoFakerParallelTests.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ public void Generate_with_ParallelExecution()
2828

2929
// Assert
3030
results.Count.Should().Be(numberOfTasks);
31-
3231
List<int> ids = results.Select(x => x.Id).ToList();
33-
ids.Should().OnlyHaveUniqueItems();
32+
33+
// Not all the same:
34+
ids.Distinct().Count().Should().BeGreaterThan(1);
3435
}
3536

3637
[Fact]
@@ -50,8 +51,9 @@ public async Task Generate_with_ParallelExecutionTasks()
5051

5152
// Assert
5253
results.Length.Should().Be(numberOfTasks);
53-
5454
List<int> ids = results.Select(x => x.Id).ToList();
55-
ids.Should().OnlyHaveUniqueItems();
55+
56+
// Not all the same:
57+
ids.Distinct().Count().Should().BeGreaterThan(1);
5658
}
5759
}

0 commit comments

Comments
 (0)