First, sorry for my english, I usually speak french.

I try to make my own extended Test Decorator for MbUnit. (see the
pattern bellow)
And if the value entered for my attribute is not valid, I want to
ignore the test.

public sealed class TestDbVersionAttribute : DecoratorPatternAttribute
{
        private string _minimumVersion;
        private string _maximumVersion;

        public TestDbVersionAttribute( )
        {
        }

        public string Minimum
        {
                get
                {
                        return this._minimumVersion;
                }
                set
                {
                        this._minimumVersion = this.ValidateVersion(value);
                }
        }

        public string Maximum
        { Same as Minimum....}

        private string ValidateVersion(string value)
        { Validate the Version ...}


        public override IRunInvoker GetInvoker(IRunInvoker wrapper)
        {
                return new TestDbVersionRunInvoker(wrapper, this);
        }

        private sealed class TestDbVersionRunInvoker : DecoratorRunInvoker
        {
                private TestDbVersionAttribute _attribute;
                public TestDbVersionRunInvoker(IRunInvoker invoker,
TestDbVersionAttribute attribute)
                        : base(invoker)
                {
                        this._attribute = attribute;
                }

                public override object Execute(object o, IList args)
                {
                        object result = null;

                        if (DataBase in the range ... )
                        {
                                result = this.Invoker.Execute(o, args);
                        }
                        else
                        {
                                string message = " this test is skipped.";
----->                          throw new  IgnoreRunException(message);
                        }
                        return result;
                }
        }
}

So the important line is the line with "----->".  When I throw that
exception I expecte to see on the output window:
TestCase 'DbVersionAttributeTests.TestX' not executed: this test is
skipped.

But I received only:
TestCase 'DbVersionAttributeTests.TestX' not executed:

Does someone know why ?
Am I using the good function to do this ?!?!?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MbUnit.User" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/MbUnitUser?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to