public void StartGameShouldAddToLoggerAndCallBaseMethod() { const string OtherPlayerIdentifier = "тест"; var logger = new MemoryLogger(); var playerMock = new Mock <IPlayer>(); var playerWithLogger = new PlayerWithLoggerDecorator(playerMock.Object, logger); playerWithLogger.StartGame(OtherPlayerIdentifier); Assert.IsTrue(logger.ToString().Length > 0); Assert.IsTrue(logger.ToString().Contains(OtherPlayerIdentifier)); playerMock.Verify(x => x.StartGame(It.IsAny <string>()), Times.Once()); }
public void LogShouldAppendTheTextWhenCalledTwoTimesInARow() { ILogger logger = new MemoryLogger(); logger.Log("test"); logger.Log("тест"); Assert.AreEqual("testтест", logger.ToString()); }
public void LogLineShouldAppendLineAtTheEnd() { const string Message = "test"; ILogger logger = new MemoryLogger(); logger.LogLine(Message); Assert.AreEqual(Message + Environment.NewLine, logger.ToString()); }
public void LogShouldAppendTheTextWhenCalledTwoTimesInARow() { ILogger logger = new MemoryLogger(); logger.Log("test"); logger.Log("тест"); Assert.Equal("testтест", logger.ToString()); }
public void LogLineShouldAppendLineAtTheEnd() { const string Message = "test"; ILogger logger = new MemoryLogger(); logger.LogLine(Message); Assert.Equal(Message + Environment.NewLine, logger.ToString()); }
public void LogLineShouldAppendLineBetweenTwoLogCalls() { const string FirstMessage = "test"; const string SecondMessage = "тест"; ILogger logger = new MemoryLogger(); logger.LogLine(FirstMessage); logger.Log(SecondMessage); Assert.AreEqual(FirstMessage + Environment.NewLine + SecondMessage, logger.ToString()); }
public void EndRoundShouldAddToLoggerAndCallBaseMethod() { var logger = new MemoryLogger(); var playerMock = new Mock<IPlayer>(); var playerWithLogger = new PlayerWithLoggerDecorator(playerMock.Object, logger); playerWithLogger.EndRound(); Assert.IsTrue(logger.ToString().Length > 0); playerMock.Verify(x => x.EndRound(), Times.Once()); }
public void LogLineShouldAppendLineBetweenTwoLogCalls() { const string FirstMessage = "test"; const string SecondMessage = "тест"; ILogger logger = new MemoryLogger(); logger.LogLine(FirstMessage); logger.Log(SecondMessage); Assert.Equal(FirstMessage + Environment.NewLine + SecondMessage, logger.ToString()); }
public void StartRoundShouldAddToLoggerAndCallBaseMethod() { var logger = new MemoryLogger(); var playerMock = new Mock <IPlayer>(); var playerWithLogger = new PlayerWithLoggerDecorator(playerMock.Object, logger); var card = Card.GetCard(CardSuit.Diamond, CardType.King); var cards = new List <Card> { card }; var trumpCard = Card.GetCard(CardSuit.Club, CardType.Ace); playerWithLogger.StartRound(cards, trumpCard, 1, 4); Assert.IsTrue(logger.ToString().Length > 0); Assert.IsTrue(logger.ToString().Contains(card.ToString())); Assert.IsTrue(logger.ToString().Contains(trumpCard.ToString())); playerMock.Verify(x => x.StartRound(cards, trumpCard, 1, 4), Times.Once()); }
public void EndRoundShouldAddToLoggerAndCallBaseMethod() { var logger = new MemoryLogger(); var playerMock = new Mock <IPlayer>(); var playerWithLogger = new PlayerWithLoggerDecorator(playerMock.Object, logger); playerWithLogger.EndRound(); Assert.IsTrue(logger.ToString().Length > 0); playerMock.Verify(x => x.EndRound(), Times.Once()); }
public void AddCardShouldAddToLoggerAndCallBaseMethod() { var logger = new MemoryLogger(); var playerMock = new Mock <IPlayer>(); var playerWithLogger = new PlayerWithLoggerDecorator(playerMock.Object, logger); playerWithLogger.AddCard(Card.GetCard(CardSuit.Club, CardType.Ace)); Assert.IsTrue(logger.ToString().Length > 0); playerMock.Verify(x => x.AddCard(It.IsAny <Card>()), Times.Once()); }
public void AddCardShouldAddToLoggerAndCallBaseMethod() { var logger = new MemoryLogger(); var playerMock = new Mock<IPlayer>(); var playerWithLogger = new PlayerWithLoggerDecorator(playerMock.Object, logger); playerWithLogger.AddCard(new Card(CardSuit.Club, CardType.Ace)); Assert.IsTrue(logger.ToString().Length > 0); playerMock.Verify(x => x.AddCard(It.IsAny<Card>()), Times.Once()); }
public void EndTurnShouldAddToLoggerAndCallBaseMethod() { var logger = new MemoryLogger(); var playerMock = new Mock <IPlayer>(); var playerWithLogger = new PlayerWithLoggerDecorator(playerMock.Object, logger); playerWithLogger.EndTurn( new PlayerTurnContext( new StartRoundState(new StateManager()), Card.GetCard(CardSuit.Club, CardType.Ace), 0, 0, 0)); Assert.IsTrue(logger.ToString().Length > 0); playerMock.Verify(x => x.EndTurn(It.IsAny <PlayerTurnContext>()), Times.Once()); }
public void EndTurnShouldAddToLoggerAndCallBaseMethod() { var logger = new MemoryLogger(); var playerMock = new Mock<IPlayer>(); var playerWithLogger = new PlayerWithLoggerDecorator(playerMock.Object, logger); playerWithLogger.EndTurn( new PlayerTurnContext( new StartRoundState(new StateManager()), new Card(CardSuit.Club, CardType.Ace), 0, 0, 0)); Assert.IsTrue(logger.ToString().Length > 0); playerMock.Verify(x => x.EndTurn(It.IsAny<PlayerTurnContext>()), Times.Once()); }
public void StartRoundShouldAddToLoggerAndCallBaseMethod() { var logger = new MemoryLogger(); var playerMock = new Mock<IPlayer>(); var playerWithLogger = new PlayerWithLoggerDecorator(playerMock.Object, logger); var card = new Card(CardSuit.Diamond, CardType.King); var cards = new List<Card> { card }; var trumpCard = new Card(CardSuit.Club, CardType.Ace); playerWithLogger.StartRound(cards, trumpCard, 1, 4); Assert.IsTrue(logger.ToString().Length > 0); Assert.IsTrue(logger.ToString().Contains(card.ToString())); Assert.IsTrue(logger.ToString().Contains(trumpCard.ToString())); playerMock.Verify(x => x.StartRound(cards, trumpCard, 1, 4), Times.Once()); }
public void StartGameShouldAddToLoggerAndCallBaseMethod() { const string OtherPlayerIdentifier = "тест"; var logger = new MemoryLogger(); var playerMock = new Mock<IPlayer>(); var playerWithLogger = new PlayerWithLoggerDecorator(playerMock.Object, logger); playerWithLogger.StartGame(OtherPlayerIdentifier); Assert.IsTrue(logger.ToString().Length > 0); Assert.IsTrue(logger.ToString().Contains(OtherPlayerIdentifier)); playerMock.Verify(x => x.StartGame(It.IsAny<string>()), Times.Once()); }