Ejemplo n.º 1
0
        public void MetadataImport_TestMethod()
        {
            TestModel testModel = PopulateTestTree();

            Test fixture = GetDescendantByName(testModel.RootTest, typeof(MetadataSample).Name);

            Assert.IsNotNull(fixture, "Cannot find fixture 'MetadataSample'.");

            Test test = fixture.Children[0];

            Assert.IsNotNull(fixture, "Cannot find test method 'Test' in fixture 'MetadataSample'.");

            Assert.AreEqual("Name=\"WebSite1\", PathToWebApp=\"C:\\WebSites\\WebSite1\", WebAppRoot=\"/WebSite1\"", test.Metadata.GetValue(MSTestMetadataKeys.AspNetDevelopmentServer));
            Assert.AreEqual("PathToWebApp=\"C:\\WebSites\\WebSite1\", WebAppRoot=\"/WebSite1\"", test.Metadata.GetValue(MSTestMetadataKeys.AspNetDevelopmentServerHost));
            Assert.AreEqual("UserName=\"Julian\", Password=\"secret\", Domain=\"gallio.org\"", test.Metadata.GetValue(MSTestMetadataKeys.Credential));
            Assert.AreEqual("vstfs:///Classification/Node/3fe569cd-f84e-4375-a0f3-760ccb143bb7", test.Metadata.GetValue(MSTestMetadataKeys.CssIteration));
            Assert.AreEqual("Gallio", test.Metadata.GetValue(MSTestMetadataKeys.CssProjectStructure));
            Assert.AreEqual("ConnectionString=\"Server=.;Database=SomeDatabase;Trusted_Connection=Yes;\", " +
                            "DataAccessMethod=\"Sequential\", ProviderInvariantName=\"System.Data.SqlClient\", TableName=\"Products\"", test.Metadata.GetValue(MSTestMetadataKeys.DataSource));
            Assert.AreEqual("Path=\"file1.xml\", OutputDirectory=\"SomePath\"", test.Metadata.GetValue(MSTestMetadataKeys.DeploymentItem));
            Assert.AreEqual("A sample description.", test.Metadata.GetValue(MetadataKeys.Description));
            Assert.AreEqual("HostType=\"ASP.NET\", HostData=\"data\"", test.Metadata.GetValue(MSTestMetadataKeys.HostType));
            Assert.AreEqual("Julian", test.Metadata.GetValue(MSTestMetadataKeys.Owner));
            Assert.AreEqual("1", test.Metadata.GetValue(MSTestMetadataKeys.Priority));
            Assert.AreEqual("100", test.Metadata.GetValue(MSTestMetadataKeys.Timeout));
            Assert.AreEqual("http://www.gallio.org", test.Metadata.GetValue(MSTestMetadataKeys.UrlToTest));
            Assert.AreEqual("1", test.Metadata.GetValue(MSTestMetadataKeys.WorkItem));
            Assert.AreEqual("value1", test.Metadata.GetValue("key1"));
            Assert.AreEqual("value2", test.Metadata.GetValue("key2"));
        }
Ejemplo n.º 2
0
        public void MetadataImport_FixtureDescription()
        {
            TestModel testModel = PopulateTestTree();

            Test test = GetDescendantByName(testModel.RootTest, typeof(FixtureDescriptionSample).Name);

            Assert.AreEqual("A sample description.", test.Metadata.GetValue(MetadataKeys.Description));
        }
Ejemplo n.º 3
0
        public void MetadataImport_TestsOn()
        {
            TestModel testModel = PopulateTestTree();

            Test test = GetDescendantByName(testModel.RootTest, typeof(TestsOnSample).Name);

            Assert.AreEqual(typeof(TestsOnSample).AssemblyQualifiedName, test.Metadata.GetValue(MetadataKeys.TestsOn));
        }
Ejemplo n.º 4
0
        public void MetadataImport_Importance()
        {
            TestModel testModel = PopulateTestTree();

            Test test = GetDescendantByName(testModel.RootTest, typeof(ImportanceSample).Name);

            Assert.AreEqual(MbUnit2::MbUnit.Framework.TestImportance.Critical.ToString(), test.Metadata.GetValue(MetadataKeys.Importance));
        }
