Skip to content

Commit 9afb136

Browse files
committed
Fixed tests related to Marten v8 migration
1 parent f48aeab commit 9afb136

343 files changed

Lines changed: 1018 additions & 987 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Core.ElasticSearch/Config.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ namespace Core.ElasticSearch;
77

88
public class ElasticSearchConfig
99
{
10-
public string Url { get; set; } = default!;
11-
public string DefaultIndex { get; set; } = default!;
10+
public string Url { get; set; } = null!;
11+
public string DefaultIndex { get; set; } = null!;
1212
}
1313

1414
public static class ElasticSearchConfigExtensions

Core.EntityFramework.Tests/EntityFrameworkProjectionTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ public async Task Applies_Works_Separately()
4545
{
4646
var projection = new ShoppingCartProjection { DbContext = context };
4747

48-
var cartId = Guid.NewGuid();
49-
var clientId = Guid.NewGuid();
48+
var cartId = Guid.CreateVersion7();
49+
var clientId = Guid.CreateVersion7();
5050

5151
await projection.Handle([EventEnvelope.From(new Opened(cartId, clientId))], CancellationToken.None);
5252
await context.SaveChangesAsync();
@@ -75,8 +75,8 @@ public async Task Applies_Works_In_Batch()
7575
{
7676
var projection = new ShoppingCartProjection { DbContext = context };
7777

78-
var cartId = Guid.NewGuid();
79-
var clientId = Guid.NewGuid();
78+
var cartId = Guid.CreateVersion7();
79+
var clientId = Guid.CreateVersion7();
8080

8181
await projection.Handle([
8282
EventEnvelope.From(new Opened(cartId, clientId)),
@@ -96,8 +96,8 @@ public async Task Applies_Works_In_Batch_With_AddAndDeleteOnTheSameRecord()
9696
{
9797
var projection = new ShoppingCartProjection { DbContext = context };
9898

99-
var cartId = Guid.NewGuid();
100-
var clientId = Guid.NewGuid();
99+
var cartId = Guid.CreateVersion7();
100+
var clientId = Guid.CreateVersion7();
101101

102102
await projection.Handle([
103103
EventEnvelope.From(new Opened(cartId, clientId)),
@@ -112,7 +112,7 @@ await projection.Handle([
112112
[Fact]
113113
public async Task SmokeTest()
114114
{
115-
var entity = new ShoppingCart { Id = Guid.NewGuid(), ProductCount = 2, ClientId = Guid.NewGuid() };
115+
var entity = new ShoppingCart { Id = Guid.CreateVersion7(), ProductCount = 2, ClientId = Guid.CreateVersion7() };
116116
context.ShoppingCarts.Add(entity);
117117
await context.SaveChangesAsync();
118118

Core.EntityFramework.Tests/Fixtures/EfCorePostgresContainerFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class EfCorePostgresContainerFixture<TContext>: IAsyncLifetime where TCon
88
{
99
private readonly PostgresContainerFixture postgresContainerFixture = new();
1010

11-
public TContext DbContext { get; private set; } = default!;
11+
public TContext DbContext { get; private set; } = null!;
1212

1313
public async Task InitializeAsync()
1414
{

Core.EntityFramework.Tests/TestDbContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class ShoppingCart
1313

1414
public class TestDbContext(DbContextOptions<TestDbContext> options): DbContext(options)
1515
{
16-
public DbSet<ShoppingCart> ShoppingCarts { get; set; } = default!;
16+
public DbSet<ShoppingCart> ShoppingCarts { get; set; } = null!;
1717

1818
protected override void OnModelCreating(ModelBuilder modelBuilder) =>
1919
modelBuilder.Entity<ShoppingCart>();

Core.EntityFramework/Projections/EntityFrameworkProjection.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Core.EntityFramework.Projections;
1010
public class EntityFrameworkProjection<TDbContext>: IEventBatchHandler
1111
where TDbContext : DbContext
1212
{
13-
public TDbContext DbContext { protected get; set; } = default!;
13+
public TDbContext DbContext { protected get; set; } = null!;
1414
public IAsyncPolicy RetryPolicy { protected get; set; } = Policy.NoOpAsync();
1515

1616
private readonly HashSet<Type> handledEventTypes = [];
@@ -47,8 +47,8 @@ private record ProjectEvent(
4747
);
4848

4949
private readonly Dictionary<Type, ProjectEvent> projectors = new();
50-
private Expression<Func<TView, TId>> viewIdExpression = default!;
51-
private Func<TView, TId> viewId = default!;
50+
private Expression<Func<TView, TId>> viewIdExpression = null!;
51+
private Func<TView, TId> viewId = null!;
5252

5353
public void ViewId(Expression<Func<TView, TId>> id)
5454
{

Core.EventStoreDB.Tests/Commands/EventStoreDBAsyncCommandBusTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public EventStoreDBAsyncCommandBusTests()
7070
public async Task CommandIsStoredInEventStoreDBAndForwardedToCommandHandler()
7171
{
7272
// Given
73-
var userId = Guid.NewGuid();
73+
var userId = Guid.CreateVersion7();
7474
var command = new AddUser(userId);
7575

7676
// When
@@ -91,7 +91,7 @@ public async Task CommandIsStoredInEventStoreDBAndForwardedToCommandHandler()
9191
}
9292
}
9393

94-
public record AddUser(Guid UserId, string? Sth = default);
94+
public record AddUser(Guid UserId, string? Sth = null);
9595

9696
internal class AddUserCommandHandler(List<Guid> userIds): ICommandHandler<AddUser>
9797
{

Core.EventStoreDB.Tests/Subscriptions/Checkpoints/PostgresSubscriptionCheckpointRepositoryTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Core.EventStoreDB.Tests.Subscriptions.Checkpoints;
1111
public class PostgresSubscriptionCheckpointRepositoryTests(PostgresContainerFixture fixture)
1212
: IClassFixture<PostgresContainerFixture>
1313
{
14-
private readonly string subscriptionId = Guid.NewGuid().ToString("N");
14+
private readonly string subscriptionId = Guid.CreateVersion7().ToString("N");
1515

1616
[Fact]
1717
public async Task Store_InitialInsert_Success()

Core.EventStoreDB/Config.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Core.EventStoreDB;
1414

1515
public class EventStoreDBConfig
1616
{
17-
public string ConnectionString { get; set; } = default!;
17+
public string ConnectionString { get; set; } = null!;
1818
}
1919

2020
public record EventStoreDBOptions(

Core.EventStoreDB/Subscriptions/EventStoreDBSubscriptionToAll.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public enum ProcessingStatus
4848

4949
public record EventBatch(string SubscriptionId, ResolvedEvent[] Events);
5050

51-
public EventStoreDBSubscriptionToAllOptions Options { get; set; } = default!;
51+
public EventStoreDBSubscriptionToAllOptions Options { get; set; } = null!;
5252

53-
public Func<IServiceProvider, IEventBatchHandler[]> GetHandlers { get; set; } = default!;
53+
public Func<IServiceProvider, IEventBatchHandler[]> GetHandlers { get; set; } = null!;
5454

5555
public ProcessingStatus Status = ProcessingStatus.NotStarted;
5656

Core.Kafka/Consumers/KafkaConsumerConfig.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ namespace Core.Kafka.Consumers;
66

77
public class KafkaConsumerConfig
88
{
9-
public ConsumerConfig ConsumerConfig { get; set; } = default!;
10-
public string[] Topics { get; set; } = default!;
9+
public ConsumerConfig ConsumerConfig { get; set; } = null!;
10+
public string[] Topics { get; set; } = null!;
1111

1212
public bool IgnoreDeserializationErrors { get; set; } = true;
1313
}

0 commit comments

Comments
 (0)