Пример #1
0
 private void VerifySignalsAreCloned(LivingInfectedCell sut, ICell result, ushort signals, ICellVisitor visitor)
 {
     sut.Accept(visitor);
     result.Accept(visitor);
     Mock.Get(visitor)
     .Verify(v => v.VisitCell(
                 It.IsAny <bool>(),
                 It.Is <ushort>(self => self == signals),
                 It.Is <ushort>(alert => alert == signals)),
             Times.Exactly(2));
 }
Пример #2
0
        internal void CloningALivingCellDoesReplicatesTheGermAndReturnsInfectedCell(
            [Frozen] IGerm germ,
            [Frozen] ushort signals,
            [Frozen] ICellVisitor visitor,
            LivingInfectedCell sut)
        {
            var result = sut.Clone();

            result.Should().BeOfType <InfectedCell>();
            VerifyTimesGermReplicatIsCalled(1, germ);
            VerifySignalsAreCloned(sut, result, signals, visitor);
        }
Пример #3
0
        internal void MatureLyticGermKillsCellWhileCloning(
            [Frozen(Matching.ImplementedInterfaces)] MatureLyticGerm lyticGerm,
            [Frozen] ICellVisitor visitor,
            LivingInfectedCell sut)
        {
            bool isAlive    = true;
            bool isNotAlive = false;

            sut.Accept(visitor);

            VerifyCellIsAlive(visitor, isAlive);

            var result = sut.Clone();

            result.Accept(visitor);
            result.Should().BeOfType <InfectedCell>();
            VerifyCellIsAlive(visitor, isNotAlive);
        }