Ejemplo n.º 5
0
        public void MetadataImport_FixtureCategory()
        {
            TestModel testModel = PopulateTestTree();

            Test test = GetDescendantByName(testModel.RootTest, typeof(FixtureCategorySample).Name);

            Assert.AreEqual("samples", test.Metadata.GetValue(MetadataKeys.Category));
        }
Ejemplo n.º 6
0
        public void UsesNameAsLocalIdIfNoHintAndNoConflicts()
        {
            var test = new Test("name", null);
            Assert.AreEqual("name", test.LocalId, "Uses name when no parent available.");

            var testWithParent = new Test("name", null);
            test.AddChild(testWithParent);
            Assert.AreEqual("name", testWithParent.LocalId, "Uses name when parent available but no conflicts.");
        }
Ejemplo n.º 7
0
        public void MetadataImport_Property()
        {
            TestModel testModel = PopulateTestTree();

            Test test = GetDescendantByName(testModel.RootTest, typeof(PropertySample).Name);

            Assert.AreEqual("customvalue-1", test.Metadata.GetValue("customkey-1"));
            Assert.AreEqual("customvalue-2", test.Metadata.GetValue("customkey-2"));
        }
Ejemplo n.º 8
0
        public void MetadataImport_IgnoreReason()
        {
            TestModel testModel = PopulateTestTree();

            Test fixture = GetDescendantByName(testModel.RootTest, typeof(IgnoreReasonSample).Name);
            Test test    = fixture.Children[0];

            Assert.AreEqual("For testing purposes.", test.Metadata.GetValue(MetadataKeys.IgnoreReason));
        }
Ejemplo n.º 9
0
        public void PopulateTreeTest_IgnoredContextShouldIncludeExtraMetadata()
        {
            TestModel testModel = PopulateTestTree();

            Test test = GetDescendantByName(testModel.RootTest.Children[0], "ignored context spec");

            Assert.IsNotNull(test);
            AssertStringContains("Attribute", test.Metadata.GetValue(MetadataKeys.IgnoreReason));
        }
Ejemplo n.º 10
0
        public void MetadataImport_AuthorNameAndEmailAndHomepage()
        {
            TestModel testModel = PopulateTestTree();

            Test test = GetDescendantByName(testModel.RootTest, typeof(AuthorNameAndEmailAndHomepageSample).Name);

            Assert.AreEqual("joe", test.Metadata.GetValue(MetadataKeys.AuthorName));
            Assert.AreEqual("*****@*****.**", test.Metadata.GetValue(MetadataKeys.AuthorEmail));
            Assert.AreEqual("http://www.example.com/", test.Metadata.GetValue(MetadataKeys.AuthorHomepage));
        }
Ejemplo n.º 11
0
        public void MetadataImport_TestClass()
        {
            TestModel testModel = PopulateTestTree();

            Test fixture = GetDescendantByName(testModel.RootTest, typeof(MetadataSample).Name);

            Assert.IsNotNull(fixture, "Cannot find fixture 'MetadataSample'.");

            Assert.AreEqual("Path=\"file1.xml\", OutputDirectory=\"SomePath\"", fixture.Metadata.GetValue(MSTestMetadataKeys.DeploymentItem));
        }
Ejemplo n.º 12
0
        public void NamespacesHaveTestKindNamespace()
        {
            TestModel testModel = PopulateTestTree();

            Test assembly      = testModel.RootTest.Children[0];
            Test namespaceTest = assembly.Children[0];

            Assert.AreEqual("Gallio", namespaceTest.Name);
            Assert.AreEqual(TestKinds.Namespace, namespaceTest.Kind);
        }
Ejemplo n.º 13
0
        public void UsesNameAsLocalIdIfNoHintAndNoConflicts()
        {
            var test = new Test("name", null);

            Assert.AreEqual("name", test.LocalId, "Uses name when no parent available.");

            var testWithParent = new Test("name", null);

            test.AddChild(testWithParent);
            Assert.AreEqual("name", testWithParent.LocalId, "Uses name when parent available but no conflicts.");
        }
