コード例 #1
0
        public void Priority_ReturnsInteger_WhenCalled()
        {
            // Arrange
            CellInformation info = CreateCellInformation();
            NewbornRule     sut  = CreateSut();

            // Act
            sut.Apply(info);

            // Assert
            sut.Priority.ShouldEqual(4);
        }
コード例 #2
0
        public void Apply_SetsStatusToDead_WhenCalled()
        {
            // Arrange
            CellInformation info = CreateCellInformation();
            NewbornRule     sut  = CreateSut();

            // Act
            sut.Apply(info);

            // Assert
            info.Status.ShouldEqual(Cell.Status.Dead);
        }
コード例 #3
0
        public void Initialize_AddsMoreThanRule_WhenCalled()
        {
            // Arrange
            CellInformation info = CreateCellInformation();
            NewbornRule     sut  = CreateSut();

            // Act
            sut.Initialize(info);

            // Assert
            sut.GetConditions().First().ShouldBeInstanceOf <IsEqual>();
        }
コード例 #4
0
        public void Initialize_AddsConditions_WhenCalled()
        {
            // Arrange
            CellInformation info = CreateCellInformation();
            NewbornRule     sut  = CreateSut();

            // Act
            sut.Initialize(info);

            // Assert
            sut.GetConditions().Count().ShouldEqual(1);
        }
コード例 #5
0
        public void IsValid_ReturnsTrueOrFalse_ForGivenNeighbours(int neighbours,
                                                                  bool expected)
        {
            // Arrange
            CellInformation info = CreateCellInformation(neighbours);
            NewbornRule     sut  = CreateSut();

            sut.Initialize(info);

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

            // Assert
            Assert.Equal(expected,
                         actual);
        }
コード例 #6
0
        private NewbornRule CreateSut()
        {
            var newbornRule = new NewbornRule();

            return(newbornRule);
        }