public void GivenEmptyPeopleList_ShouldReturn_EmptyList()
        {
            var xProperties = new Expression <Func <Person, object> >[] { p => p.Job, p => p.Surname };
            var yProperties = new Expression <Func <Person, object> >[] { p => p.Age };
            var algorithm   = new XYAnonimization(3, _jobDictionary, _cityDictionary, xProperties, yProperties);
            var anonymized  = algorithm.GetAnonymizedData(new List <Person>());

            Assert.IsTrue(!anonymized.Any());
        }
        public void GivenKParameterOne_ShouldReturnTheSameList()
        {
            var xProperties = new Expression <Func <Person, object> >[] { p => p.Job, p => p.Surname };
            var yProperties = new Expression <Func <Person, object> >[] { p => p.Age };
            var algorithm   = new XYAnonimization(1, _jobDictionary, _cityDictionary, xProperties, yProperties);
            var anonymzed   = algorithm.GetAnonymizedData(_people);

            Assert.IsTrue(_people.Count == anonymzed.Count);
            Assert.IsTrue(_people.All(p => anonymzed.Exists(x => x.FirstName == p.FirstName && x.Surname == p.Surname &&
                                                            x.Age == p.Age && x.Job == p.Job && x.City == p.City &&
                                                            x.Gender == p.Gender)));
        }
        public void GivenKParameter_GreaterThan_1_ShouldReturnAnonymizedList(int parameterK)
        {
            var xProperties = new Expression <Func <Person, object> >[] { p => p.Job, p => p.Surname };
            var yProperties = new Expression <Func <Person, object> >[] { p => p.Age };
            var algorithm   = new XYAnonimization(parameterK, _jobDictionary, _cityDictionary, xProperties, yProperties);

            var anonymzed = algorithm.GetAnonymizedData(_people);

            Assert.AreEqual(_people.Count, anonymzed.Count);
            //All Groups grouped by X set have at least K unique Y set attribute values
            Assert.IsTrue(anonymzed.GroupBy(x => new { x.Job, x.Surname })
                          .All(g =>
            {
                var uniqueYValues = g.GroupBy(p => p.Age).Count();
                return(uniqueYValues >= parameterK);
            }));
        }