예제 #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
        public (ConsoleColor, string) GetColorEncodedCell(ICell cell)
        {
            (_colorCode, _currentCellCode) = cell switch
            {
                InfectedCell _ => (ConsoleColor.Red, "I"),
                HealthyCell _ => (ConsoleColor.Green, "C"),
                _ => (ConsoleColor.DarkYellow, string.Empty)
            };

            cell?.Accept(this);

            return(_colorCode, _currentCellCode);
        }
예제 #3
0
        public string GetEncodedCell(ICell cell)
        {
            _currentCellCode = cell switch
            {
                InfectedCell _ => "I",
                HealthyCell _ => "C",
                             _ => string.Empty
            };

            cell?.Accept(this);

            return(_currentCellCode);
        }