public void TestSameTeam()
        {
            var sameTeamPeopleData = new Dictionary <string, PersonData>
            {
                { "0", new PersonData {
                      Teams = new List <string> {
                          "dc"
                      }
                  } },
                { "3", new PersonData {
                      Teams = new List <string> {
                          "dc", "gotham"
                      }
                  } }
            };

            var prefs = new PersonPreferences("0", this.group, this.userIdToPerson, sameTeamPeopleData).Get();

            var actualNames   = prefs.Select(person => person.Data.Name).ToList();
            var expectedNames = new List <string> {
                "3Batman", "1Catwoman", "2Spiderman"
            };

            CollectionAssert.AreEqual(expectedNames, actualNames);
        }
        public void TestNoPeopleData()
        {
            var emptyPeopleData = new Dictionary <string, PersonData>();
            var prefs           = new PersonPreferences("0", this.group, this.userIdToPerson, emptyPeopleData).Get();

            var actualNames   = prefs.Select(person => person.Data.Name).ToList();
            var expectedNames = new List <string> {
                "1Catwoman", "2Spiderman", "3Batman"
            };

            CollectionAssert.AreEqual(expectedNames, actualNames);
        }
        public void TestLowPreferences()
        {
            var sameTeamPeopleData = new Dictionary <string, PersonData>
            {
                { "0", new PersonData
                  {
                      Teams = new List <string> {
                          "dc"
                      },
                      PastMatches = new List <PastMatch> {
                          new PastMatch("3", DateTime.Today)
                      },
                      LowPreferenceNames = new List <string>
                      {
                          "2Spiderman"
                      }
                  } },
                { "1", new PersonData
                  {
                      Name  = "1Catwoman",
                      Teams = new List <string> {
                          "dc", "gotham"
                      },
                      Seniority = "principal"
                  } },
                { "2", new PersonData
                  {
                      Name = "2Spiderman"
                  } },
                { "3", new PersonData
                  {
                      Name = "3Batman"
                  } }
            };

            var prefs = new PersonPreferences("0", this.group, this.userIdToPerson, sameTeamPeopleData).Get();

            var actualNames = prefs.Select(person => person.Data.Name).ToList();

            // No matches, previous matches, low preference
            var expectedNames = new List <string> {
                "1Catwoman", "3Batman", "2Spiderman"
            };

            CollectionAssert.AreEqual(expectedNames, actualNames);
        }
        public void TestSameNoTeam()
        {
            // If both the source and the candidates have no team, they are not considered "on the same team"
            var sameTeamPeopleData = new Dictionary <string, PersonData>
            {
                { "1", new PersonData {
                      Teams = new List <string> {
                          "dc"
                      }
                  } }
            };

            var prefs = new PersonPreferences("0", this.group, this.userIdToPerson, sameTeamPeopleData).Get();

            var actualNames   = prefs.Select(person => person.Data.Name).ToList();
            var expectedNames = new List <string> {
                "1Catwoman", "2Spiderman", "3Batman"
            };

            CollectionAssert.AreEqual(expectedNames, actualNames);
        }