Exemplo n.º 1
0
        public void InsertWithLongWorks()
        {
            var table = new InMemoryTable <ThingWithLongPrimaryKey, long>(new TestConfiguration());
            var thing = new ThingWithLongPrimaryKey {
                Name = "Foo"
            };
            var pk = table.Insert(thing);

            Assert.Equal(1, thing.Id);

            var secondThing = new ThingWithLongPrimaryKey {
                Name = "Bar"
            };
            var pk2 = table.Insert(secondThing);

            Assert.Equal(2, secondThing.Id);
        }
Exemplo n.º 2
0
        public void InsertLongWorks()
        {
            var config = new TestConfiguration();

            using (var session = new Session(new InMemoryEngine(config), new Lazy <IDbConnection>(() => new InMemoryDbConnection()))) {
                var thing = new ThingWithLongPrimaryKey {
                    Name = "Foo"
                };
                var inserts = session.Insert(thing);
                Assert.Equal(1, inserts);
                Assert.Equal(1, thing.Id);

                var secondThing = new ThingWithLongPrimaryKey {
                    Name = "Bar"
                };
                var insertsSecond = session.Insert(secondThing);
                Assert.Equal(1, insertsSecond);
                Assert.Equal(2, secondThing.Id);
            }
        }
Exemplo n.º 3
0
        public void InsertLongWorks()
        {
            var config = new TestConfiguration(true);

            using (var session = config.BeginSession()) {
                var thing = new ThingWithLongPrimaryKey {
                    Name = "Foo"
                };
                var inserts = session.Insert(thing);
                Assert.Equal(1, inserts);
                Assert.Equal(1, thing.Id);

                var secondThing = new ThingWithLongPrimaryKey {
                    Name = "Bar"
                };
                var insertsSecond = session.Insert(secondThing);
                Assert.Equal(1, insertsSecond);
                Assert.Equal(2, secondThing.Id);
            }
        }