Exemple #1
0
        public void TestProjectInformationMessageHandler_RequestMessage()
        {
            var projectContext = new CommonProjectContext()
            {
                AssemblyName     = "dummy",
                AssemblyFullPath = "dummyPath"
            };

            var handler = new ProjectInformationMessageHandler(projectContext, new MockLogger());
            var message = new Message()
            {
                MessageType     = MessageTypes.ProjectInfoRequest.Value,
                Payload         = null,
                HostId          = "test",
                ProtocolVersion = 1
            };

            var responseMessage = new Message()
            {
                MessageType     = MessageTypes.ProjectInfoResponse.Value,
                HostId          = "testClient",
                Payload         = JToken.FromObject(projectContext),
                ProtocolVersion = 1
            };

            mockSender.Setup(s => s.CreateMessage(MessageTypes.ProjectInfoResponse, projectContext, 1)).Returns(responseMessage);
            mockSender.Setup(s => s.Send(responseMessage)).Returns(true);
            handler.HandleMessage(mockSender.Object, message);

            mockSender.VerifyAll();
        }
Exemple #2
0
        public void TestProjectInformationMessageHandler_MessageTypes()
        {
            var handler = new ProjectInformationMessageHandler(new MockLogger());

            Assert.Equal(2, handler.MessageTypesHandled.Count);

            Assert.Contains(MessageTypes.ProjectInfoRequest.Value, handler.MessageTypesHandled);
            Assert.Contains(MessageTypes.ProjectInfoResponse.Value, handler.MessageTypesHandled);
        }
Exemple #3
0
        public MessageOrchestrator(ScaffoldingClient client, ILogger logger)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            _logger = logger;
            _client = client;
            _projectInformationMessageHandler = new ProjectInformationMessageHandler(_logger);
            _currentProtocolVersion           = _projectInformationMessageHandler.CurrentProtocolVersion;
            client.AddHandler(_projectInformationMessageHandler);
        }