示例#1
0
        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);
        }
示例#2
0
        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();
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }