Exemple #1
0
    public void TestsFromAbstractBaseClassesShouldBeExecuted()
    {
        string code = @"
            using Xunit;

            public class TestClass
            {
                [Fact]
                public void TestMethod() {}
            }
        ";

        XmlNode xmlFromExecutorWrapper;
        XmlNode xmlFromMate;

        using (MockAssembly mockAssembly = new MockAssembly())
        {
            mockAssembly.Compile(code);
            xmlFromExecutorWrapper = mockAssembly.Run();
            xmlFromMate            = mockAssembly.RunWithMate();
        }

        // Make sure that we have these (and only these) attributes
        AssertExactAttributeList(
            xmlFromExecutorWrapper,
            "name", "configFile", "total", "passed", "failed", "skipped", "environment",
            "time", "run-date", "run-time", "test-framework"
            );
        AssertExactAttributeList(
            xmlFromMate,
            "name", "configFile", "total", "passed", "failed", "skipped", "environment",
            "time", "run-date", "run-time", "test-framework"
            );

        // Only compare values on assembly node, because we know that MATE
        // uses the actual XML from Executor for classes & tests. We can't
        // do equivalence for "time", "run-date", "run-time" because of variance.
        AssertAttributeEqual(xmlFromExecutorWrapper, xmlFromMate, "name");
        AssertAttributeEqual(xmlFromExecutorWrapper, xmlFromMate, "configFile");
        AssertAttributeEqual(xmlFromExecutorWrapper, xmlFromMate, "total");
        AssertAttributeEqual(xmlFromExecutorWrapper, xmlFromMate, "passed");
        AssertAttributeEqual(xmlFromExecutorWrapper, xmlFromMate, "failed");
        AssertAttributeEqual(xmlFromExecutorWrapper, xmlFromMate, "skipped");
        AssertAttributeEqual(xmlFromExecutorWrapper, xmlFromMate, "environment");
        AssertAttributeEqual(xmlFromExecutorWrapper, xmlFromMate, "test-framework");
    }