Ejemplo n.º 1
0
        /// <summary>
        /// Removes a test parameter and resets its <see cref="TestParameter.Owner" /> property.
        /// </summary>
        /// <param name="parameter">The test parameter to remove.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="parameter"/> is null.</exception>
        /// <exception cref="InvalidOperationException">Thrown if <paramref name="parameter"/> is not owned by this test.</exception>
        public void RemoveParameter(TestParameter parameter)
        {
            if (parameter == null)
            {
                throw new ArgumentNullException("parameter");
            }
            if (parameter.Owner != this || parameters == null || !parameters.Contains(parameter))
            {
                throw new InvalidOperationException("The test parameter to be removed is not owned by this test.");
            }

            parameters.Remove(parameter);
            parameter.Owner = null;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds a test parameter and sets its <see cref="TestParameter.Owner" /> property.
        /// </summary>
        /// <param name="parameter">The test parameter to add.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="parameter"/> is null.</exception>
        /// <exception cref="InvalidOperationException">Thrown if <paramref name="parameter"/> is already
        /// owned by some other test.</exception>
        public void AddParameter(TestParameter parameter)
        {
            if (parameter == null)
            {
                throw new ArgumentNullException("parameter");
            }
            if (parameter.Owner != null)
            {
                throw new InvalidOperationException("The test parameter to be added is already owned by another test.");
            }

            parameter.Owner = this;

            if (parameters == null)
            {
                parameters = new List <TestParameter>();
            }
            parameters.Add(parameter);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Removes a test parameter and resets its <see cref="TestParameter.Owner" /> property.
        /// </summary>
        /// <param name="parameter">The test parameter to remove.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="parameter"/> is null.</exception>
        /// <exception cref="InvalidOperationException">Thrown if <paramref name="parameter"/> is not owned by this test.</exception>
        public void RemoveParameter(TestParameter parameter)
        {
            if (parameter == null)
                throw new ArgumentNullException("parameter");
            if (parameter.Owner != this || parameters == null || ! parameters.Contains(parameter))
                throw new InvalidOperationException("The test parameter to be removed is not owned by this test.");

            parameters.Remove(parameter);
            parameter.Owner = null;
        }
 /// <summary>
 /// Creates a new data binding with an optional index, path and a reference to the corresponding <see cref="Gallio.Model.Tree.TestParameter"/>.
 /// </summary>
 /// <param name="index">The binding index or null if none. <seealso cref="DataBinding.Index"/>.</param>
 /// <param name="path">The binding path or null if none. <seealso cref="DataBinding.Path"/>.</param>
 /// <param name="testParameter"><see cref="Gallio.Model.Tree.TestParameter"/> that this binding corresponds to.</param>
 public TestParameterDataBinding(int? index, string path, TestParameter testParameter)
     : base(index, path)
 {
     this.testParameter = testParameter;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Adds a test parameter and sets its <see cref="TestParameter.Owner" /> property.
        /// </summary>
        /// <param name="parameter">The test parameter to add.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="parameter"/> is null.</exception>
        /// <exception cref="InvalidOperationException">Thrown if <paramref name="parameter"/> is already
        /// owned by some other test.</exception>
        public void AddParameter(TestParameter parameter)
        {
            if (parameter == null)
                throw new ArgumentNullException("parameter");
            if (parameter.Owner != null)
                throw new InvalidOperationException("The test parameter to be added is already owned by another test.");

            parameter.Owner = this;

            if (parameters == null)
                parameters = new List<TestParameter>();
            parameters.Add(parameter);
        }