-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
Hi there!
I am looking for an event store which will be friendly to F#, so the one written in F# should be perfect ;D I tried to use it with postgres + marten, but I am failing to read events if they are represented by discriminated union. Let me just give You the test that I run;
module Tests
open System
open System.Threading.Tasks
open Xunit
open CosmoStore.Marten
open CosmoStore
open FsUnit.Xunit
type DummyEvent = { IncrementedBy: int }
type DummyEvent2 = { Date: DateTime }
type Dummies =
| Dummy1 of DummyEvent
| Dummy2 of DummyEvent2
[<Fact>]
let ``Saving and reading`` () =
// Arrange
let streamId = "MyAmazingStream"
let config: Configuration =
{ Host = "localhost"
Username = "postgres"
Password = "Secret!Passw0rd"
Database = "cativity" }
let es = EventStore.getEventStore config
let eventWrite: EventWrite<Dummies> =
{ Id = Guid.NewGuid()
CorrelationId = None
CausationId = None
Name = nameof DummyEvent
Data = Dummies.Dummy1{ IncrementedBy = 4 }
Metadata = None }
// Act + Assert
[ eventWrite ]
|> es.AppendEvents streamId ExpectedVersion.Any
|> Async.AwaitTask
|> Async.RunSynchronously
|> ignore
let events =
EventsReadRange.AllEvents
|> es.GetEvents "MyAmazingStream"
|> Async.AwaitTask
|> Async.RunSynchronously
[ events.Head.Data ] |> should equal [ eventWrite.Data ]The test breaks on event read.
System.AggregateException
One or more errors occurred. (unordered field Item)
So it is quite mysterious. Probably I am doing something wrong.
Without DU it works just OK - so if we will use EventWrite<DummyEvent>
Any hints? Thanks guys in advance!
Metadata
Metadata
Assignees
Labels
No labels