Ejemplo n.º 1
0
        public void CreateMineField_CallsConverter_ForGivenText()
        {
            // Arrange
            MineFieldManager sut = CreateSut();

            // Act
            sut.CreateMineField("Doesn't matter!");

            // Assert
            m_Converter.Received().ToMineField("Doesn't matter!");
        }
Ejemplo n.º 2
0
        public void CreateMineField_CallsCreateCommon_ForGivenText()
        {
            // Arrange
            MineFieldManager sut = CreateSut();

            // Act
            sut.CreateMineField("Doesn't matter!");

            // Assert
            m_HintFieldFactory.Received().Create(Arg.Any <IMineField>());
        }
Ejemplo n.º 3
0
        public void CreateMineField_PutMinesAtRandomLocation_WhenCalled()
        {
            // Arrange
            MineFieldManager sut = CreateSut();

            // Act
            sut.CreateMineField(1,
                                2,
                                3);

            // Assert
            m_MineLayer.Received().PutMinesAtRandomLocation(3);
        }
Ejemplo n.º 4
0
        public void CreateMineField_CreatesPlayingField_WhenCalled()
        {
            // Arrange
            MineFieldManager sut = CreateSut();

            // Act
            sut.CreateMineField(1,
                                2,
                                3);

            // Assert
            m_PlayingFieldFactory.Received().Create(m_MineField);
        }
Ejemplo n.º 5
0
        public void CreateMineField_CreatesUserOutput_WhenCalled()
        {
            // Arrange
            MineFieldManager sut = CreateSut();

            // Act
            sut.CreateMineField(1,
                                2,
                                3);

            // Assert
            m_UserOutputFactory.Received().Create(m_HintField,
                                                  m_PlayingField);
        }
Ejemplo n.º 6
0
        public void DisplayPlayingField_CallsUserOutput_WhenCalled()
        {
            // Arrange
            MineFieldManager sut = CreateSut();

            sut.CreateMineField(1,
                                2,
                                3);

            // Act
            sut.DisplayPlayingField();

            // Assert
            m_UserOutput.Received().DisplayPlayingField();
        }
        public void RowsCount_ReturnsCOunt_WhenCalled()
        {
            // Arrange
            MineFieldManager sut = CreateSut();

            m_MineField.RowsCount.Returns(1);

            // Act
            sut.CreateMineField(1,
                                2,
                                3);

            // Assert
            Assert.AreEqual(1,
                            sut.RowsCount);
        }
Ejemplo n.º 8
0
        public void UserSelectedField_CallsPlayingField_WhenCalled()
        {
            // Arrange
            MineFieldManager sut = CreateSut();

            sut.CreateMineField(1,
                                2,
                                3);

            // Act
            sut.UserSelectedField(1,
                                  2);

            // Assert
            m_PlayingField.Received().SelectField(1,
                                                  2);
        }
Ejemplo n.º 9
0
        public void UserSelectedField_UpdatesStatus_WhenPlayerSelectedMine()
        {
            // Arrange
            MineFieldManager sut = CreateSut();

            sut.CreateMineField(1,
                                2,
                                3);
            m_MineField.IsMineAt(1,
                                 2).Returns(true);

            // Act
            sut.UserSelectedField(1,
                                  2);

            // Assert
            Assert.AreEqual(GameStatus.Player.SelectedFieldWithMine,
                            sut.Status);
        }
        public void GetHintFor_ReturnsHint_ForRowAndColumn()
        {
            // Arrange
            m_HintField.GetHintFor(Arg.Any <int>(),
                                   Arg.Any <int>()).Returns(1);

            MineFieldManager sut = CreateSut();

            sut.CreateMineField(1,
                                2,
                                3);

            // Act
            int actual = sut.GetHintFor(1,
                                        2);

            // Assert
            Assert.AreEqual(1,
                            actual);
        }
Ejemplo n.º 11
0
        public void CreateMineField_CreatesMineField_ForGivenText()
        {
            // Arrange
            var mineField = Substitute.For <IMineField>();

            mineField.RowsCount.Returns(1);
            mineField.ColumnsCount.Returns(2);
            m_Converter.ToMineField(Arg.Any <string>()).Returns(mineField);
            MineFieldManager sut = CreateSut();

            // Act
            sut.CreateMineField("Doesn't matter!");

            // Assert
            Assert.AreEqual(1,
                            mineField.RowsCount,
                            "RowsCount");
            Assert.AreEqual(2,
                            mineField.ColumnsCount,
                            "ColumnsCount");
        }