Beispiel #1
0
        public void InsertNonAutoGeneratedWorks()
        {
            var table = new InMemoryTable <ThingWithStringPrimaryKey, string>(new TestConfiguration());
            var thing = new ThingWithStringPrimaryKey()
            {
                Id = "Foo", Name = "Bar"
            };

            Assert.Equal(1, table.Insert(thing));
        }
Beispiel #2
0
        public void InsertWithSameKeyThrows()
        {
            var table = new InMemoryTable <ThingWithStringPrimaryKey, string>(new TestConfiguration());
            var thing = new ThingWithStringPrimaryKey()
            {
                Id = "Foo", Name = "Bar"
            };
            var dupeThing = new ThingWithStringPrimaryKey()
            {
                Id = "Foo", Name = "Car"
            };

            table.Insert(thing);
            Assert.Throws <Exception>(() => table.Insert(dupeThing));
        }