Ejemplo n.º 1
0
        public async Task RunTest_All()
        {
            // Arrange
            var host = new TestHostWrapper(_testProject);

            await host.StartAsync();

            // Act
            var result = await host.RunTestsAsync();

            // Assert
            Assert.Equal(0, result);

            Assert.Equal(15, host.Output.Count);
            Assert.Single(host.Output, m => TestStarted(m, "SampleTest.True_is_true"));
            Assert.Single(host.Output, m => TestPassed(m, "SampleTest.True_is_true"));
            Assert.Single(host.Output, m => TestStarted(m, "SampleTest.TheoryTest1(x: 1)"));
            Assert.Single(host.Output, m => TestPassed(m, "SampleTest.TheoryTest1(x: 1)"));
            Assert.Single(host.Output, m => TestStarted(m, "SampleTest.TheoryTest1(x: 2)"));
            Assert.Single(host.Output, m => TestPassed(m, "SampleTest.TheoryTest1(x: 2)"));
            Assert.Single(host.Output, m => TestStarted(m, "SampleTest.TheoryTest1(x: 3)"));
            Assert.Single(host.Output, m => TestPassed(m, "SampleTest.TheoryTest1(x: 3)"));
            Assert.Single(host.Output, m => TestStarted(m, "SampleTest.TheoryTest2(x: 1, s: \"Hi\")"));
            Assert.Single(host.Output, m => TestPassed(m, "SampleTest.TheoryTest2(x: 1, s: \"Hi\")"));
            Assert.Single(host.Output, m => TestStarted(m, "SampleTest.TheoryTest2(x: 2, s: \"Hi\")"));
            Assert.Single(host.Output, m => TestPassed(m, "SampleTest.TheoryTest2(x: 2, s: \"Hi\")"));
            Assert.Single(host.Output, m => TestStarted(m, "SampleTest.TheoryTest2(x: 3, s: \"Hi\")"));
            Assert.Single(host.Output, m => TestPassed(m, "SampleTest.TheoryTest2(x: 3, s: \"Hi\")"));
            Assert.Equal("TestExecution.Response", host.Output[host.Output.Count - 1].MessageType);
        }
Ejemplo n.º 2
0
        public async Task RunTest_ByUniqueName_ProtocolVersion_UnknownVersion()
        {
            // Arrange
            var host = new TestHostWrapper(_testProject);
            host.ProtocolVersion = 2;

            await host.StartAsync();

            await host.ListTestsAsync();

            var test = host.Output
                .Where(m => m.MessageType == "TestDiscovery.TestFound")
                .First()
                .Payload.ToObject<Test>();

            host.Output.Clear();

            host = new TestHostWrapper(_testProject);
            host.ProtocolVersion = 2;
            await host.StartAsync();

            // Act
            var result = await host.RunTestsAsync(_testProject, test.FullyQualifiedName);

            // Assert
            Assert.Equal(0, result);

            Assert.Equal(1, host.ProtocolVersion);

            Assert.Equal(4, host.Output.Count);
            Assert.Single(host.Output, m => m.MessageType == "ProtocolVersion");
            Assert.Single(host.Output, m => TestStarted(m, test.DisplayName));
            Assert.Single(host.Output, m => TestPassed(m, test.DisplayName));
            Assert.Equal("TestExecution.Response", host.Output[host.Output.Count - 1].MessageType);
        }