public void NowObserver_Update_DoesNotUpdateBotCommandStrategy(string observerTestBotCommand) { // Arrange IBotStrategy expectedBotCommandStrategy = null; // Initialize test CommandStrategy for NowObserver var nowCommand = new ObserverTestCommand { CommandType = CommandType.Now }; IEnumerable <ICommand> commands = new List <ICommand>() { nowCommand }; var commandStrategy = new BotStrategy(commands); // Initialize the test bot var nowObserver = new NowObserver(commandStrategy); var testBot = new ObserverTestBot(observerTestBotCommand, nowObserver); // Act testBot.Run(); var actualBotCommandStrategy = testBot.Strategy; //Assert Assert.AreEqual(actualBotCommandStrategy, expectedBotCommandStrategy); }
public void NowObserver_Update_UpdatesBotCommandStrategy() { // Arrange var expectedCommandStrategyIsNull = false; var expectedCommandType = CommandType.Now; // Initialize test CommandStrategy for NowObserver var testNowCommand = new ObserverTestCommand { CommandType = CommandType.Now }; IEnumerable <ICommand> commands = new List <ICommand>() { testNowCommand }; var commandStrategy = new BotStrategy(commands); // Initialize the test bot var nowObserver = new NowObserver(commandStrategy); var testBot = new ObserverTestBot("/NOW", nowObserver); // Act testBot.Run(); var actualCommandStrategyIsNull = testBot.Strategy == null; CommandType?actualCommandType = null; if (actualCommandStrategyIsNull == false) { actualCommandType = testBot.Strategy.CommandType; } //Assert Assert.AreEqual(actualCommandStrategyIsNull, expectedCommandStrategyIsNull); if (actualCommandStrategyIsNull == false) { Assert.AreEqual(actualCommandType, expectedCommandType); } }