public async Task Notification() { var expected = await CreateSessionFactory() .Execute( session => session.ExecuteStructCommandAndReturn( new AddTestItemStructCommand(TestItemGenerator.Generate()), Returns <TestItem> .Type)) .AssertAndGet(); Assert.Contains(expected, CatchAddedTestItemsWhenAdded.CaughtItems, TestItemComparer.Default); }
public async Task ExecuteCommandAndReturn() { await using var session = CreateSession(); var expected = await session .ExecuteCommandAndReturn(new AddTestItemCommand(TestItemGenerator.Generate())) .AssertAndGet(); var actual = await session .ProcessQuery(new GetTestItemQuery(expected.Id)) .AssertAndGet(); Assert.Equal(expected, actual, TestItemComparer.Default); await session.CommitAsync(); }
public async Task Query() { var expected = await CreateSessionFactory() .Execute( session => session.ExecuteStructCommandAndReturn( new AddTestItemStructCommand(TestItemGenerator.Generate()), Returns <TestItem> .Type)) .AssertAndGet(); var actual = await CreateSessionFactory() .Fetch( session => session.ProcessStructQuery( new GetTestItemStructQuery(expected.Id), Returns <TestItem> .Type)) .AssertAndGet(); Assert.Equal(expected, actual, TestItemComparer.Default); }
public async Task Command() { var expected = await CreateSessionFactory() .Execute(session => session.ExecuteCommandAndReturn(new AddTestItemCommand(TestItemGenerator.Generate()))) .AssertAndGet(); expected.Value = Guid.NewGuid().ToString(); await CreateSessionFactory() .Execute(session => session.ExecuteCommand(new EditTestItemCommand(expected))) .AssertAndGet(); var actual = await CreateSessionFactory() .Fetch(session => session.ProcessQuery(new GetTestItemQuery(expected.Id))) .AssertAndGet(); Assert.Equal(expected, actual, TestItemComparer.Default); }