コード例 #1
0
ファイル: Test.cs プロジェクト: soelske/mbunit-v3
        /// <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;
        }
コード例 #2
0
ファイル: Test.cs プロジェクト: soelske/mbunit-v3
        /// <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);
        }
コード例 #3
0
ファイル: Test.cs プロジェクト: dougrathbone/mbunit-v3
        /// <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;
        }
コード例 #4
0
 /// <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;
 }
コード例 #5
0
ファイル: Test.cs プロジェクト: dougrathbone/mbunit-v3
        /// <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);
        }