daily pastebin goal
0%
SHARE
TWEET

Untitled

a guest Mar 18th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         [Fact]
  2.         public void WinningCondition_DiagonalWin_Complex_ShouldReturnTrue()
  3.         {
  4.             // arrange
  5.  
  6.             Board board = new ViewModels.Board(4, 4);
  7.  
  8.             // __OO
  9.             // _OX_
  10.             // OXX_
  11.             // _X__
  12.             var cross = SignType.Cross;
  13.             var circle = SignType.Circle;
  14.             board.SetSignOnCell(2, circle);
  15.             board.SetSignOnCell(3, circle);
  16.             board.SetSignOnCell(5, circle);
  17.             board.SetSignOnCell(6, cross);
  18.             board.SetSignOnCell(8, circle);
  19.             board.SetSignOnCell(9, cross);
  20.             board.SetSignOnCell(10, cross);
  21.             board.SetSignOnCell(13, cross);
  22.  
  23.             // act
  24.             bool isBoardInWinningState = GameUtils.IsWinningConditionSatisfied(board, 3);
  25.  
  26.             // assert
  27.             Assert.True(isBoardInWinningState);
  28.         }
  29.  
  30.         [Fact]
  31.         public void WinningCondition_DiagonalWin_Complex_ShouldReturnFalse()
  32.         {
  33.             // arrange
  34.  
  35.             Board board = new ViewModels.Board(4, 4);
  36.  
  37.             // OO_O
  38.             // O_OO
  39.             // XX_X
  40.             // X_XX
  41.             var cross = SignType.Cross;
  42.             var circle = SignType.Circle;
  43.             board.SetSignOnCell(0, circle);
  44.             board.SetSignOnCell(1, circle);
  45.             board.SetSignOnCell(3, circle);
  46.             board.SetSignOnCell(4, circle);
  47.             board.SetSignOnCell(6, circle);
  48.             board.SetSignOnCell(7, circle);
  49.  
  50.             board.SetSignOnCell(8, cross);
  51.             board.SetSignOnCell(9, cross);
  52.             board.SetSignOnCell(11, cross);
  53.             board.SetSignOnCell(12, cross);
  54.             board.SetSignOnCell(14, cross);
  55.             board.SetSignOnCell(15, cross);
  56.  
  57.             // act
  58.             bool isBoardInWinningState = GameUtils.IsWinningConditionSatisfied(board, 3);
  59.  
  60.             // assert
  61.             Assert.False(isBoardInWinningState);
  62.         }
  63.  
  64.         [Fact]
  65.         public void WinningCondition_LineWin_Complex2_ShouldReturnTrue()
  66.         {
  67.             // arrange
  68.  
  69.             Board board = new ViewModels.Board(3, 5);
  70.  
  71.             // X_XXO
  72.             // XOOOX
  73.             // OOXOX
  74.             var cross = SignType.Cross;
  75.             var circle = SignType.Circle;
  76.             board.SetSignOnCell(0, cross);
  77.             board.SetSignOnCell(2, cross);
  78.             board.SetSignOnCell(3, cross);
  79.             board.SetSignOnCell(4, circle);
  80.  
  81.             board.SetSignOnCell(5, cross);
  82.             board.SetSignOnCell(6, circle);
  83.             board.SetSignOnCell(7, circle);
  84.             board.SetSignOnCell(8, circle);
  85.             board.SetSignOnCell(9, cross);
  86.  
  87.             board.SetSignOnCell(10, circle);
  88.             board.SetSignOnCell(11, circle);
  89.             board.SetSignOnCell(12, cross);
  90.             board.SetSignOnCell(13, circle);
  91.             board.SetSignOnCell(14, cross);
  92.  
  93.             // act
  94.             bool isBoardInWinningState = GameUtils.IsWinningConditionSatisfied(board, 3);
  95.  
  96.             // assert
  97.             Assert.True(isBoardInWinningState);
  98.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top