Beispiel #1
0
        public void MoveNext_CanNotMoveNext_Throws(CellStatusType currentStatus, CellInteractionType command, bool?isMine)
        {
            // Arrange
            CellStatusManager componentUnderTest = CreateCellStatusManager(currentStatus);

            // Act && Assert
            Action testAction = () => componentUnderTest.MoveNext(command, isMine);

            testAction.Should().Throw <InvalidOperationException>();
        }
        protected override Task OnUpdateAsync(IEnumerable <UncoverableCell> uncoverableCells, Minesweeper.Logic.Abstractions.Location clickedLocation)
        {
            foreach (UncoverableCell uncoverableCell in uncoverableCells)
            {
                CellInteractionType interactionType =
                    uncoverableCell.Cell.Location == clickedLocation
                                        ? CellInteractionType.LeftClick
                                        : CellInteractionType.Automatic;

                uncoverableCell.Cell.SetUncoveredStatus(interactionType, uncoverableCell.IsMine, uncoverableCell.AdjacentMineCount);
            }

            return(Task.CompletedTask);
        }
Beispiel #3
0
        public void CanMoveNext_DefinedTransition_ReturnsTrue(CellStatusType currentStatus, CellInteractionType command, bool?isMine)
        {
            // Arrange
            CellStatusManager componentUnderTest = CreateCellStatusManager(currentStatus);

            // Act
            bool result = componentUnderTest.CanMoveNext(command, isMine);

            // Assert
            result.Should().BeTrue();
        }
Beispiel #4
0
        public void MoveNext_DefinedTransition_ReturnsNextStatus(CellStatusType currentStatus, CellInteractionType command, bool?isMine, CellStatusType expectedNextStatus)
        {
            // Arrange
            CellStatusManager componentUnderTest = CreateCellStatusManager(currentStatus);

            // Act
            CellStatusType result = componentUnderTest.MoveNext(command, isMine);

            // Assert
            result.Should().Be(expectedNextStatus);
        }
 public CellStatusTransitionCommand(CellInteractionType mouseButtonType, bool?isMine = null)
 {
     MouseButtonType = mouseButtonType;
     IsMine          = isMine;
 }