Beispiel #1
0
        public void Priority_ReturnsInteger_WhenCalled()
        {
            // Arrange
            CellInformation info = CreateCellInformation();
            SurvivorRule    sut  = CreateSut();

            // Act
            sut.Apply(info);

            // Assert
            sut.Priority.ShouldEqual(3);
        }
Beispiel #2
0
        public void Apply_SetsStatusToDead_WhenCalled()
        {
            // Arrange
            CellInformation info = CreateCellInformation();
            SurvivorRule    sut  = CreateSut();

            // Act
            sut.Apply(info);

            // Assert
            info.Status.ShouldEqual(Cell.Status.Alive);
        }
Beispiel #3
0
        public void Initialize_AddsLessThanRule_WhenCalled()
        {
            // Arrange
            CellInformation info = CreateCellInformation();
            SurvivorRule    sut  = CreateSut();

            // Act
            sut.Initialize(info);

            // Assert
            sut.GetConditions().Last().ShouldBeInstanceOf <IsLessThan>();
        }
Beispiel #4
0
        public void Initialize_AddsConditions_WhenCalled()
        {
            // Arrange
            CellInformation info = CreateCellInformation();
            SurvivorRule    sut  = CreateSut();

            // Act
            sut.Initialize(info);

            // Assert
            sut.GetConditions().Count().ShouldEqual(2);
        }
Beispiel #5
0
        public void IsValid_ReturnsTrueOrFalse_ForGivenNeighbours(int neighbours,
                                                                  bool expected)
        {
            // Arrange
            CellInformation info = CreateCellInformation(neighbours);
            SurvivorRule    sut  = CreateSut();

            sut.Initialize(info);

            // Act
            bool actual = sut.IsValid();

            // Assert
            Assert.Equal(expected,
                         actual);
        }
Beispiel #6
0
        private SurvivorRule CreateSut()
        {
            var survivorRule = new SurvivorRule();

            return(survivorRule);
        }