public void Dotnet_test_handles_and_sends_all_the_right_messages()
        {
            var dotnetTestMessageScenario = new DotnetTestMessageScenario();

            dotnetTestMessageScenario.TestRunnerMock
                .Setup(t => t.RunTestCommand())
                .Callback(() => dotnetTestMessageScenario.TestRunnerChannelMock.Raise(
                    t => t.MessageReceived += null,
                    dotnetTestMessageScenario.DotnetTestUnderTest,
                    new Message
                    {
                        MessageType = TestMessageTypes.TestRunnerTestFound,
                        Payload = JToken.FromObject("testFound")
                    }))
                .Verifiable();

            dotnetTestMessageScenario.AdapterChannelMock
                .Setup(a => a.Send(It.Is<Message>(m => m.MessageType == TestMessageTypes.VersionCheck)))
                .Callback(() => dotnetTestMessageScenario.AdapterChannelMock.Raise(
                    r => r.MessageReceived += null,
                    dotnetTestMessageScenario.DotnetTestUnderTest,
                    new Message
                    {
                        MessageType = TestMessageTypes.TestDiscoveryStart
                    }))
                .Verifiable();

            dotnetTestMessageScenario.AdapterChannelMock
                .Setup(a => a.Send(It.Is<Message>(m => m.MessageType == TestMessageTypes.TestDiscoveryTestFound)))
                .Callback(() => dotnetTestMessageScenario.TestRunnerChannelMock.Raise(
                    t => t.MessageReceived += null,
                    dotnetTestMessageScenario.DotnetTestUnderTest,
                    new Message
                    {
                        MessageType = TestMessageTypes.TestRunnerTestCompleted
                    }))
                .Verifiable();

            dotnetTestMessageScenario.AdapterChannelMock
                .Setup(a => a.Send(It.Is<Message>(m => m.MessageType == TestMessageTypes.TestDiscoveryCompleted)))
                .Callback(() => dotnetTestMessageScenario.AdapterChannelMock.Raise(
                    r => r.MessageReceived += null,
                    dotnetTestMessageScenario.DotnetTestUnderTest,
                    new Message
                    {
                        MessageType = TestMessageTypes.TestSessionTerminate
                    }))
                .Verifiable();

            dotnetTestMessageScenario.Run();
        }
        public void Dotnet_test_handles_and_sends_all_the_right_messages()
        {
            var dotnetTestMessageScenario = new DotnetTestMessageScenario();

            dotnetTestMessageScenario.TestRunnerMock
            .Setup(t => t.RunTestCommand())
            .Callback(() => dotnetTestMessageScenario.TestRunnerChannelMock.Raise(
                          t => t.MessageReceived += null,
                          dotnetTestMessageScenario.DotnetTestUnderTest,
                          new Message
            {
                MessageType = TestMessageTypes.TestRunnerTestFound,
                Payload     = JToken.FromObject("testFound")
            }))
            .Verifiable();

            dotnetTestMessageScenario.AdapterChannelMock
            .Setup(a => a.Send(It.Is <Message>(m => m.MessageType == TestMessageTypes.VersionCheck)))
            .Callback(() => dotnetTestMessageScenario.AdapterChannelMock.Raise(
                          r => r.MessageReceived += null,
                          dotnetTestMessageScenario.DotnetTestUnderTest,
                          new Message
            {
                MessageType = TestMessageTypes.TestDiscoveryStart
            }))
            .Verifiable();

            dotnetTestMessageScenario.AdapterChannelMock
            .Setup(a => a.Send(It.Is <Message>(m => m.MessageType == TestMessageTypes.TestDiscoveryTestFound)))
            .Callback(() => dotnetTestMessageScenario.TestRunnerChannelMock.Raise(
                          t => t.MessageReceived += null,
                          dotnetTestMessageScenario.DotnetTestUnderTest,
                          new Message
            {
                MessageType = TestMessageTypes.TestRunnerTestCompleted
            }))
            .Verifiable();

            dotnetTestMessageScenario.AdapterChannelMock
            .Setup(a => a.Send(It.Is <Message>(m => m.MessageType == TestMessageTypes.TestDiscoveryCompleted)))
            .Callback(() => dotnetTestMessageScenario.AdapterChannelMock.Raise(
                          r => r.MessageReceived += null,
                          dotnetTestMessageScenario.DotnetTestUnderTest,
                          new Message
            {
                MessageType = TestMessageTypes.TestSessionTerminate
            }))
            .Verifiable();

            dotnetTestMessageScenario.Run();
        }
