Ejemplo n.º 1
0
        private void VerifyClassifier(Bidi bidi)
        {
            BidiClassifier actualClassifier = bidi.GetCustomClassifier();

            if (this.classifier == null)
            {
                if (actualClassifier != null)
                {
                    Errln("Bidi classifier is not yet set, but reported as not null");
                }
            }
            else
            {
                Type expectedClass = this.classifier.GetType();
                AssertTrue("null Bidi classifier", actualClassifier != null);
                if (actualClassifier == null)
                {
                    return;
                }
                if (expectedClass.IsInstanceOfType(actualClassifier))
                {
                    Object context = classifier.GetContext();
                    if (context == null)
                    {
                        if (actualClassifier.GetContext() != null)
                        {
                            Errln("Unexpected context, should be null");
                        }
                    }
                    else
                    {
                        AssertEquals("Unexpected classifier context", context,
                                     actualClassifier.GetContext());
                        AssertEquals("Unexpected context's content",
                                     ((Int32)context),
                                     bidi.GetCustomizedClass('a'));
                    }
                }
                else
                {
                    Errln("Bidi object reports classifier is an instance of "
                          + actualClassifier.GetType().FullName
                          + ",\nwhile the expected classifier should be an "
                          + "instance of " + expectedClass);
                }
            }
        }