コード例 #1
0
        public async Task Should_NotInitializeObject_When_ResultOfLeftJoinIsNull_Deep()
        {
            // arrange
            IRequestExecutor tester = _cache.CreateSchema(_barWithoutRelation);

            // act
            // assert
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    @"
                        {
                            root {
                                number
                                foo {
                                    barEnum
                                    nestedObject {
                                        foo {
                                            barString
                                        }
                                    }
                                }
                            }
                        }")
                .Create());

            res1.MatchDocumentSnapshot();
        }
コード例 #2
0
        public async Task Create_ObjectEnumEqual_Expression()
        {
            IRequestExecutor tester = CreateSchema <Bar, BarFilterType>(_barEntities);

            // act
            // assert
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { barEnum: { eq: BAR}}}) " +
                    "{ foo{ barEnum}}}")
                .Create());

            res1.MatchDocumentSnapshot("BAR");

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { barEnum: { eq: FOO}}}) " +
                    "{ foo{ barEnum}}}")
                .Create());

            res2.MatchDocumentSnapshot("FOO");

            IExecutionResult res3 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { barEnum: { eq: null}}}) " +
                    "{ foo{ barEnum}}}")
                .Create());

            res3.MatchDocumentSnapshot("null");
        }
コード例 #3
0
        public async Task Create_ObjectNullableEnumIn_Expression()
        {
            IRequestExecutor tester = CreateSchema <BarNullable, BarNullableFilterType>(
                _barNullableEntities);

            // act
            // assert
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { barEnum: { in: [ BAR FOO ]}}}) " +
                    "{ foo{ barEnum}}}")
                .Create());

            res1.MatchDocumentSnapshot("BarAndFoo");

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { barEnum: { in: [ FOO ]}}}) " +
                    "{ foo{ barEnum}}}")
                .Create());

            res2.MatchDocumentSnapshot("FOO");

            IExecutionResult res3 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { barEnum: { in: [ null FOO ]}}}) " +
                    "{ foo{ barEnum}}}")
                .Create());

            res3.MatchDocumentSnapshot("nullAndFoo");
        }
コード例 #4
0
        public async Task Create_ObjectNullableShortIn_Expression()
        {
            IRequestExecutor tester =
                CreateSchema <BarNullable, BarNullableFilterType>(_barNullableEntities);

            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { barShort: { in: [ 12, 13 ]}}}) " +
                    "{ foo{ barShort}}}")
                .Create());

            res1.MatchDocumentSnapshot("12and13");

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { barShort: { in: [ 13, 14 ]}}}) " +
                    "{ foo{ barShort}}}")
                .Create());

            res2.MatchDocumentSnapshot("13and14");

            IExecutionResult res3 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { barShort: { in: [ 13, null ]}}}) " +
                    "{ foo{ barShort}}}")
                .Create());

            res3.MatchDocumentSnapshot("13andNull");
        }
コード例 #5
0
        public async Task Create_ObjectNullableBooleanEqual_Expression()
        {
            // arrange
            IRequestExecutor tester = CreateSchema <BarNullable, BarNullableFilterType>(
                _barNullableEntities);

            // act
            // assert
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { barBool: { eq: true}}}) " +
                    "{ foo{ barBool}}}")
                .Create());

            res1.MatchDocumentSnapshot("true");

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { barBool: { eq: false}}}) " +
                    "{ foo{ barBool}}}")
                .Create());

            res2.MatchDocumentSnapshot("false");

            IExecutionResult res3 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { barBool: { eq: null}}}) " +
                    "{ foo{ barBool}}}")
                .Create());

            res3.MatchDocumentSnapshot("null");
        }
コード例 #6
0
        public async Task Create_NullableEnumNotEqual_Expression()
        {
            IRequestExecutor tester = CreateSchema <FooNullable, FooNullableFilterType>(
                _fooNullableEntities);

            // act
            // assert
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { barEnum: { neq: BAR } }) { barEnum } }")
                .Create());

            res1.MatchDocumentSnapshot("BAR");

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { barEnum: { neq: FOO } }) { barEnum } }")
                .Create());

            res2.MatchDocumentSnapshot("FOO");

            IExecutionResult res3 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { barEnum: { neq: null } }) { barEnum } }")
                .Create());

            res3.MatchDocumentSnapshot("null");
        }
