public void ShouldRejectChangesWithModifiedAndRemovedItem()
        {
            var email = _emails.First();

            var c = new ChangeTrackingCollections <FriendEmailWrapper>(_emails);

            email.Email = "*****@*****.**";
            c.Remove(email);
            Assert.AreEqual("*****@*****.**", email.EmailOriginalValue);

            Assert.AreEqual(1, c.Count);
            Assert.AreEqual(0, c.AddedItems.Count);
            Assert.AreEqual(0, c.ModifiedItems.Count);
            Assert.AreEqual(1, c.RemovedItems.Count);

            c.RejectChanges();

            Assert.AreEqual(2, c.Count);
            Assert.IsTrue(c.Contains(email));

            Assert.AreEqual(0, c.AddedItems.Count);
            Assert.AreEqual(0, c.ModifiedItems.Count);
            Assert.AreEqual(0, c.RemovedItems.Count);

            Assert.IsFalse(email.IsChanged);
            Assert.AreEqual("*****@*****.**", email.Email);
            Assert.AreEqual("*****@*****.**", email.EmailOriginalValue);

            Assert.IsFalse(c.IsChanged);
        }
        public void ShouldRejectChanges()
        {
            var emailToModify = _emails.First();
            var emailToRemove = _emails.Skip(1).First();
            var emailToAdd    = new FriendEmailWrapper(new FriendEmail {
                Email = "*****@*****.**"
            });

            var c = new ChangeTrackingCollections <FriendEmailWrapper>(_emails);

            c.Add(emailToAdd);
            c.Remove(emailToRemove);
            emailToModify.Email = "*****@*****.**";
            Assert.AreEqual("*****@*****.**", emailToModify.EmailOriginalValue);

            Assert.AreEqual(2, c.Count);
            Assert.AreEqual(1, c.AddedItems.Count);
            Assert.AreEqual(1, c.ModifiedItems.Count);
            Assert.AreEqual(1, c.RemovedItems.Count);

            c.RejectChanges();

            Assert.AreEqual(2, c.Count);
            Assert.IsTrue(c.Contains(emailToModify));
            Assert.IsTrue(c.Contains(emailToRemove));

            Assert.AreEqual(0, c.AddedItems.Count);
            Assert.AreEqual(0, c.ModifiedItems.Count);
            Assert.AreEqual(0, c.RemovedItems.Count);

            Assert.IsFalse(emailToModify.IsChanged);
            Assert.AreEqual("*****@*****.**", emailToModify.Email);
            Assert.AreEqual("*****@*****.**", emailToModify.EmailOriginalValue);

            Assert.IsFalse(c.IsChanged);
        }