Exemple #1
0
 public void ACounterCanFlipBetweenColours(string originalColour, string newColour)
 {
     var counter = new Counter(originalColour);
     Assert.That(originalColour, Is.EqualTo(counter.ColourDisplayed));
     counter.Flip();
     Assert.That(newColour, Is.EqualTo(counter.ColourDisplayed));
 }
Exemple #2
0
        public void APieceCanOnlyBePlacedNextToAPieceOfTheOppositeColour(string gridRef, bool result)
        {
            var board = new OthelloBoard();

            var counter = new Counter {Colour = "black"};
            board.AcceptPlay(gridRef, counter);
            Assert.That(board.ViewBoardSquare(gridRef) == counter, Is.EqualTo(result));
        }
Exemple #3
0
 public void ASquareKnowsItsContents(string newContents, string originalContents)
 {
     var square = new Square();
     var counter = new Counter();
     counter.Colour = originalContents;
     square.PlacePiece(counter);
     counter.Flip();
     Assert.That(square.Contents().Colour, Is.EqualTo(newContents));
 }
Exemple #4
0
 public void APieceCanOnlyBePlacedIfALineEndsInAPieceOfTheSameColour()
 {
     var board = new OthelloBoard();
     var counter1 = new Counter {Colour = "black"};
     var counter2 = new Counter {Colour = "white"};
     var counter3 = new Counter {Colour = "black"};
     var counter4 = new Counter {Colour = "white"};
     board.AcceptPlay("E3", counter1);
     Assert.That(board.ViewBoardSquare("E3"), Is.Not.EqualTo(counter1));
     board.AcceptPlay("D3", counter1);
     Assert.That(board.ViewBoardSquare("D3"), Is.EqualTo(counter1));
     board.AcceptPlay("D2", counter2);
     Assert.That(board.ViewBoardSquare("D2"), Is.Not.EqualTo(counter2));
     board.AcceptPlay("C3", counter2);
     Assert.That(board.ViewBoardSquare("C3"), Is.EqualTo(counter2));
     board.AcceptPlay("C4", counter3);
     Assert.That(board.ViewBoardSquare("C4"), Is.EqualTo(counter3));
     board.AcceptPlay("E3", counter4);
     Assert.That(board.ViewBoardSquare("E3"), Is.EqualTo(counter4));
 }
Exemple #5
0
 public PasswordGenerator()
 {
     _counter = new Counter();
     _validator = new PasswordValidator();
 }
Exemple #6
0
        private void PlaceInitialPieces()
        {
            var whitePiece = new Counter() {Colour = "white"};
            var whitePiece2 = new Counter() {Colour = "white"};
            var blackPiece = new Counter() {Colour = "black"};
            var blackPiece2 = new Counter() {Colour = "black"};

            SetUp("D4", whitePiece);
            SetUp("E5", whitePiece2);
            SetUp("D5", blackPiece);
            SetUp("E4", blackPiece2);
        }
 public PasswordGenerator()
 {
     _counter   = new Counter();
     _validator = new PasswordValidator();
 }