コード例 #1
0
            public async Task Should_Parse_Number_Followed_By_Parenthesis(string query, int[] expected)
            {
                // Given, When
                var result = await TestQueryRunner.Execute(query, DefaultSeeder);

                // Then
                result.ShouldContainEntities(expected);
            }
コード例 #2
0
            public async Task Navigational_Property(string query, int[] expected)
            {
                // Given, When
                var result = await TestQueryRunner.Execute(query, DefaultSeeder);

                // Then
                result.ShouldContainEntities(expected);
            }
コード例 #3
0
            public async Task Nullable_Decimal(string query, int[] expected)
            {
                // Given, When
                var result = await TestQueryRunner.Execute(query, DefaultSeeder);

                // Then
                result.ShouldContainEntities(expected);
            }
コード例 #4
0
            public async Task Should_Throw_If_Decimal_Has_Invalid_Format(string query)
            {
                // Given, When
                var result = await Record.ExceptionAsync(
                    () => TestQueryRunner.Execute(query, DefaultSeeder));

                // Then
                result
                .ShouldBeOfType <InvalidOperationException>()
                .And().Message.ShouldBe("Invalid number format.");
            }
コード例 #5
0
            public async Task Should_Throw_If_Trying_To_Map_Non_Entity_Type_Property()
            {
                // Given, When
                var result = await Record.ExceptionAsync(async() =>
                {
                    await TestQueryRunner.Execute("Foo = 'Contoso'", DefaultSeeder,
                                                  options =>
                    {
                        options.Configure <Document>(document =>
                        {
                            document.Map <Invoice>(invoice => { invoice.Map("Foo", e => e.Dummy); });
                        });
                    });
                });

                // Then
                result
                .ShouldBeOfType <InvalidOperationException>()
                .And().Message.ShouldBe("The property 'Invoice.Dummy' is not mapped to an entity.");
            }
コード例 #6
0
            public async Task Should_Throw_If_Trying_To_Map_Navigational_Property_Directly()
            {
                // Given, When
                var result = await Record.ExceptionAsync(async() =>
                {
                    await TestQueryRunner.Execute("Foo = 'Contoso'", DefaultSeeder,
                                                  options =>
                    {
                        options.Configure <Document>(document =>
                        {
                            document.Map <Invoice>(invoice => { invoice.Map("Foo", e => e.Company); });
                        });
                    });
                });

                // Then
                result
                .ShouldBeOfType <InvalidOperationException>()
                .And().Message.ShouldBe("Cannot map the navigational property 'Company' directly.");
            }
コード例 #7
0
            public async Task Should_Throw_If_Trying_To_Map_Inherited_Parameter_With_Already_Existing_Name()
            {
                // Given, When
                var result = await Record.ExceptionAsync(async() =>
                {
                    await TestQueryRunner.Execute("Foo = 1", DefaultSeeder, options =>
                    {
                        options.Configure <Document>(document =>
                        {
                            document.Map("Foo", e => e.DocumentId);
                            document.Map <Invoice>(invoice => { invoice.Map("Foo", e => e.Cancelled); });
                        });
                    });
                });

                // Then
                result
                .ShouldBeOfType <InvalidOperationException>()
                .And().Message.ShouldBe("The property 'Foo' have been defined twice.");
            }