Ejemplo n.º 1
0
        public void ShouldReturnDyingCellForNextTurn()
        {
            LiveCell liveCell = new LiveCell(Guid.NewGuid());

            Cell returnCell = liveCell.GenerateNextTurnStatus(new FakeDeadRule(), null);

            returnCell.Should().BeOfType <DeadCell>();
        }
Ejemplo n.º 2
0
        public void ShouldReturnTrueIfOtherNeighbor()
        {
            LiveCell cell1 = new LiveCell(Guid.NewGuid());
            LiveCell cell2 = new LiveCell(Guid.NewGuid());

            Relationship relationship = new Relationship(cell1, cell2);

            relationship.IsNeighborOf(cell2).Should().BeTrue();
        }
Ejemplo n.º 3
0
        public void ShouldReturnFalseIfNotNeighbor()
        {
            LiveCell cell1 = new LiveCell(Guid.NewGuid());
            LiveCell cell2 = new LiveCell(Guid.NewGuid());
            DeadCell cell3 = new DeadCell(Guid.NewGuid());

            Relationship relationship = new Relationship(cell1, cell3);

            relationship.IsNeighborOf(cell2).Should().BeFalse();
        }
Ejemplo n.º 4
0
        public void ShouldLiveIfLiveAndTwoLiveNeighbors()
        {
            LiveCell liveCell = new LiveCell(Guid.NewGuid());
            Rule     rule     = new Rule();

            Cell returnCell = rule.EvaluateTick(liveCell, new List <Cell> {
                new LiveCell(Guid.NewGuid()), new LiveCell(Guid.NewGuid())
            });

            returnCell.Should().BeOfType <LiveCell>();
        }
Ejemplo n.º 5
0
        public void ShouldDieWithFewerThanTwo()
        {
            LiveCell liveCell = new LiveCell(Guid.NewGuid());
            Rule     rule     = new Rule();

            Cell returnCell = rule.EvaluateTick(liveCell, new List <Cell> {
                new LiveCell(Guid.NewGuid())
            });

            returnCell.Should().BeOfType <DeadCell>();
        }
Ejemplo n.º 6
0
        public void ShouldReturnRelationshipsForCell()
        {
            Cell cell1 = new LiveCell(Guid.NewGuid());
            Cell cell2 = new LiveCell(Guid.NewGuid());

            Relationships relationships = new Relationships();

            relationships.CreateNewRelationship(cell1, cell2);

            List <Relationship> neighbors = relationships.GetNeighbors(cell1);

            neighbors.Should().HaveCount(1);
        }