Exemplo n.º 1
0
        public OrStepInstance(ProfileInstance profileInstance, StepInstance parentStepInstance, OrStep step)
            : base(profileInstance, parentStepInstance, step)
        {
            const string method = ".ctor";

            var currentPercentage = 0;
            var enabledSteps      = 0;

            foreach (var childStep in step)
            {
                currentPercentage += childStep.Percentage * 100;
                if (childStep.Enabled)
                {
                    ++enabledSteps;
                }

                _percentages.Add(currentPercentage);
            }

            // Check the percentages.

            if (currentPercentage != 10000)
            {
                throw new InvalidConfigurationValueException(GetType(), method, "percentage", currentPercentage / 100);
            }
            if (enabledSteps == 0)
            {
                throw new InvalidConfigurationValueException(GetType(), method, "enabled", false);
            }
        }
Exemplo n.º 2
0
 protected StepInstance(ProfileInstance profileInstance, StepInstance parentStepInstance, Step step)
 {
     _profileInstance    = profileInstance;
     _parentStepInstance = parentStepInstance;
     _enabled            = step.Enabled;
     _iterations         = step.Iterations.Next;
 }
Exemplo n.º 3
0
 public ComponentStepInstance(ProfileInstance profileInstance, StepInstance parentStepInstance, ComponentStep step, MethodInfo beginMethodInfo, MethodInfo endMethodInfo, StepCounters counters)
     : base(profileInstance, parentStepInstance, step)
 {
     _name            = step.Name;
     _beginMethodInfo = beginMethodInfo;
     _endMethodInfo   = endMethodInfo;
     _delay           = step.Delay;
     _counters        = counters;
 }
Exemplo n.º 4
0
        private void Process(StepInstance stepInstance)
        {
            const string method = "Process";

            if (EventSource.IsEnabled(Event.MethodEnter))
            {
                EventSource.Raise(Event.MethodEnter, method);
            }

            // Process the next step.

            Interlocked.Increment(ref _outstandingRequests);
            _stepRunner.BeginProcessRequest(stepInstance, ProcessCallback, stepInstance.ProfileInstance);

            if (EventSource.IsEnabled(Event.MethodExit))
            {
                EventSource.Raise(Event.MethodExit, method);
            }
        }
Exemplo n.º 5
0
        private StepInstance CreateStepInstance(ProfileCounters counters, StepInstance parentStepInstance, ComponentStep step)
        {
            // Look for the method.

            MethodInfo endMethod   = null;
            var        beginMethod = _testFixture.GetType().GetMethod(step.Name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.ExactBinding);

            if (beginMethod == null)
            {
                // Look for a Begin-End pair.

                beginMethod = _testFixture.GetType().GetMethod("Begin" + step.Name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.ExactBinding);
                if (beginMethod == null)
                {
                    throw new ApplicationException("Method '" + step.Name + "' not found on profile '" + _testFixture.GetType().FullName + ".");
                }

                endMethod = _testFixture.GetType().GetMethod("End" + step.Name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.ExactBinding);
            }

            return(new ComponentStepInstance(this, parentStepInstance, step, beginMethod, endMethod, counters.StepCounters[step.Name]));
        }
Exemplo n.º 6
0
 public void Add(StepInstance stepInstance)
 {
     _stepInstances.Add(stepInstance);
 }
Exemplo n.º 7
0
 protected StepInstanceList(ProfileInstance profileInstance, StepInstance parentStepInstance, Step step)
     : base(profileInstance, parentStepInstance, step)
 {
 }
Exemplo n.º 8
0
 public AndStepInstance(ProfileInstance profileInstance, StepInstance parentStepInstance, AndStep step)
     : base(profileInstance, parentStepInstance, step)
 {
 }
Exemplo n.º 9
0
        private StepInstance CreateStepInstance(Profile profile, ProfileCounters counters, StepInstance parentStepInstance, AndStep step)
        {
            var stepInstance = new AndStepInstance(this, parentStepInstance, step);

            CreateChildStepInstances(stepInstance, step, profile, counters);
            return(stepInstance);
        }
Exemplo n.º 10
0
 private StepInstance CreateStepInstance(Profile profile, ProfileCounters counters, StepInstance parentStepInstance, Step step)
 {
     if (step is ComponentStep)
     {
         return(CreateStepInstance(counters, parentStepInstance, (ComponentStep)step));
     }
     if (step is OrStep)
     {
         return(CreateStepInstance(profile, counters, parentStepInstance, (OrStep)step));
     }
     if (step is AndStep)
     {
         return(CreateStepInstance(profile, counters, parentStepInstance, (AndStep)step));
     }
     return(null);
 }