コード例 #7
0
        public async Task Create_ObjectShortEqual_Expression()
        {
            // arrange
            IRequestExecutor tester = CreateSchema <Bar, BarFilterType>(_barEntities);

            // act
            // assert
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { barShort: { eq: 12}}}) " +
                    "{ foo{ barShort}}}")
                .Create());

            res1.MatchDocumentSnapshot("12");

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { barShort: { eq: 13}}}) " +
                    "{ foo{ barShort}}}")
                .Create());

            res2.MatchDocumentSnapshot("13");

            IExecutionResult res3 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { barShort: { eq: null}}}) " +
                    "{ foo{ barShort}}}")
                .Create());

            res3.MatchDocumentSnapshot("null");
        }
コード例 #8
0
        public async Task Create_ShortNotIn_Expression()
        {
            IRequestExecutor tester = CreateSchema <Foo, FooFilterType>(_fooEntities);

            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { barShort: { nin: [ 12, 13 ]}}){ barShort}}")
                .Create());

            res1.MatchDocumentSnapshot("12and13");

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { barShort: { nin: [ null, 14 ]}}){ barShort}}")
                .Create());

            res2.MatchDocumentSnapshot("13and14");

            IExecutionResult res3 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { barShort: { nin: [ null, 14 ]}}){ barShort}}")
                .Create());

            res3.MatchDocumentSnapshot("nullAnd14");
        }
コード例 #9
0
        public async Task Create_ShortNotEqual_Expression()
        {
            IRequestExecutor tester = CreateSchema <Foo, FooFilterType>(_fooEntities);

            // act
            // assert
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { barShort: { neq: 12}}){ barShort}}")
                .Create());

            res1.MatchDocumentSnapshot("12");

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { barShort: { neq: 13}}){ barShort}}")
                .Create());

            res2.MatchDocumentSnapshot("13");

            IExecutionResult res3 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { barShort: { neq: null}}){ barShort}}")
                .Create());

            res3.MatchDocumentSnapshot("null");
        }
コード例 #10
0
        public async Task Create_NullableStringNotContains_Expression()
        {
            // arrange
            IRequestExecutor tester =
                await _fixture.GetOrCreateSchema <FooNullable, FooNullableFilterType>(
                    _fooNullableEntitiesCypher);

            // act
            const string     query1 = "{ root(where: { bar: { ncontains: \"a\" }}){ bar }}";
            IExecutionResult res1   = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(query1)
                .Create());

            const string     query2 = "{ root(where: { bar: { ncontains: \"b\" }}){ bar }}";
            IExecutionResult res2   = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(query2)
                .Create());

            const string     query3 = "{ root(where: { bar: { ncontains: null }}){ bar }}";
            IExecutionResult res3   = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(query3)
                .Create());

            // assert
            res1.MatchDocumentSnapshot("a");
            res2.MatchDocumentSnapshot("b");
            res3.MatchDocumentSnapshot("null");
        }
コード例 #11
0
        public async Task Create_StringNotEqual_Expression()
        {
            // arrange
            IRequestExecutor tester =
                await _fixture.GetOrCreateSchema <Foo, FooFilterType>(_fooEntitiesCypher);

            // act
            const string     query1 = "{ root(where: { bar: { neq: \"testatest\"}}){ bar }}";
            IExecutionResult res1   = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(query1)
                .Create());

            const string     query2 = "{ root(where: { bar: { neq: \"testbtest\"}}){ bar }}";
            IExecutionResult res2   = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(query2)
                .Create());

            const string     query3 = "{ root(where: { bar: { neq: null}}){ bar }}";
            IExecutionResult res3   = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(query3)
                .Create());

            // assert
            res1.MatchDocumentSnapshot("testatest");
            res2.MatchDocumentSnapshot("testbtest");
            res3.MatchDocumentSnapshot("null");
        }
コード例 #12
0
        public async Task Create_ArrayAnyStringEqual_Expression()
        {
            // arrange
            IRequestExecutor tester = CreateSchema <FooSimple, FooSimpleFilterType>(_fooSimple);

            // act
            // assert
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { bar: { any: false}}){ bar }}")
                .Create());

            res1.MatchDocumentSnapshot("false");

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { bar: { any: true}}){ bar }}")
                .Create());

            res2.MatchDocumentSnapshot("true");

            IExecutionResult res3 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { bar: { all: null}}){ bar }}")
                .Create());

            res3.MatchDocumentSnapshot("null");
        }
