public void TrackManyChangesForTheUserEntity()
        {
            var oldUserEntity = new UserEntity
            {
                Id       = Guid.NewGuid(),
                Email    = "*****@*****.**",
                Name     = "some name",
                UserType = UserType.Customer
            };
            var config        = TrackingEntitiesConfiguration.GetConfigFor(oldUserEntity.GetType());
            var newUserEntity = oldUserEntity.DeepClone();

            newUserEntity.Name     = "new name";
            newUserEntity.Email    = "*****@*****.**";
            newUserEntity.UserType = UserType.Reseller;

            var result = GetPropertyChangesWay2.GetChangesFor(oldUserEntity, newUserEntity, config);

            Assert.IsTrue(result.Count == 3);
            var userTypeChange = result.FirstOrDefault(x => x.PropertyName == "UserType");

            Assert.IsTrue(userTypeChange != null);

            Assert.IsTrue(userTypeChange.OldValue == oldUserEntity.UserType.ToString());
            Assert.IsTrue(userTypeChange.NewValue == newUserEntity.UserType.ToString());
        }
        public void TrackFirstOneChangeForTheUserEntity()
        {
            var oldUserEntity = new UserEntity();
            var config        = TrackingEntitiesConfiguration.GetConfigFor(oldUserEntity.GetType());
            var newUserEntity = oldUserEntity.DeepClone();

            newUserEntity.Name = "new name";

            var result = GetPropertyChangesWay2.GetChangesFor(oldUserEntity, newUserEntity, config);

            Assert.IsTrue(result.Count == 1);
            Assert.IsTrue(result.First().OldValue == null);
            Assert.IsTrue(result.First().NewValue == (newUserEntity.Name ?? string.Empty));
        }
        public void TrackOneChangeForTheUserEntity()
        {
            var oldUserEntity = new UserEntity
            {
                Id       = Guid.NewGuid(),
                Email    = "*****@*****.**",
                Name     = "some name",
                UserType = UserType.Customer
            };
            var config        = TrackingEntitiesConfiguration.GetConfigFor(oldUserEntity.GetType());
            var newUserEntity = oldUserEntity.DeepClone();

            newUserEntity.Name = "new name";

            var result = GetPropertyChangesWay2.GetChangesFor(oldUserEntity, newUserEntity, config);

            Assert.IsTrue(result.Count == 1);
            Assert.IsTrue(result.First().OldValue == oldUserEntity.Name);
            Assert.IsTrue(result.First().NewValue == newUserEntity.Name);
        }