public void Delete_Should_Remove_Multiple_Items(ICompoundKeyRepository <User, string, int> repository)
        {
            IList <User> users = new List <User>
            {
                new User {
                    Username = "******", Age = 11, FullName = "Test User - 11"
                },
                new User {
                    Username = "******", Age = 21, FullName = "Test User - 21"
                },
                new User {
                    Username = "******", Age = 11, FullName = "Test User  2- 11"
                },
            };

            repository.Add(users);
            var items = repository.GetAll().ToList();

            items.Count().ShouldBe(3);

            repository.Delete(users.Take(2));
            items = repository.GetAll().ToList();
            items.Count().ShouldBe(1);
            items.First().Username.ShouldBe("Test User 2");
        }
        public void Delete_Should_Remove_Item(ICompoundKeyRepository<User, string, int> repository)
        {
            var item = new User {Username = "******", Age = 11, FullName = "Test User - 11"};
            repository.Add(item);

            //var result = repository.Get(contact.ContactId);
            //result.ShouldNotBeNull();

            repository.Delete(item);
            //result = repository.Get(contact.ContactId);
            //result.ShouldBeNull();
        }
        public void Delete_Should_Remove_Item_By_Key(ICompoundKeyRepository<User, string, int> repository)
        {
            var item = new User { Username = "******", Age = 11, FullName = "Test User - 11" };
            repository.Add(item);

            var result = repository.Get(item.Username, item.Age);
            result.ShouldNotBeNull();

            repository.Delete(item.Username, item.Age);

            result = repository.Get(item.Username, item.Age);
            result.ShouldBeNull();
        }
Exemplo n.º 4
0
        public void Delete_Should_Remove_Item(ICompoundKeyRepository <User, string, int> repository)
        {
            var item = new User {
                Username = "******", Age = 11, FullName = "Test User - 11"
            };

            repository.Add(item);

            //var result = repository.Get(contact.ContactId);
            //result.ShouldNotBeNull();

            repository.Delete(item);
            //result = repository.Get(contact.ContactId);
            //result.ShouldBeNull();
        }
        public void Delete_Should_Remove_Item_By_Key(ICompoundKeyRepository <User, string, int> repository)
        {
            var item = new User {
                Username = "******", Age = 11, FullName = "Test User - 11"
            };

            repository.Add(item);

            var result = repository.Get(item.Username, item.Age);

            result.ShouldNotBeNull();

            repository.Delete(item.Username, item.Age);

            result = repository.Get(item.Username, item.Age);
            result.ShouldBeNull();
        }
        public void Delete_Should_Remove_Multiple_Items(ICompoundKeyRepository<User, string, int> repository)
        {
            IList<User> users = new List<User>
                                        {
                                            new User { Username = "******", Age = 11, FullName = "Test User - 11" },
                                            new User { Username = "******", Age = 21, FullName = "Test User - 21" },
                                            new User { Username = "******", Age = 11, FullName = "Test User  2- 11" },
                                        };

            repository.Add(users);
            var items = repository.GetAll().ToList();
            items.Count().ShouldEqual(3);

            repository.Delete(users.Take(2));
            items = repository.GetAll().ToList();
            items.Count().ShouldEqual(1);
            items.First().Username.ShouldEqual("Test User 2");
        }
Exemplo n.º 7
0
 public void Delete(T entity)
 {
     Repository.Delete(entity);
 }