示例#3
0
        public void Dotnet_test_handles_and_sends_all_the_right_messages()
        {
            var dotnetTestMessageScenario = new DotnetTestMessageScenario();

            dotnetTestMessageScenario.TestRunnerMock
                .Setup(t => t.GetProcessStartInfo())
                .Returns(new ProcessStartInfo())
                .Verifiable();

            dotnetTestMessageScenario.AdapterChannelMock
                .Setup(a => a.Send(It.Is<Message>(m => m.MessageType == TestMessageTypes.VersionCheck)))
                .Callback(() => dotnetTestMessageScenario.AdapterChannelMock.Raise(
                    r => r.MessageReceived += null,
                    dotnetTestMessageScenario.DotnetTestUnderTest,
                    new Message
                    {
                        MessageType = TestMessageTypes.TestExecutionGetTestRunnerProcessStartInfo
                    }))
                .Verifiable();

            dotnetTestMessageScenario.AdapterChannelMock
                .Setup(a => a.Send(
                    It.Is<Message>(m => m.MessageType == TestMessageTypes.TestExecutionTestRunnerProcessStartInfo)))
                .Callback(() => dotnetTestMessageScenario.TestRunnerChannelMock.Raise(
                    t => t.MessageReceived += null,
                    dotnetTestMessageScenario.DotnetTestUnderTest,
                    new Message
                    {
                        MessageType = TestMessageTypes.TestRunnerTestStarted
                    }))
                .Verifiable();

            dotnetTestMessageScenario.AdapterChannelMock
                .Setup(a => a.Send(
                    It.Is<Message>(m => m.MessageType == TestMessageTypes.TestExecutionStarted)))
                .Callback(() => dotnetTestMessageScenario.TestRunnerChannelMock.Raise(
                    t => t.MessageReceived += null,
                    dotnetTestMessageScenario.DotnetTestUnderTest,
                    new Message
                    {
                        MessageType = TestMessageTypes.TestRunnerTestResult
                    }))
                .Verifiable();

            dotnetTestMessageScenario.AdapterChannelMock
                .Setup(a => a.Send(
                    It.Is<Message>(m => m.MessageType == TestMessageTypes.TestExecutionTestResult)))
                .Callback(() => dotnetTestMessageScenario.TestRunnerChannelMock.Raise(
                    t => t.MessageReceived += null,
                    dotnetTestMessageScenario.DotnetTestUnderTest,
                    new Message
                    {
                        MessageType = TestMessageTypes.TestRunnerTestCompleted
                    }))
                .Verifiable();

            dotnetTestMessageScenario.AdapterChannelMock
                .Setup(a => a.Send(It.Is<Message>(m => m.MessageType == TestMessageTypes.TestExecutionCompleted)))
                .Callback(() => dotnetTestMessageScenario.AdapterChannelMock.Raise(
                    r => r.MessageReceived += null,
                    dotnetTestMessageScenario.DotnetTestUnderTest,
                    new Message
                    {
                        MessageType = TestMessageTypes.TestSessionTerminate
                    }))
                .Verifiable();

            dotnetTestMessageScenario.Run();
        }
        public void Dotnet_test_handles_and_sends_all_the_right_messages()
        {
            var dotnetTestMessageScenario = new DotnetTestMessageScenario();

            dotnetTestMessageScenario.TestRunnerMock
            .Setup(t => t.GetProcessStartInfo())
            .Returns(new TestStartInfo())
            .Verifiable();

            dotnetTestMessageScenario.AdapterChannelMock
            .Setup(a => a.Send(It.Is <Message>(m => m.MessageType == TestMessageTypes.VersionCheck)))
            .Callback(() => dotnetTestMessageScenario.AdapterChannelMock.Raise(
                          r => r.MessageReceived += null,
                          dotnetTestMessageScenario.DotnetTestUnderTest,
                          new Message
            {
                MessageType = TestMessageTypes.TestExecutionGetTestRunnerProcessStartInfo
            }))
            .Verifiable();

            dotnetTestMessageScenario.AdapterChannelMock
            .Setup(a => a.Send(
                       It.Is <Message>(m => m.MessageType == TestMessageTypes.TestExecutionTestRunnerProcessStartInfo)))
            .Callback(() => dotnetTestMessageScenario.TestRunnerChannelMock.Raise(
                          t => t.MessageReceived += null,
                          dotnetTestMessageScenario.DotnetTestUnderTest,
                          new Message
            {
                MessageType = TestMessageTypes.TestRunnerWaitingCommand
            }))
            .Verifiable();

            dotnetTestMessageScenario.TestRunnerChannelMock
            .Setup(a => a.Send(
                       It.Is <Message>(m => m.MessageType == TestMessageTypes.TestRunnerExecute)))
            .Callback(() => dotnetTestMessageScenario.TestRunnerChannelMock.Raise(
                          t => t.MessageReceived += null,
                          dotnetTestMessageScenario.DotnetTestUnderTest,
                          new Message
            {
                MessageType = TestMessageTypes.TestRunnerTestStarted
            }))
            .Verifiable();

            dotnetTestMessageScenario.AdapterChannelMock
            .Setup(a => a.Send(
                       It.Is <Message>(m => m.MessageType == TestMessageTypes.TestExecutionStarted)))
            .Callback(() => dotnetTestMessageScenario.TestRunnerChannelMock.Raise(
                          t => t.MessageReceived += null,
                          dotnetTestMessageScenario.DotnetTestUnderTest,
                          new Message
            {
                MessageType = TestMessageTypes.TestRunnerTestResult
            }))
            .Verifiable();

            dotnetTestMessageScenario.AdapterChannelMock
            .Setup(a => a.Send(
                       It.Is <Message>(m => m.MessageType == TestMessageTypes.TestExecutionTestResult)))
            .Callback(() => dotnetTestMessageScenario.TestRunnerChannelMock.Raise(
                          t => t.MessageReceived += null,
                          dotnetTestMessageScenario.DotnetTestUnderTest,
                          new Message
            {
                MessageType = TestMessageTypes.TestRunnerTestCompleted
            }))
            .Verifiable();

            dotnetTestMessageScenario.AdapterChannelMock
            .Setup(a => a.Send(It.Is <Message>(m => m.MessageType == TestMessageTypes.TestExecutionCompleted)))
            .Callback(() => dotnetTestMessageScenario.AdapterChannelMock.Raise(
                          r => r.MessageReceived += null,
                          dotnetTestMessageScenario.DotnetTestUnderTest,
                          new Message
            {
                MessageType = TestMessageTypes.TestSessionTerminate
            }))
            .Verifiable();

            dotnetTestMessageScenario.Run();
        }