Esempio n. 1
0
        public void TestConvertLabelRoleToNegatedLabelRole()
        {
            Taxonomy tax = new Taxonomy();
            tax.labelRoles = new ArrayList();
            tax.labelRoles.Add( LABEL );
            tax.labelRoles.Add( LABEL_TOTAL );
            tax.labelRoles.Add( LABEL_PER_START );
            tax.labelRoles.Add( LABEL_PER_END );
            tax.labelRoles.Sort();

            string role;
            Assert.IsFalse( tax.ConvertLabelRoleToNegatedLabelRole( LABEL, out role ), "should have failed to convert label with no negated labels defined." );

            tax.labelRoles.Add( Taxonomy.NEGATED );
            tax.labelRoles.Add( Taxonomy.NEGATED_TOTAL );
            tax.labelRoles.Add( Taxonomy.NEGATED_PER_START );
            tax.labelRoles.Add( Taxonomy.NEGATED_PER_END );
            tax.labelRoles.Sort();

            Assert.IsTrue( tax.ConvertLabelRoleToNegatedLabelRole( LABEL, out role ), "did not convert label" );
            Assert.AreEqual( Taxonomy.NEGATED, role, "did not find negated label" );

            Assert.IsTrue( tax.ConvertLabelRoleToNegatedLabelRole( LABEL_TOTAL, out role ), "did not convert totalLabel" );
            Assert.AreEqual( Taxonomy.NEGATED_TOTAL, role, "did not find negated label total" );

            Assert.IsTrue( tax.ConvertLabelRoleToNegatedLabelRole( LABEL_PER_START, out role ), "did not convert periodStartLabel" );
            Assert.AreEqual( Taxonomy.NEGATED_PER_START, role, "did not find negated label per start" );

            Assert.IsTrue( tax.ConvertLabelRoleToNegatedLabelRole( LABEL_PER_END, out role ), "did not convert periodEndLabel" );
            Assert.AreEqual( Taxonomy.NEGATED_PER_END, role, "did not find negated label per end" );

            Assert.IsTrue( tax.ConvertLabelRoleToNegatedLabelRole( null, out role ), "did not convert null label" );
            Assert.AreEqual( Taxonomy.NEGATED, role, "did not find negated label" );
        }