Exemplo n.º 1
0
        public void Should_find_inherited_attributes()
        {
            var locator = new SimpleTypeLocator(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath, "AutoTest.TestRunners.Tests.AssemblyAnalysis.TypeLocatorTests");
            var cls     = locator.Locate();

            Assert.AreEqual("AutoTest.TestRunners.Tests.AssemblyAnalysis.TypeLocatorTests", cls.Fullname);
            Assert.AreEqual("AutoTest.TestRunners.Tests.AssemblyAnalysis.MyAttribute", cls.Attributes.ElementAt(1));
        }
Exemplo n.º 2
0
        public void Should_find_inherited_attributes_in_methods()
        {
            var locator = new SimpleTypeLocator(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath, "AutoTest.TestRunners.Tests.AssemblyAnalysis.BaseClass.Blargh");
            var cls     = locator.Locate();

            Assert.AreEqual("AutoTest.TestRunners.Tests.AssemblyAnalysis.BaseClass.Blargh", cls.Fullname);
            Assert.AreEqual(3, cls.Attributes.Count());
        }
Exemplo n.º 3
0
        public void Should_find_me()
        {
            var locator = new SimpleTypeLocator(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath, "AutoTest.TestRunners.Tests.AssemblyAnalysis.TypeLocatorTests.Should_find_me");
            var method  = locator.Locate();

            Assert.That(method.Category, Is.EqualTo(TypeCategory.Method));
            Assert.AreEqual("AutoTest.TestRunners.Tests.AssemblyAnalysis.TypeLocatorTests.Should_find_me", method.Fullname);
            Assert.AreEqual("NUnit.Framework.TestAttribute", method.Attributes.ElementAt(0));
            Assert.AreEqual(0, method.Methods.Count());
        }
Exemplo n.º 4
0
        public void Should_find_my_parent()
        {
            var locator = new SimpleTypeLocator(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath, "AutoTest.TestRunners.Tests.AssemblyAnalysis.TypeLocatorTests.Should_find_me");
            var cls     = locator.LocateParent();

            Assert.That(cls.Category, Is.EqualTo(TypeCategory.Class));
            Assert.AreEqual("AutoTest.TestRunners.Tests.AssemblyAnalysis.TypeLocatorTests", cls.Fullname);
            Assert.AreEqual("NUnit.Framework.TestFixtureAttribute", cls.Attributes.ElementAt(0));
            Assert.AreEqual(5, cls.Methods.Count());
        }
Exemplo n.º 5
0
        public bool ContainsTestsFor(string assembly, string member)
        {
            var locator = new SimpleTypeLocator(assembly, member);
            var cls     = locator.Locate();

            if (cls == null)
            {
                return(false);
            }
            if (cls.Category != TypeCategory.Class)
            {
                return(false);
            }
            return(cls.Attributes.Contains("Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute"));
        }
Exemplo n.º 6
0
        public bool IsTest(string assembly, string member)
        {
            var locator = new SimpleTypeLocator(assembly, member);
            var method  = locator.Locate();

            if (method == null)
            {
                return(false);
            }
            if (method.Category != TypeCategory.Method)
            {
                return(false);
            }
            return(method.Attributes.Contains("Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute"));
        }
Exemplo n.º 7
0
        public bool ContainsTestsFor(string assembly, string member)
        {
            var locator = new SimpleTypeLocator(assembly, member);
            var cls     = locator.Locate();

            if (cls == null)
            {
                return(false);
            }
            if (cls.Category != TypeCategory.Class)
            {
                return(false);
            }
            return(cls.Methods.Where(x => x.Attributes.Contains("Xunit.FactAttribute")).Count() > 0);
        }
Exemplo n.º 8
0
        public bool IsTest(string assembly, string member)
        {
            var locator = new SimpleTypeLocator(assembly, member);
            var method  = locator.Locate();

            if (method == null)
            {
                return(false);
            }
            if (method.Category != TypeCategory.Method)
            {
                return(false);
            }
            return(method.Attributes.Contains("Xunit.FactAttribute"));
        }
Exemplo n.º 9
0
        public bool ContainsTestsFor(string assembly, string member)
        {
            var locator = new SimpleTypeLocator(assembly, member);
            var cls     = locator.Locate();

            if (cls == null)
            {
                return(false);
            }
            if (cls.Category != TypeCategory.Class)
            {
                return(false);
            }
            return(cls.Attributes.Contains("NUnit.Framework.TestFixtureAttribute"));
        }