コード例 #13
0
        public async Task Create_ArrayAllObjectStringEqual_Expression()
        {
            // arrange
            IRequestExecutor tester = CreateSchema <Foo, FooFilterType>(_fooEntities);

            // act
            // assert
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { fooNested: { all: {bar: { eq: \"a\"}}}}){ fooNested {bar}}}")
                .Create());

            res1.MatchDocumentSnapshot("a");

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { fooNested: { all: {bar: { eq: \"d\"}}}}){ fooNested {bar}}}")
                .Create());

            res2.MatchDocumentSnapshot("d");

            IExecutionResult res3 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { fooNested: { all: {bar: { eq: null}}}}){ fooNested {bar}}}")
                .Create());

            res3.MatchDocumentSnapshot("null");
        }
コード例 #14
0
        public async Task Create_ShortNullableNotIn_Expression()
        {
            // arrange
            IRequestExecutor tester =
                await _fixture.GetOrCreateSchema <FooNullable, FooNullableFilterType>(
                    _fooNullableEntitiesCypher);

            // arrange
            const string     query1 = "{ root(where: { barShort: { nin: [ 12, 13 ]}}){ barShort }}";
            IExecutionResult res1   = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(query1)
                .Create());

            const string     query2 = "{ root(where: { barShort: { nin: [ 13, 14 ]}}){ barShort }}";
            IExecutionResult res2   = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(query2)
                .Create());

            const string     query3 = "{ root(where: { barShort: { nin: [ 13, null ]}}){ barShort }}";
            IExecutionResult res3   = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(query3)
                .Create());

            // assert
            res1.MatchDocumentSnapshot("12and13");
            res2.MatchDocumentSnapshot("13and14");
            res3.MatchDocumentSnapshot("13andNull");
        }
コード例 #15
0
        public async Task Create_ArrayObjectNestedArrayAnyStringEqual_Expression()
        {
            // arrange
            IRequestExecutor tester = CreateSchema <Bar, BarFilterType>(_barEntities);

            // act
            // assert
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { objectArray: { any: false}}}) " +
                    "{ foo { objectArray  { foo { barString }}}}}")
                .Create());

            res1.MatchDocumentSnapshot("false");

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { objectArray: { any: true}}}) " +
                    "{ foo { objectArray  { foo { barString }}}}}")
                .Create());

            res2.MatchDocumentSnapshot("true");

            IExecutionResult res3 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { objectArray: { any: null}}}) " +
                    "{ foo { objectArray  { foo { barString }}}}}")
                .Create());

            res3.MatchDocumentSnapshot("null");
        }
コード例 #16
0
        public async Task Create_ObjectStringIn_Expression()
        {
            // arrange
            IRequestExecutor tester = CreateSchema <Bar, BarFilterType>(_barEntities);

            // act
            // assert
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { barString: { in: " +
                    "[ \"testatest\"  \"testbtest\" ]}}}) " +
                    "{ foo{ barString}}}")
                .Create());

            res1.MatchDocumentSnapshot("testatestAndtestb");

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { barString: { in: [\"testbtest\" null]}}}) " +
                    "{ foo{ barString}}}")
                .Create());

            res2.MatchDocumentSnapshot("testbtestAndNull");

            IExecutionResult res3 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { foo: { barString: { in: [ \"testatest\" ]}}}) " +
                    "{ foo{ barString}}}")
                .Create());

            res3.MatchDocumentSnapshot("testatest");
        }
コード例 #17
0
        public async Task FindFluent_Serializer()
        {
            // arrange
            BsonClassMap.RegisterClassMap <Bar>(
                x => x.MapField(y => y.Baz)
                .SetSerializer(new DateTimeOffsetSerializer(BsonType.String))
                .SetElementName("testName"));

            IRequestExecutor tester = CreateSchema(
                () =>
            {
                IMongoCollection <Bar> collection =
                    _resource.CreateCollection <Bar>("data_" + Guid.NewGuid().ToString("N"));

                collection.InsertMany(_barEntities);

                return(collection.Find(FilterDefinition <Bar> .Empty).AsExecutable());
            });

            // act
            // assert
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { baz: { eq: \"2020-01-11T00:00:00Z\"}}){ baz}}")
                .Create());

            res1.MatchDocumentSnapshot("2020-01-11");

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { baz: { eq: \"2020-01-12T00:00:00Z\"}}){ baz}}")
                .Create());

            res2.MatchDocumentSnapshot("2020-01-12");
        }
コード例 #18
0
        public async Task BsonElement_Rename()
        {
            // arrange
            IRequestExecutor tester = CreateSchema(
                () =>
            {
                IMongoCollection <Foo> collection =
                    _resource.CreateCollection <Foo>("data_" + Guid.NewGuid().ToString("N"));

                collection.InsertMany(_fooEntities);

                return(collection.Find(FilterDefinition <Foo> .Empty).AsExecutable());
            });

            // act
            // assert
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { bar: { eq: true}}){ bar}}")
                .Create());

            res1.MatchDocumentSnapshot("true");

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { bar: { eq: false}}){ bar}}")
                .Create());

            res2.MatchDocumentSnapshot("false");
        }
