예제 #1
0
        public void Verify_static_store_DbGeography_method_translated_correctly()
        {
            var seattleLocation = SpatialServices.Instance.GeographyFromText("POINT(-122.333056 47.609722)");

            var expectedResults = new string[]
            {
                "BOTTM",
                "LAUGB",
                "LONEP",
                "THEBI",
                "TRAIH",
                "WHITC",
            };

            using (var context = new NorthwindEntities())
            {
                var query = from c in context.Customers
                            where c.Location.Distance(SampleSqlFunctions.Pointgeography(47.609722, -122.333056, 4326)) < 250000 // 250 km
                            select c;

                var caseIdx = 0;
                foreach (var customer in query)
                {
                    Assert.Equal(expectedResults[caseIdx++], customer.CustomerID);
                }
            }
        }
예제 #2
0
        public void Verify_query_with_provider_store_function_works()
        {
            var expected =
                new string[]
            {
                "Aroun... - Company",
                "B's B... - Company",
                "Conso... - Company",
                "Easte... - Company",
                "North... - Company",
                "Seven... - Company"
            };

            using (var context = new NorthwindEntities())
            {
                var query =
                    from c in context.Customers
                    where c.Address.City == "London"
                    select SampleSqlFunctions.Stuff(c.CompanyName, 6, c.CompanyName.Length - 5, "... - Company");

                var caseIdx = 0;
                foreach (var result in query)
                {
                    Assert.Equal(expected[caseIdx], result);
                    caseIdx++;
                }

                Assert.Equal(6, caseIdx);
            }
        }
예제 #3
0
        public void Verify_store_DbGeometry_method_works()
        {
            using (var context = new NorthwindEntities())
            {
                var query = from o in context.Orders
                            where SampleSqlFunctions.Astextzm(o.ContainerSize) == "POLYGON ((0 0, 9 0, 9 9, 0 9, 0 0))"
                            select o;

                Assert.Equal(73, query.Count());
            }
        }