public void UniqueRandomPickerShouldBeAbleToPickFromList()
        {
            var list   = Substitute.For <IList <MyClass> >();
            var picker = new UniqueRandomPicker <MyClass>(constraint, uniqueRandomGenerator);

            var capacity    = 10;
            var randomIndex = 3;
            var end         = 2;

            list.Count.Returns(capacity);
            constraint.GetEnd().Returns(end);
            uniqueRandomGenerator.Next(0, capacity).Returns(randomIndex);
            list[randomIndex].Returns(new MyClass());

            picker.From(list);

            uniqueRandomGenerator.Received().Reset();
        }
        public IList <T> From(IList <T> listToPickFrom)
        {
            uniqueRandomGenerator.Reset();

            int capacity     = listToPickFrom.Count;
            var listToReturn = new List <T>();

            int end = constraint.GetEnd();

            for (int i = 0; i < end; i++)
            {
                int index = uniqueRandomGenerator.Next(0, capacity);

                listToReturn.Add(listToPickFrom[index]);
            }

            return(listToReturn);
        }