Esempio n. 1
0
        public void Update_Should_Update_Multiple_Items(ICompoundKeyRepository <User, string, int> repository)
        {
            var 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);

            foreach (var user in users.Take(2))
            {
                user.FullName += "UPDATED";
            }

            repository.Update(users);
            items = repository.GetAll().ToList();
            items.Count(x => x.FullName.EndsWith("UPDATED")).ShouldBe(2);
        }
        public void Update_Should_Save_Modified_Business_Name(ICompoundKeyRepository<User, string, int> repository)
        {
            var item = new User { Username = "******", Age = 22, FullName = "Test User - 22" };
            repository.Add(item);

            var item2 = new User { Username = "******", Age = 22, FullName = "Test User 2 - 22" };
            repository.Add(item2);

            item.FullName = "Test User - 22 - Updated";
            repository.Update(item);

            var updated = repository.Get(item.Username, item.Age);
            var notUpdated = repository.Get(item2.Username, item2.Age);

            updated.FullName.ShouldEqual("Test User - 22 - Updated");
            notUpdated.FullName.ShouldEqual("Test User 2 - 22");
        }
        public void Update_Should_Update_Multiple_Items(ICompoundKeyRepository<User, string, int> repository)
        {
            var 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);

            foreach (var user in users.Take(2))
            {
                user.FullName += "UPDATED";
            }

            repository.Update(users);
            items = repository.GetAll().ToList();
            items.Count(x => x.FullName.EndsWith("UPDATED")).ShouldEqual(2);
        }
Esempio n. 4
0
        public void Update_Should_Save_Modified_Business_Name(ICompoundKeyRepository <User, string, int> repository)
        {
            var item = new User {
                Username = "******", Age = 22, FullName = "Test User - 22"
            };

            repository.Add(item);

            var item2 = new User {
                Username = "******", Age = 22, FullName = "Test User 2 - 22"
            };

            repository.Add(item2);

            item.FullName = "Test User - 22 - Updated";
            repository.Update(item);

            var updated    = repository.Get(item.Username, item.Age);
            var notUpdated = repository.Get(item2.Username, item2.Age);

            updated.FullName.ShouldBe("Test User - 22 - Updated");
            notUpdated.FullName.ShouldBe("Test User 2 - 22");
        }
Esempio n. 5
0
 public void Update(T entity)
 {
     Repository.Update(entity);
 }