protected override void SpecificSetup(AbstractSystemUnderTestXml sutXml, AbstractConstraintXml ctrXml)
        {
            if (!(ctrXml is ContainXml))
                throw new ArgumentException("Constraint must be a 'ContainXml'");

            ConstraintXml = (ContainXml)ctrXml;
        }
        /// <summary>
        /// Create a new instance of a test case
        /// </summary>
        /// <param name="sutXml"></param>
        /// <param name="ctrXml"></param>
        /// <returns></returns>
        public TestCase Instantiate(AbstractSystemUnderTestXml sutXml, AbstractConstraintXml ctrXml)
        {
            if (sutXml == null)
                throw new ArgumentNullException("sutXml");
            if (ctrXml == null)
                throw new ArgumentNullException("ctrXml");

            ITestCaseBuilder builder = null;

            //Look for registration ...
            var registration = registrations.FirstOrDefault(reg => sutXml.GetType()==reg.SystemUnderTestType && ctrXml.GetType() == reg.ConstraintType);
            if (registration == null)
                throw new ArgumentException(string.Format("'{0}' is not an expected type for a constraint with a system-under-test '{1}'.", ctrXml.GetType().Name, sutXml.GetType().Name));

            //Apply the chooser if needed
            if (registration.Builder == null)
                registration.Chooser.Choose(sutXml, ctrXml);

            //Get Builder and initiate it
            builder = registration.Builder;
            builder.Setup(sutXml, ctrXml, configuration);

            //Build
            builder.Build();
            NUnitCtr.Constraint ctr = builder.GetConstraint();
            var sut = builder.GetSystemUnderTest();

            //Apply negation if needed
            if (ctrXml.Not)
                ctr = new NUnitCtr.NotConstraint(ctr);

            return new TestCase(sut, ctr);
        }
 public void Choose(AbstractSystemUnderTestXml sut, AbstractConstraintXml ctr)
 {
     if (sut.BaseItem is IExecutable)
         Target.Builder = new ExecutionNonQueryFasterThanBuilder();
     else
         Target.Builder = new ExecutionFasterThanBuilder();
 }
        protected override void BaseSetup(AbstractSystemUnderTestXml sutXml, AbstractConstraintXml ctrXml)
        {
            if (!(sutXml is StructureXml))
                throw new ArgumentException("System-under-test must be a 'StructureXml'");

            SystemUnderTestXml = (StructureXml)sutXml;
        }
 public void Setup(AbstractSystemUnderTestXml sutXml, AbstractConstraintXml ctrXml, ITestConfiguration config)
 {
     configuration = config;
     BaseSetup(sutXml, ctrXml);
     SpecificSetup(sutXml, ctrXml);
     isSetup = true;
 }
        protected override void BaseSetup(AbstractSystemUnderTestXml sutXml, AbstractConstraintXml ctrXml)
        {
            if (!(sutXml is MembersXml))
                throw new ArgumentException("Constraint must be a 'MembesrXml'");

            SystemUnderTestXml = (MembersXml)sutXml;
        }
        protected override void SpecificSetup(AbstractSystemUnderTestXml sutXml, AbstractConstraintXml ctrXml)
        {
            if (!(ctrXml is EvaluateRowsXml))
                throw new ArgumentException("Constraint must be a 'ValidateXml'");

            ConstraintXml = (EvaluateRowsXml)ctrXml;
        }
Exemple #8
0
        protected override void SpecificSetup(AbstractSystemUnderTestXml sutXml, AbstractConstraintXml ctrXml)
        {
            if (!(ctrXml is SubsetOfXml))
                throw new ArgumentException("Constraint must be a 'MembersSubsetOfBuilder'");

            ConstraintXml = (SubsetOfXml)ctrXml;
        }
        protected override void SpecificSetup(AbstractSystemUnderTestXml sutXml, AbstractConstraintXml ctrXml)
        {
            if (!(ctrXml is IsXml))
                throw new ArgumentException("Constraint must be a 'IsXml'");

            if (!(sutXml is DataTypeXml))
                throw new ArgumentException("System-under-test must be a 'DataTypeXml'");

            SystemUnderTestXml = (DataTypeXml)sutXml;

            ConstraintXml = (IsXml)ctrXml;
        }
        protected override void SpecificSetup(AbstractSystemUnderTestXml sutXml, AbstractConstraintXml ctrXml)
        {
            if (!(ctrXml is ExistsXml))
                throw new ArgumentException("Constraint must be a 'ExistsXml'");

            if (!(sutXml is StructureXml))
                throw new ArgumentException("System-under-test must be a 'StructureXml'");

            SystemUnderTestXml = (StructureXml)sutXml;

            ConstraintXml = (ExistsXml)ctrXml;
        }
 protected abstract void SpecificSetup(AbstractSystemUnderTestXml sutXml, AbstractConstraintXml ctrXml);
 public void Setup(AbstractSystemUnderTestXml sutXml, AbstractConstraintXml ctrXml)
 {
     Setup(sutXml, ctrXml, null);
 }
Exemple #13
0
 public void Setup(AbstractSystemUnderTestXml sutXml, AbstractConstraintXml ctrXml)
 {
     BaseSetup(sutXml, ctrXml);
     SpecificSetup(sutXml, ctrXml);
     isSetup = true;
 }