コード例 #19
0
        public async Task Create_NullableBooleanEqual_Expression()
        {
            // arrange
            IRequestExecutor tester =
                await _fixture.GetOrCreateSchema <FooNullable, FooNullableFilterType>(
                    _fooEntitiesNullableCypher);

            // act
            const string     query1 = "{ root(where: { bar: { eq: true}}){ bar }}";
            IExecutionResult res1   = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(query1)
                .Create());

            const string     query2 = "{ root(where: { bar: { eq: false}}){ bar }}";
            IExecutionResult res2   = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(query2)
                .Create());

            const string     query3 = "{ root(where: { bar: { eq: null}}){ bar }}";
            IExecutionResult res3   = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(query3)
                .Create());

            // assert
            res1.MatchDocumentSnapshot("true");
            res2.MatchDocumentSnapshot("false");
            res3.MatchDocumentSnapshot("null");
        }
コード例 #20
0
        public async Task Create_NullableStringEndsWith_Expression()
        {
            // arrange
            IRequestExecutor tester = CreateSchema <FooNullable, FooNullableFilterType>(
                _fooNullableEntities);

            // act
            // assert
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { bar: { endsWith: \"atest\" }}){ bar}}")
                .Create());

            res1.MatchDocumentSnapshot("atest");

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { bar: { endsWith: \"btest\" }}){ bar}}")
                .Create());

            res2.MatchDocumentSnapshot("btest");

            IExecutionResult res3 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { bar: { endsWith: null }}){ bar}}")
                .Create());

            res3.MatchDocumentSnapshot("null");
        }
コード例 #21
0
        public async Task FindFluent_CombineQuery()
        {
            // arrange
            IRequestExecutor tester = CreateSchema(
                () =>
            {
                IMongoCollection <Baz> collection =
                    _resource.CreateCollection <Baz>("data_" + Guid.NewGuid().ToString("N"));

                collection.InsertMany(_bazEntities);

                return(collection
                       .Find(x => x.Bar > new DateTimeOffset(2000, 1, 1, 0, 0, 0, TimeSpan.Zero))
                       .AsExecutable());
            });

            // act
            // assert
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { bar: { eq: \"2020-01-11T00:00:00Z\"}}){ bar}}")
                .Create());

            res1.MatchDocumentSnapshot("2020-01-11");

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { bar: { eq: \"2020-01-12T00:00:00Z\"}}){ bar}}")
                .Create());

            res2.MatchDocumentSnapshot("2020-01-12");
        }
コード例 #22
0
        public async Task Create_StringNotEqual_Expression()
        {
            // arrange
            IRequestExecutor tester = CreateSchema <Foo, FooFilterType>(_fooEntities);

            // act
            // assert
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { bar: { neq: \"testatest\"}}){ bar}}")
                .Create());

            res1.MatchDocumentSnapshot("testatest");

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { bar: { neq: \"testbtest\"}}){ bar}}")
                .Create());

            res2.MatchDocumentSnapshot("testbtest");

            IExecutionResult res3 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { bar: { neq: null}}){ bar}}")
                .Create());

            res3.MatchDocumentSnapshot("null");
        }
