public void AllocatePlacesPeopleInFinalAllocation() { var deskRandomizer = new DeskRandomizer(6); deskRandomizer.Allocate(deskRandomizer.People.ToList()); Assert.Equal(new List <int> { 1, 4, 2, 5, 3, 6 }.ToArray(), deskRandomizer.FinalArrangement); }
public void AllocatePlacesPeopleInWithNoPreviousNeighbours() { var deskRandomizer = new DeskRandomizer(6); deskRandomizer.Allocate(deskRandomizer.People.ToList()); var expected = new List <int> { 1, 4, 2, 5, 3, 6 }.ToArray(); Assert.Equal(expected, deskRandomizer.FinalArrangement); }
public void PlacesLastPersonCorrectlyWhenLastPersonShouldBeFirstPlace() { var deskRandomizer = new DeskRandomizer(6); deskRandomizer.Allocate(new List <int> { 4, 3, 6, 5, 1, 2 }); Assert.Equal(new List <int> { 2, 6, 3, 5, 1, 4 }.ToArray(), deskRandomizer.FinalArrangement); }
public void PlacesLastPersonCorrectlyWhenLastPersonShouldBeSecondLastPlace() { var deskRandomizer = new DeskRandomizer(6); deskRandomizer.Allocate(new List <int> { 1, 5, 3, 6, 4, -1 }); deskRandomizer.PlaceLastPerson(2); Assert.Equal(new List <int> { 1, 5, 3, 6, 2, 4 }.ToArray(), deskRandomizer.FinalArrangement); }
public void AllocatePlacesPeopleInWithNoPreviousNeighboursWithShuffle() { var deskRandomizer = new DeskRandomizer(11); deskRandomizer.ShufflePeople(); deskRandomizer.Allocate(deskRandomizer.People.ToList()); var passed = true; for (var i = 0; i < 11; i++) { if (deskRandomizer.HasPreviousNeighbours(i, deskRandomizer.FinalArrangement[i], deskRandomizer.FinalArrangement)) { Assert.Equal(new List <int> { 1, 4, 2, 5, 3, 6 }.ToArray(), deskRandomizer.BeforePlacement); Assert.False(true); } ; } }