public void The_sent_message_should_contain_a_url()
        {
            var testCodePasteService = new TestCodePasteService();
            var urlFormatter = new AutoFormatCodePastesAsUrls(testCodePasteService);
            var messagingController = new TestUnifiedMessagingController();
            urlFormatter.OnMessageToSendNotify(messagingController);
            var codeSample = @"
            public class Foo
            {
            public void Bar()
            {

            }
            }";
            urlFormatter.MessageToSend("recipient", codeSample);

            Assert.That(messagingController.SentMessage, Is.EqualTo(testCodePasteService.CodePasteText), "It should replace the message with the value from th code paste service.");
        }
Exemple #2
0
        void App_Startup(object sender, StartupEventArgs e)
        {
            var messagingPlugInRepository = new MessagingPlugInRepository();
            var messagingPluginFinder = new MessagingPluginFinder(messagingPlugInRepository);
            var unifiedMessenger = new UnifiedMessenger(messagingPlugInRepository);

            var messagingFiber = new AsyncFiber(Dispatcher);
            var cachedCredentialRepository = new MessagingCredentialCache(messagingPlugInRepository);
            var userSecurityPrompt = new UserSecurityPrompt(messagingFiber);

            messagingPlugInRepository.OnCredentialsRequestedNotify(cachedCredentialRepository);
            cachedCredentialRepository.OnCredentialsRequestedNotify(userSecurityPrompt);
            cachedCredentialRepository.OnCredentialsProvidedNotify(unifiedMessenger);

            userSecurityPrompt.OnCredentialsProvidedNotify(cachedCredentialRepository);

            var codePasteToUrlService = new CodePasteToUrlService();
            var automaticMessageFormatting = new AutoFormatCodePastesAsUrls(codePasteToUrlService);

            var messageRepository = new MessageRepository();
            var unifiedMessagingController = new UnifiedMessagingController(unifiedMessenger, messageRepository, automaticMessageFormatting, messagingFiber);
            automaticMessageFormatting.OnMessageToSendNotify(unifiedMessagingController);

            var messagingViewModel = new MessagingViewModel(unifiedMessagingController);
            var messagingWindow = new MessagingWindow(messagingViewModel);

            messageRepository.OnAddedMessagesNotify(unifiedMessagingController);
            unifiedMessagingController.OnReceivedMessagesNotify(messagingViewModel);

            messagingPluginFinder.GetAllPlugins();

            unifiedMessagingController.StartReceiving();
            unifiedMessagingController.RequestMessageUpdate();

            messagingWindow.Show();
        }