Ejemplo n.º 14
0
        public void UsesLocalIdHintAsLocalIdIfNoConflicts()
        {
            var test = new Test("name", null);
            test.LocalIdHint = "hint";
            Assert.AreEqual("hint", test.LocalId, "Uses local id hint when no parent available.");

            var testWithParent = new Test("name", null);
            test.AddChild(testWithParent);
            testWithParent.LocalIdHint = "hint";
            Assert.AreEqual("hint", testWithParent.LocalId, "Uses local id hint when parent available but no conflicts.");
        }
Ejemplo n.º 15
0
        public void MetadataImport_XmlDocumentation_TestParameters()
        {
            TestModel testModel = PopulateTestTree();

            Test          test              = GetDescendantByName(testModel.RootTest, typeof(ParameterizedTest).Name);
            TestParameter fieldParameter    = GetParameterByName(test, "FieldParameter");
            TestParameter propertyParameter = GetParameterByName(test, "PropertyParameter");

            Assert.AreEqual("<summary>\nA field parameter.\n</summary>", fieldParameter.Metadata.GetValue(MetadataKeys.XmlDocumentation));
            Assert.AreEqual("<summary>\nA property parameter.\n</summary>", propertyParameter.Metadata.GetValue(MetadataKeys.XmlDocumentation));
        }
Ejemplo n.º 16
0
        public void MetadataImport_IgnoreReason()
        {
            TestModel testModel = PopulateTestTree();

            Test fixture = GetDescendantByName(testModel.RootTest, typeof(MetadataSample).Name);

            Assert.AreEqual("The Ignore attribute was applied to this class.", fixture.Metadata.GetValue(MetadataKeys.IgnoreReason));

            Test test = fixture.Children[0];

            Assert.AreEqual("The Ignore attribute was applied to this test.", test.Metadata.GetValue(MetadataKeys.IgnoreReason));
        }
Ejemplo n.º 17
0
        public void PopulateTestTree_CapturesTestStructureAndBasicMetadata()
        {
            TestModel testModel = PopulateTestTree();

            Test rootTest = testModel.RootTest;

            Assert.IsNull(rootTest.Parent);
            Assert.AreEqual(TestKinds.Root, rootTest.Kind);
            Assert.IsNull(rootTest.CodeElement);
            Assert.IsFalse(rootTest.IsTestCase);
            Assert.Count(1, rootTest.Children);

            Test assemblyTest = rootTest.Children[0];

            Assert.AreSame(rootTest, assemblyTest.Parent);
            Assert.AreEqual(AssemblyKind, assemblyTest.Kind);
            Assert.AreEqual(SimpleFixtureAssembly.Location, assemblyTest.Metadata.GetValue(MetadataKeys.File), StringComparison.OrdinalIgnoreCase);
            Assert.AreEqual(CodeReference.CreateFromAssembly(SimpleFixtureAssembly), assemblyTest.CodeElement.CodeReference);
            Assert.AreEqual(SimpleFixtureAssembly.GetName().Name, assemblyTest.Name);
            Assert.IsFalse(assemblyTest.IsTestCase);
            Assert.GreaterThanOrEqualTo(assemblyTest.Children.Count, 1);

            Test fixtureTest = GetDescendantByName(assemblyTest, "SimpleTest");

            Assert.AreEqual(TestKinds.Fixture, fixtureTest.Kind);
            Assert.AreEqual(new CodeReference(SimpleFixtureAssembly.FullName, SimpleFixtureNamespace, SimpleFixtureNamespace + ".SimpleTest", null, null),
                            fixtureTest.CodeElement.CodeReference);
            Assert.AreEqual("SimpleTest", fixtureTest.Name);
            Assert.IsFalse(fixtureTest.IsTestCase);
            Assert.Count(2, fixtureTest.Children);

            Test passTest = GetDescendantByName(fixtureTest, PassTestName);
            Test failTest = GetDescendantByName(fixtureTest, FailTestName);

            Assert.IsNotNull(passTest, "Cannot find test case '{0}'", PassTestName);
            Assert.IsNotNull(failTest, "Cannot find test case '{0}'", FailTestName);

            Assert.AreSame(fixtureTest, passTest.Parent);
            Assert.AreEqual(TestKinds.Test, passTest.Kind);
            Assert.AreEqual(new CodeReference(SimpleFixtureAssembly.FullName, SimpleFixtureNamespace, SimpleFixtureNamespace + ".SimpleTest", "Pass", null),
                            passTest.CodeElement.CodeReference);
            Assert.AreEqual(PassTestName, passTest.Name);
            Assert.IsTrue(passTest.IsTestCase);
            Assert.Count(0, passTest.Children);

            Assert.AreSame(fixtureTest, failTest.Parent);
            Assert.AreEqual(TestKinds.Test, failTest.Kind);
            Assert.AreEqual(new CodeReference(SimpleFixtureAssembly.FullName, SimpleFixtureNamespace, SimpleFixtureNamespace + ".SimpleTest", "Fail", null),
                            failTest.CodeElement.CodeReference);
            Assert.AreEqual(FailTestName, failTest.Name);
            Assert.IsTrue(failTest.IsTestCase);
            Assert.Count(0, failTest.Children);
        }
