Ejemplo n.º 1
0
        public void AcceptanceTest()
        {
            string code = @"
                    using Xunit;

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

            using (MockAssembly assembly = new MockAssembly())
            {
                assembly.Compile(code);

                XmlNode lastNode    = null;
                XmlNode returnValue = null;

                using (ExecutorWrapper wrapper = new ExecutorWrapper(assembly.FileName, null, false))
                    returnValue = wrapper.RunAssembly(node => { lastNode = node; return(true); });

                XmlNode resultNode = ResultXmlUtility.GetResult(lastNode);
                Assert.Equal("Pass", resultNode.Attributes["result"].Value);
                Assert.Equal(returnValue, lastNode);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Run all the unit tests in the class
        /// </summary>
        /// <param name="assemblyPath">The assembly that contains the unit test.</param>
        /// <param name="className">The full name of the class that contains the unit test.</param>
        override public void RunTests(string assemblyPath, string assemblyName)
        {
            System.Xml.XmlNode returnValue = null;

            using (ExecutorWrapper wrapper = new ExecutorWrapper(assemblyPath, null, true))
            {
                returnValue = wrapper.RunAssembly(node => true);
            }

            ParseResults(returnValue);
        }
Ejemplo n.º 3
0
        public XmlNode Run(string configFile)
        {
            using (ExecutorWrapper wrapper = new ExecutorWrapper(FileName, configFile, false))
            {
                XmlNode result = null;

                wrapper.RunAssembly(node =>
                {
                    if (node.Name == "assembly")
                    {
                        result = node;
                    }

                    return(true);
                });

                return(result);
            }
        }
Ejemplo n.º 4
0
        public void AssemblyWithNoTests()
        {
            string code = @"
                    using Xunit;

                    public class PlainOldDotNetClass
                    {
                    }";

            using (MockAssembly assembly = new MockAssembly())
            {
                assembly.Compile(code);

                XmlNode lastNode = null;

                using (ExecutorWrapper wrapper = new ExecutorWrapper(assembly.FileName, null, false))
                    wrapper.RunAssembly(node => { lastNode = node; return(true); });

                Assert.NotNull(lastNode);   // Always get an <assembly> node, even if there are no tests
                Assert.Equal(0, lastNode.ChildNodes.Count);
            }
        }