public void Create_ReturnsInstance_WhenCalled()
        {
            // Arrange
            var sut = new CircleOfPeopleFactory();

            // Act
            ICircleOfPeople actual = sut.Create(3);

            // Assert
            Assert.NotNull(actual);
        }
Beispiel #2
0
        public IEnumerable <int> Run(int numberOfPeopleStandingInACircle,
                                     int numberOfPeopleToCountOverEachTime)
        {
            CheckParameters(numberOfPeopleStandingInACircle,
                            numberOfPeopleToCountOverEachTime);

            ICircleOfPeople circleOfPeople = m_Factory.Create(numberOfPeopleStandingInACircle);

            IEnumerable <int> removedPersonIds = StartCountingTo(circleOfPeople,
                                                                 numberOfPeopleToCountOverEachTime);

            m_Factory.Release(circleOfPeople);

            return(removedPersonIds);
        }
Beispiel #3
0
        private IEnumerable <int> StartCountingTo([NotNull] ICircleOfPeople circleOfPeople,
                                                  int countTo)
        {
            var removedPersonIds = new List <int>();
            var fromPersonId     = 1;

            do
            {
                int removedPersonId = circleOfPeople.NextPersonForCountTo(fromPersonId,
                                                                          countTo);

                fromPersonId = circleOfPeople.NextPerson(removedPersonId);
                circleOfPeople.RemovePerson(removedPersonId);
                removedPersonIds.Add(removedPersonId);
            }while (circleOfPeople.PeopleStanding.Any());

            return(removedPersonIds);
        }
Beispiel #4
0
 public void Release(ICircleOfPeople circleOfPeople)
 {
 }