Ejemplo n.º 1
0
        public void SendMessage_CallsIntoSendMessageMethod()
        {
            var called = false;
            var pluginMessageBroker = 
                new PluginMessageBroker(pluginId: Guid.NewGuid().ToString(), sendMessageMethod: (_) => called = true);

            pluginMessageBroker.SendMessage(string.Empty);

            Assert.True(called);
        }
Ejemplo n.º 2
0
        public void SendMessage_CallsIntoSendMessageMethod()
        {
            var called = false;
            var pluginMessageBroker =
                new PluginMessageBroker(pluginId: Guid.NewGuid().ToString(), sendMessageMethod: (_) => called = true);

            pluginMessageBroker.SendMessage(string.Empty);

            Assert.True(called);
        }
Ejemplo n.º 3
0
        public void SendMessage_WrapsData()
        {
            object calledWithRaw = null;
            var expectedPluginId = "d81b8ad8-306d-474b-b8a9-b25c7f80be7e"; // Random, hardcoded GUID.
            var pluginMessageBroker = new PluginMessageBroker(
                expectedPluginId,
                sendMessageMethod: (data) => calledWithRaw = data);

            pluginMessageBroker.SendMessage("Hello World");

            Assert.NotNull(calledWithRaw);
            var calledWith = Assert.IsType<PluginMessageBroker.PluginMessageWrapperData>(calledWithRaw);
            Assert.Equal(expectedPluginId, calledWith.PluginId);
            Assert.Equal("Hello World", (string)calledWith.Data, StringComparer.Ordinal);
        }
Ejemplo n.º 4
0
        public void SendMessage_WrapsData()
        {
            object calledWithRaw       = null;
            var    expectedPluginId    = "d81b8ad8-306d-474b-b8a9-b25c7f80be7e"; // Random, hardcoded GUID.
            var    pluginMessageBroker = new PluginMessageBroker(
                expectedPluginId,
                sendMessageMethod: (data) => calledWithRaw = data);

            pluginMessageBroker.SendMessage("Hello World");

            Assert.NotNull(calledWithRaw);
            var calledWith = Assert.IsType <PluginMessageBroker.PluginMessageWrapperData>(calledWithRaw);

            Assert.Equal(expectedPluginId, calledWith.PluginId);
            Assert.Equal("Hello World", (string)calledWith.Data, StringComparer.Ordinal);
        }
Ejemplo n.º 5
0
        private void SendMessage(string pluginId, PluginResponseMessage message)
        {
            var messageBroker = new PluginMessageBroker(pluginId, _sendMessageMethod);

            messageBroker.SendMessage(message);
        }
Ejemplo n.º 6
0
        private void SendMessage(string pluginId, PluginResponseMessage message)
        {
            var messageBroker = new PluginMessageBroker(pluginId, _sendMessageMethod);

            messageBroker.SendMessage(message);
        }