Ejemplo n.º 18
0
        public void PopulateTreeTest_TagShouldAddExtraMetaData()
        {
            TestModel testModel = PopulateTestTree();

            Test test = GetDescendantByName(testModel.RootTest.Children[0], "tag spec");

            Assert.IsNotNull(test);

            IList <string> tags = test.Metadata[SpecificationMetadataKeys.Tags];

            tags.Contains("tag").ShouldBeTrue();
        }
Ejemplo n.º 19
0
        protected TestParameter GetParameterByName(Test test, string name)
        {
            foreach (TestParameter testParameter in test.Parameters)
            {
                if (testParameter.Name == name)
                {
                    return(testParameter);
                }
            }

            return(null);
        }
Ejemplo n.º 20
0
        public void MetadataImport_XmlDocumentation()
        {
            TestModel testModel = PopulateTestTree();

            Test test     = GetDescendantByName(testModel.RootTest, typeof(TSampleFixture).Name);
            Test passTest = GetDescendantByName(test, PassTestName);
            Test failTest = GetDescendantByName(test, FailTestName);

            Assert.AreEqual("<summary>\nA simple test fixture.\n</summary>", test.Metadata.GetValue(MetadataKeys.XmlDocumentation));
            Assert.AreEqual("<summary>\nA passing test.\n</summary>", passTest.Metadata.GetValue(MetadataKeys.XmlDocumentation));
            Assert.AreEqual("<summary>\nA failing test.\n</summary>", failTest.Metadata.GetValue(MetadataKeys.XmlDocumentation));
        }
Ejemplo n.º 21
0
        public void DoesNotChokeOnAmbiguousMatch()
        {
            TestModel testModel = PopulateTestTree();

            Test fixture = GetDescendantByName(testModel.RootTest, typeof(AmbiguousMatchSample).Name);

            Assert.Count(1, fixture.Children);

            Test test = fixture.Children[0];

            Assert.AreEqual("Test", test.Name);
            Assert.IsNull(test.CodeElement);
        }
Ejemplo n.º 22
0
        public void UsesLocalIdHintAsLocalIdIfNoConflicts()
        {
            var test = new Test("name", null);

            test.LocalIdHint = "hint";
            Assert.AreEqual("hint", test.LocalId, "Uses local id hint when no parent available.");

            var testWithParent = new Test("name", null);

            test.AddChild(testWithParent);
            testWithParent.LocalIdHint = "hint";
            Assert.AreEqual("hint", testWithParent.LocalId, "Uses local id hint when parent available but no conflicts.");
        }
