示例#1
0
        public void Stop_WhenCall_CallsMessenger()
        {
            var botMediator   = GetBotMediator();
            var fakeMessenger = new FakeMessengerApi();

            botMediator.AddMessenger(fakeMessenger);

            botMediator.Stop();

            Assert.True(fakeMessenger.CheckStop);
        }
示例#2
0
        public void Stop_WhenCall_CallsBotMediator()
        {
            var messenger   = new FakeMessengerApi();
            var musicBot    = new MusicBot(new MessengerApi[] { messenger });
            var botMediator = new FakeBotMediator();

            musicBot.SetBotMediator(botMediator);

            musicBot.Stop();

            Assert.True(botMediator.CheckStop);
        }
示例#3
0
        public void AddMusicTracksFromFile_WhenCall_CallsMusicHandler()
        {
            var          messenger    = new FakeMessengerApi();
            var          musicBot     = new MusicBot(new MessengerApi[] { messenger });
            var          musicHandler = new FakeMusicHandler();
            const string filePath     = "Test";

            musicBot.SetMusicHandler(musicHandler);

            musicBot.AddMusicTracksFromFile(filePath);

            Assert.AreEqual(musicHandler.FilePath, filePath);
        }
示例#4
0
        public void Send_WhenCall_SendsToHandler()
        {
            var botMediator        = GetBotMediator();
            var fakeMessenger      = new FakeMessengerApi();
            var fakeMessageHandler = new FakeMessageHandlerModule();
            var message            = GetTestMessage("123123", "Test");

            botMediator.SetMessageStateMachine(fakeMessageHandler);
            botMediator.AddMessenger(fakeMessenger);

            botMediator.Send(message, fakeMessenger);

            Assert.AreSame(message, fakeMessageHandler.ReceiveMessage);
        }