public async Task ShouldThrowExceptionIfNullResult()
            {
                IStatementResultCursor result = null;
                var exception = await Record.ExceptionAsync(() => result.SingleAsync());

                exception.Should().BeOfType <ArgumentNullException>();
            }
예제 #2
0
        protected async Task <int> CountPersonAsync(string name)
        {
            var session = Driver.Session();

            try
            {
                return(await session.ReadTransactionAsync(async tx =>
                {
                    IStatementResultCursor result =
                        await tx.RunAsync("MATCH (a:Person {name: $name}) RETURN count(a)", new { name });

                    return (await result.SingleAsync())[0].As <int>();
                }));
            }
            finally
            {
                await session.CloseAsync();
            }
        }