示例#1
0
        public void new_save_should_generate_id()
        {
            using (var container = GetContainer())
            {
                var repository = new Repository<Foo>(container);

                var foo = new Foo {Bar = "Test"};

                repository.Save(foo);

                foo.Id.ShouldNotBe(0);
            }
        }
示例#2
0
        public void save_should_store_object_in_container()
        {
            using (var container = GetContainer())
            {
                var repository = new Repository<Foo>(container);

                var foo = new Foo {Id = 13, Bar = "Test"};

                repository.Save(foo);

                var items = repository.GetAll();
                items.Any(f => f.Id == foo.Id).ShouldBeTrue();
            }
        }