Ejemplo n.º 23
0
        public void PopulateTreeTest_SubjectShouldBeSavedAsTheCategory()
        {
            TestModel testModel = PopulateTestTree();

            Test test = GetDescendantByName(testModel.RootTest.Children[0], "subject spec");

            Assert.IsNotNull(test);

            string category = test.Metadata.GetValue(MetadataKeys.Category);

            AssertStringContains("Testing out the framework", category); // Make sure the text is there
            AssertStringContains("bool", category);                      // Make sure the type is there too
        }
Ejemplo n.º 24
0
        public void PopulateTestTree_WhenAssemblyReferencesMbUnit_ContainsSimpleTest()
        {
            TestModel testModel = PopulateTestTree();

            Version expectedVersion = VersionPolicy.GetVersionNumber(typeof(Assert).Assembly);

            Test rootTest = testModel.RootTest;

            Assert.IsNull(rootTest.Parent);
            Assert.AreEqual(TestKinds.Root, rootTest.Kind);
            Assert.IsNull(rootTest.CodeElement);
            Assert.Count(1, rootTest.Children);

            Test assemblyTest = rootTest.Children[0];

            Assert.AreSame(rootTest, assemblyTest.Parent);
            Assert.AreEqual(MbUnitTestFramework.AssemblyKind, assemblyTest.Kind);
            Assert.AreEqual(MbUnitTestFramework.VersionLabel, assemblyTest.Metadata.GetValue(MetadataKeys.Framework));
            Assert.AreEqual(CodeReference.CreateFromAssembly(SimpleFixtureAssembly), assemblyTest.CodeElement.CodeReference);
            Assert.AreEqual(SimpleFixtureAssembly, ((IAssemblyInfo)assemblyTest.CodeElement).Resolve(true));
            Assert.GreaterThanOrEqualTo(assemblyTest.Children.Count, 1);

            Test typeTest = GetDescendantByName(assemblyTest, "SimpleTest");

            Assert.IsNotNull(typeTest, "Could not find the SimpleTest fixture.");
            Assert.AreSame(assemblyTest, typeTest.Parent);
            Assert.AreEqual(TestKinds.Fixture, typeTest.Kind);
            Assert.AreEqual(CodeReference.CreateFromType(typeof(SimpleTest)), typeTest.CodeElement.CodeReference);
            Assert.AreEqual(typeof(SimpleTest), ((ITypeInfo)typeTest.CodeElement).Resolve(true));
            Assert.AreEqual("SimpleTest", typeTest.Name);
            Assert.Count(2, typeTest.Children);

            Test passTest = GetDescendantByName(typeTest, "Pass");

            Assert.IsNotNull(passTest, "Could not find the Pass test.");
            Assert.AreSame(typeTest, passTest.Parent);
            Assert.AreEqual(TestKinds.Test, passTest.Kind);
            Assert.AreEqual(CodeReference.CreateFromMember(typeof(SimpleTest).GetMethod("Pass")), passTest.CodeElement.CodeReference);
            Assert.AreEqual(typeof(SimpleTest).GetMethod("Pass"), ((IMethodInfo)passTest.CodeElement).Resolve(true));
            Assert.AreEqual("Pass", passTest.Name);

            Test failTest = GetDescendantByName(typeTest, "Fail");

            Assert.IsNotNull(failTest, "Could not find the Fail test.");
            Assert.AreSame(typeTest, failTest.Parent);
            Assert.AreEqual(TestKinds.Test, failTest.Kind);
            Assert.AreEqual(CodeReference.CreateFromMember(typeof(SimpleTest).GetMethod("Fail")), failTest.CodeElement.CodeReference);
            Assert.AreEqual(typeof(SimpleTest).GetMethod("Fail"), ((IMethodInfo)failTest.CodeElement).Resolve(true));
            Assert.AreEqual("Fail", failTest.Name);
        }
