public void Insert_ExtractMin_ProperUseOfHeap_NoExceptionsExpected(int randomSeed, int size) { //arrange var heap = new HeapOfMaximalSize <int>(size); RandomEnum rndE = new RandomEnum(randomSeed); List <int> inputs = rndE.Take(size).ToList(); List <int> outputs = new List <int>(); //act for (int i = 0; i < inputs.Count; i++) { heap.Insert(inputs[i]); } for (int i = 0; i < size; i++) { outputs.Add(heap.ExtractMin()); } //assert var expected = inputs; expected.Sort(); CollectionAssert.AreEqual(expected, outputs); }
public DefaultSelector( NewBestCretureFoundEventDelegate <Creature> newBestFound, RatedCreature <Creature> foreFather, int NumberOfSurvivals, DisposedCreaturesStore <Creature> disposedCreatures) { NewBestCretureFound = newBestFound; DisposedCreatures = disposedCreatures; heap = new HeapOfMaximalSize <RatedCreature <Creature> >(NumberOfSurvivals); bestCreature = foreFather; AddCreature(foreFather); }