예제 #1
0
            public void should_return_the_collection_with_ids_set_if_table_has_identity_col()
            {
                var adapter = new InMemoryAdapter();

                adapter.SetAutoIncrementColumn("Record", "Id");
                Database.UseMockAdapter(adapter);

                var destination = new SqlDestination("foo");

                var inserted = destination.Load(new[] {
                    new Record {
                        Name = "Foo"
                    },
                    new Record {
                        Name = "Bar"
                    }
                });

                Assert.True(inserted.First().Id > 0);
            }
예제 #2
0
            public void should_insert_the_specified_collection_into_the_db()
            {
                var adapter = new InMemoryAdapter();

                Database.UseMockAdapter(adapter);

                var destination = new SqlDestination("foo");

                destination.Load(new[] {
                    new Record {
                        Id = 42, Name = "Foo"
                    },
                    new Record {
                        Id = 1337, Name = "Bar"
                    }
                });

                var records = Database.Open().Record.All().ToList();

                Assert.Equal(records.Count, 2);
            }