public void Can_read_entities_from_a_stored_proc_with_parameters_mapped_to_a_function_import()
        {
            using (var context = new AdvancedPatternsModelFirstContext())
            {
                var offices =
                    context.OfficesInBuildingStoredProc(AdvancedPatternsModelFirstInitializer.KnownBuildingGuid).ToList();

                Assert.Equal(2, offices.Count);
                Assert.Equal(2, context.Offices.Local.Count);
                new List <string>
                {
                    "1/1221",
                    "1/1223"
                }.ForEach(n => offices.Where(o => o.Number == n).Single());
            }
        }
Beispiel #2
0
        public void Can_read_entities_from_a_stored_proc_with_parameters_mapped_to_a_function_import_with_merge_option()
        {
            using (var context = new AdvancedPatternsModelFirstContext())
            {
                var offices =
                    context.OfficesInBuildingStoredProc(
                        AdvancedPatternsModelFirstInitializer.KnownBuildingGuid,
                        MergeOption.NoTracking).ToList();

                Assert.Equal(2, offices.Count);
                Assert.Equal(0, context.Offices.Local.Count);
                var officeNumbers = new List <string>
                {
                    "1/1221", "1/1223"
                };

                foreach (var officeNumber in officeNumbers)
                {
                    offices.Single(o => o.Number == officeNumber);
                }
            }
        }