internal void VirusReplicationReturnsNewVirus( LyticVirus sut) { var result = sut.Replicate(); result.Should().NotBeSameAs(sut); }
internal void NewlyConstructedVirusTellsVisitorItIsLyticButNotMature( IGermVistor visitor, LyticVirus sut) { sut.Accept(visitor); bool isNotMature = false; VerifyGerm(isNotMature, visitor); }
internal void VirusCanInfectHealthyCellsInOneOutOfTenTimes( HealthyCell cellToInfect, LyticVirus sut) { var result = new List <ICell>(); var numberOfTries = (int)Ceiling(InfectionFailureRate * 3 * 10); for (int currentTry = 0; currentTry < numberOfTries; currentTry++) { result.Add(sut.InfectCell(cellToInfect).Clone()); } VerifyAtLeastOneCellGotInfected(result); }
internal void VirusDoesNotInfectAlreadyInfectedCellsOrNullCells( InfectedCell infectedCellToInfect, NullCell nullCellToInfect, LyticVirus sut) { var result = new List <ICell>(); var numberOfTries = (int)Ceiling(InfectionFailureRate * 3 * 10); for (int currentTry = 0; currentTry < numberOfTries; currentTry++) { result.Add(sut.InfectCell(infectedCellToInfect).Clone()); result.Add(sut.InfectCell(nullCellToInfect).Clone()); } VerifyNoNewlyInfectedCellsArePresent(result, numberOfTries); }
internal void VirusMaturesAfterTwoGenerationsSendsMessageAndTellsVisitorItIsMature( [Frozen] EventAggregator eventAggregator, IListenOn <GermGrowthMessage> listener, IGermVistor visitor, LyticVirus sut) { eventAggregator.Subscribe(listener); IGerm matureVirus = sut; for (int gen = 0; gen <= GenerationToMature; gen++) { matureVirus = matureVirus.Replicate(); } VerifyGermIsMature(visitor, matureVirus); VerifyCorrectMessageIsSent(listener, matureVirus); }