Skip to content

Commit

Permalink
[DEVEX-222] Added TryDeserialize method to ResolvedEvent
Browse files Browse the repository at this point in the history
Currently it's implemented in a dummy way
  • Loading branch information
oskardudycz committed Jan 23, 2025
1 parent 33e2f5a commit 748955e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/Kurrent.Client/Core/ResolvedEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,10 @@ public ResolvedEvent(EventRecord @event, EventRecord? link, ulong? commitPositio
? new Position(commitPosition.Value, (link ?? @event).Position.PreparePosition)
: new Position?();
}

public bool TryDeserialize(out object o) {
o = true;
return true;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ public async Task appends_and_reads_with_default_serialization() {

Assert.Equal(new(0), writeResult.NextExpectedStreamRevision);

var count = await Fixture.Streams.ReadStreamAsync(Direction.Forwards, stream, StreamPosition.Start, 2)
.CountAsync();
var resolvedEvents = await Fixture.Streams.ReadStreamAsync(Direction.Forwards, stream, StreamPosition.Start, 2).ToListAsync();
Assert.Single(resolvedEvents);

Assert.Equal(1, count);
var resolvedEvent = resolvedEvents.Single();

Assert.True(resolvedEvent.TryDeserialize(out var message));
Assert.NotNull(message);
}

private IEnumerable<UserRegistered> GenerateEvents(int count = 1) =>
Expand Down

0 comments on commit 748955e

Please sign in to comment.