Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigurationObjectEditEventArgs" /> class.
 /// </summary>
 /// <param name="configurationObject">The <see cref="ConfigurationObjectTag" /> for the object being edited.</param>
 /// <param name="context">The <see cref="EnterpriseTestContext" /> to use for loading the object and tracking changes.</param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="configurationObject" /> is null.
 /// <para>or</para>
 /// <paramref name="context" /> is null.
 /// </exception>
 public ConfigurationObjectEditEventArgs(ConfigurationObjectTag configurationObject, EnterpriseTestContext context)
 {
     ConfigurationObject = configurationObject ?? throw new ArgumentNullException(nameof(configurationObject));
     Context             = context ?? throw new ArgumentNullException(nameof(context));
 }
 /// <summary>
 /// Initializes this instance for configuration of a new object based on the specified tag.
 /// </summary>
 /// <param name="tag">The tag.</param>
 public virtual void Initialize(ConfigurationObjectTag tag)
 {
     // By default, use the simple initializer
     Initialize();
 }
        public static IScenarioConfigurationControl Create(ConfigurationObjectTag tag, EnterpriseTestContext context)
        {
            if (tag == null)
            {
                throw new ArgumentNullException("tag");
            }

            IScenarioConfigurationControl control = null;

            switch (tag.ObjectType)
            {
            case ConfigurationObjectType.EnterpriseScenario:
                control = new EnterpriseScenarioControl();
                break;

            case ConfigurationObjectType.VirtualResource:
                switch (tag.ResourceType)
                {
                case VirtualResourceType.OfficeWorker:
                    control = new OfficeWorkerControl();
                    break;

                case VirtualResourceType.CitrixWorker:
                    control = new CitrixWorkerControl();
                    break;

                case VirtualResourceType.AdminWorker:
                    control = new AdminWorkerControl();
                    break;

                case VirtualResourceType.EventLogCollector:
                    control = new EventLogCollectorControl();
                    break;

                case VirtualResourceType.PerfMonCollector:
                    control = new PerfMonCollectorControl();
                    break;

                case VirtualResourceType.MachineReservation:
                    control = new MachineReservationControl();
                    break;

                case VirtualResourceType.SolutionTester:
                    control = new SolutionTesterControl();
                    break;

                case VirtualResourceType.LoadTester:
                    control = new LoadTesterControl();
                    break;
                }
                break;

            case ConfigurationObjectType.ResourceMetadata:
                switch (tag.ResourceType)
                {
                case VirtualResourceType.OfficeWorker:
                case VirtualResourceType.CitrixWorker:
                case VirtualResourceType.SolutionTester:
                case VirtualResourceType.AdminWorker:
                case VirtualResourceType.LoadTester:
                    control = new WorkerActivityMetadataControl();
                    break;
                }
                break;
            }

            if (control != null)
            {
                control.Context = context;
            }

            return(control);
        }