Ejemplo n.º 25
0
        public void PopulateTreeTest_MultipleTagsShouldContainIndividualEntries()
        {
            TestModel testModel = PopulateTestTree();

            Test test = GetDescendantByName(testModel.RootTest.Children[0], "multiple tag spec");

            Assert.IsNotNull(test);

            IList <string> tags = test.Metadata[SpecificationMetadataKeys.Tags];

            tags.Contains("one").ShouldBeTrue();
            tags.Contains("two").ShouldBeTrue();
            tags.Contains("three").ShouldBeTrue();
        }
Ejemplo n.º 26
0
        public void ParameterizedTestHasMethodAsCodeElement()
        {
            TestModel testModel = PopulateTestTree();

            Test fixture = GetDescendantByName(testModel.RootTest, typeof(ParameterizedTest).Name);

            Assert.Count(1, fixture.Children);

            Test test = fixture.Children[0];

            Assert.AreEqual("Test", test.Name);
            Assert.AreEqual(CodeElementKind.Method, test.CodeElement.Kind);
            Assert.AreEqual("Test", test.CodeElement.Name);
        }
Ejemplo n.º 27
0
        public void PopulateTreeTest_IgnoredSpecificationDueToIgnoredContextShouldIndicateIgnoredDueToParent()
        {
            TestModel testModel = PopulateTestTree();

            Test context = GetDescendantByName(testModel.RootTest.Children[0], "ignored context spec");

            Assert.IsNotNull(context);

            Test spec = GetDescendantByName(context, "should");

            Assert.IsNotNull(spec);

            AssertStringContains("Attribute", spec.Metadata.GetValue(MetadataKeys.IgnoreReason));
            AssertStringContains("Context", spec.Metadata.GetValue(MetadataKeys.IgnoreReason));
        }
Ejemplo n.º 28
0
        public void PopulateTreeTest_IgnoredSpecificationShouldIncludeExtraMetadata()
        {
            TestModel testModel = PopulateTestTree();

            Test context = GetDescendantByName(testModel.RootTest.Children[0], "ignored specification spec");

            Assert.IsNotNull(context);

            Test spec = GetDescendantByName(context, "should");

            Assert.IsNotNull(spec);

            StringAssert.DoesNotContain("Attribute", context.Metadata.GetValue(MetadataKeys.IgnoreReason));
            AssertStringContains("Attribute", spec.Metadata.GetValue(MetadataKeys.IgnoreReason));
        }
Ejemplo n.º 29
0
        public void AssignsUniqueLocalIdsToChildren()
        {
            var test = new Test("name", null);

            Assert.AreEqual("localId", test.GetUniqueLocalIdForChild("localId"),
                            "If no conflict, assigns local id hint to child.");
            Assert.AreEqual("localId2", test.GetUniqueLocalIdForChild("localId"),
                            "If conflict, assigned suffixed local id hint to child.");
            Assert.AreEqual("localId3", test.GetUniqueLocalIdForChild("localId"),
                            "If conflict, assigned suffixed local id hint to child.");
            Assert.AreEqual("localId22", test.GetUniqueLocalIdForChild("localId2"),
                            "If conflict, assigned suffixed local id hint to child.");

            Assert.AreEqual("differentId", test.GetUniqueLocalIdForChild("differentId"),
                            "If no conflict, assigns local id hint to child.");
        }
Ejemplo n.º 30
0
        public void AssignsUniqueLocalIdsToChildren()
        {
            var test = new Test("name", null);

            Assert.AreEqual("localId", test.GetUniqueLocalIdForChild("localId"),
                "If no conflict, assigns local id hint to child.");
            Assert.AreEqual("localId2", test.GetUniqueLocalIdForChild("localId"),
                "If conflict, assigned suffixed local id hint to child.");
            Assert.AreEqual("localId3", test.GetUniqueLocalIdForChild("localId"),
                "If conflict, assigned suffixed local id hint to child.");
            Assert.AreEqual("localId22", test.GetUniqueLocalIdForChild("localId2"),
                "If conflict, assigned suffixed local id hint to child.");

            Assert.AreEqual("differentId", test.GetUniqueLocalIdForChild("differentId"),
                "If no conflict, assigns local id hint to child.");
        }
