예제 #1
0
        public async void CreateActor()
        {
            // arrange
            IAsyncSession session = _neo4JResource.GetAsyncSession();

            try
            {
                // act
                var actor = new Actor("Keanu Reaves", 56);

                IDictionary <string, object> parameters =
                    new Neo4jParameters().WithEntity("newActor", actor);

                IResultCursor cursor = await session.RunAsync(
                    @"CREATE (actor:Actor $newActor) RETURN actor",
                    parameters);

                Actor createdActor = await cursor.MapSingleAsync <Actor>();

                await cursor.ConsumeAsync();

                // assert
                createdActor.MatchSnapshot();
            }
            finally
            {
                await session.CloseAsync();
            }
        }