コード例 #23
0
        public async Task Simple_StringList_First_2()
        {
            Snapshot.FullName();

            IRequestExecutor executor = await CreateSchemaAsync();

            IExecutionResult result = await executor
                                      .ExecuteAsync(@"
                    {
                        foos(first: 2) {
                            edges {
                                node {
                                    bar
                                }
                                cursor
                            }
                            nodes {
                                bar
                            }
                            pageInfo {
                                hasNextPage
                                hasPreviousPage
                                startCursor
                                endCursor
                            }
                        }
                    }");

            result.MatchDocumentSnapshot();
        }
コード例 #24
0
        public async Task Create_NullableStringNotIn_Expression()
        {
            // arrange
            IRequestExecutor tester = CreateSchema <FooNullable, FooNullableFilterType>(
                _fooNullableEntities);

            // act
            // assert
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(where: { bar: { nin: [ \"testatest\"  \"testbtest\" ]}}){ bar}}")
                .Create());

            res1.MatchDocumentSnapshot("testatestAndtestb");

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { bar: { nin: [\"testbtest\" null]}}){ bar}}")
                .Create());

            res2.MatchDocumentSnapshot("testbtestAndNull");

            IExecutionResult res3 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(where: { bar: { nin: [ \"testatest\" ]}}){ bar}}")
                .Create());

            res3.MatchDocumentSnapshot("testatest");
        }
コード例 #25
0
        public async Task OneRelationshipReturnOneProperty()
        {
            // arrange
            IRequestExecutor tester = await _fixture.GetOrCreateSchema <Foo>(_fooEntitiesCypher);

            // act
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    @"
                        {
                            root {
                                barBool
                                barString
                                bars
                                {
                                    name
                                }
                            }
                        }
                        ")
                .Create());

            // assert
            res1.MatchDocumentSnapshot();
        }
コード例 #26
0
        public async Task Collection_Configuration()
        {
            // arrange
            BsonClassMap.RegisterClassMap <Bar>(
                x => x.MapField(y => y.Baz)
                .SetSerializer(new DateTimeOffsetSerializer(BsonType.String))
                .SetElementName("testName"));

            IRequestExecutor tester = CreateSchema(
                () =>
            {
                IMongoCollection <Bar> collection =
                    _resource.CreateCollection <Bar>("data_" + Guid.NewGuid().ToString("N"));

                collection.InsertMany(_barEntities);
                return(collection.AsExecutable());
            });

            // act
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(order: { baz: ASC}){ baz}}")
                .Create());

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(order: { baz: DESC}){ baz}}")
                .Create());

            // assert
            res1.MatchDocumentSnapshot("ASC");
            res2.MatchDocumentSnapshot("DESC");
        }
コード例 #27
0
        public async Task BsonElement_Rename()
        {
            // arrange
            IRequestExecutor tester = CreateSchema(
                () =>
            {
                IMongoCollection <Foo> collection =
                    _resource.CreateCollection <Foo>("data_" + Guid.NewGuid().ToString("N"));

                collection.InsertMany(_fooEntities);
                return(collection.AsExecutable());
            });

            // act
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(order: { bar: ASC}){ bar}}")
                .Create());

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root(order: { bar: DESC}){ bar}}")
                .Create());

            // assert
            res1.MatchDocumentSnapshot("ASC");
            res2.MatchDocumentSnapshot("DESC");
        }
コード例 #28
0
        public async Task Create_ObjectNullableBool_OrderBy()
        {
            // arrange
            IRequestExecutor tester =
                CreateSchema <BarNullable, BarNullableSortType>(_barNullableEntities);

            // act
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(order: { foo: { barBool: ASC}}) " +
                    "{ foo{ barBool}}}")
                .Create());

            IExecutionResult res2 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery(
                    "{ root(order: { foo: { barBool: DESC}}) " +
                    "{ foo{ barBool}}}")
                .Create());

            // assert
            res1.MatchDocumentSnapshot("ASC");
            res2.MatchDocumentSnapshot("13");
        }
コード例 #29
0
        public async Task Create_ProjectsOneProperty_Expression()
        {
            // arrange
            IRequestExecutor tester = _cache.CreateSchema(_fooEntities);

            // act
            // assert
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root{ baz }}")
                .Create());

            res1.MatchDocumentSnapshot();
        }
コード例 #30
0
        public async Task IsProjected_Should_NotFailWhenSelectionSetSkippedCompletely()
        {
            // arrange
            IRequestExecutor tester = _cache.CreateSchema(_barEntities);

            // act
            // assert
            IExecutionResult res1 = await tester.ExecuteAsync(
                QueryRequestBuilder.New()
                .SetQuery("{ root { isProjectedFalse }}")
                .Create());

            res1.MatchDocumentSnapshot();
        }