Ejemplo n.º 31
0
        public void MetadataImport_AssemblyAttributes()
        {
            TestModel testModel = PopulateTestTree();

            Test assemblyTest = testModel.RootTest.Children[0];

            Assert.AreEqual("Machine Project", assemblyTest.Metadata.GetValue(MetadataKeys.Company));
            Assert.AreEqual("Test", assemblyTest.Metadata.GetValue(MetadataKeys.Configuration));
            AssertStringContains("Copyright © Machine Project 2008, 2009, 2010", assemblyTest.Metadata.GetValue(MetadataKeys.Copyright));
            Assert.AreEqual("Machine.Specifications", assemblyTest.Metadata.GetValue(MetadataKeys.Product));
            Assert.AreEqual("Machine.Specifications.GallioAdapter.TestResources", assemblyTest.Metadata.GetValue(MetadataKeys.Title));

            Assert.IsNotEmpty(assemblyTest.Metadata.GetValue(MetadataKeys.InformationalVersion));
            Assert.IsNotEmpty(assemblyTest.Metadata.GetValue(MetadataKeys.FileVersion));
            Assert.IsNotEmpty(assemblyTest.Metadata.GetValue(MetadataKeys.Version));
        }
Ejemplo n.º 32
0
        public void UsesSuffixedLocalIdWhenConflictsOccur()
        {
            var parent = new Test("name", null);

            var test1 = new Test("test", null);
            parent.AddChild(test1);
            Assert.AreEqual("test", test1.LocalId, "Uses name because there is no conflict.");

            var test2 = new Test("test", null);
            parent.AddChild(test2);
            Assert.AreEqual("test2", test2.LocalId, "Uses suffixed name because there is a conflict in the name and no hint.");

            var test3 = new Test("name", null);
            test3.LocalIdHint = "test";
            parent.AddChild(test3);
            Assert.AreEqual("test3", test3.LocalId, "Uses suffixed name because there is a conflict in the hint.");
        }
Ejemplo n.º 33
0
        protected Test GetDescendantByName(Test parent, string name)
        {
            foreach (Test test in parent.Children)
            {
                if (test.Name == name)
                {
                    return(test);
                }

                Test descendant = GetDescendantByName(test, name);
                if (descendant != null)
                {
                    return(descendant);
                }
            }

            return(null);
        }
Ejemplo n.º 34
0
        public void MetadataImport_AssemblyAttributes()
        {
            TestModel testModel = PopulateTestTree();

            Test assemblyTest = testModel.RootTest.Children[0];

            Assert.AreEqual("MbUnit Project", assemblyTest.Metadata.GetValue(MetadataKeys.Company));
            Assert.AreEqual("Test", assemblyTest.Metadata.GetValue(MetadataKeys.Configuration));
            Assert.Contains(assemblyTest.Metadata.GetValue(MetadataKeys.Copyright), "Gallio Project");
            Assert.AreEqual("A sample test assembly for " + TestFrameworkHandle.GetTraits().Name + ".", assemblyTest.Metadata.GetValue(MetadataKeys.Description));
            Assert.AreEqual("Gallio", assemblyTest.Metadata.GetValue(MetadataKeys.Product));
            Assert.AreEqual(SimpleFixtureAssembly.GetName().Name, assemblyTest.Metadata.GetValue(MetadataKeys.Title));
            Assert.AreEqual("Gallio", assemblyTest.Metadata.GetValue(MetadataKeys.Trademark));

            Assert.AreEqual("1.2.3.4", assemblyTest.Metadata.GetValue(MetadataKeys.InformationalVersion));
            Assert.IsNotEmpty(assemblyTest.Metadata.GetValue(MetadataKeys.FileVersion));
            Assert.IsNotEmpty(assemblyTest.Metadata.GetValue(MetadataKeys.Version));
        }
    Test GetDescendantByName(Test parent, string name)
    {
      foreach (Test test in parent.Children)
      {
        if (test.Name == name)
          return test;

        Test descendant = GetDescendantByName(test, name);
        if (descendant != null)
          return descendant;
      }

      return null;
    }