~charlie.poole/nunitv2/equality-handlers

« back to all changes in this revision

Viewing changes to src/NUnitCore/interfaces/Filters/SimpleNameFilter.cs

  • Committer: Charlie Poole
  • Date: 2011-03-27 06:12:08 UTC
  • mfrom: (3290.1.7 work)
  • Revision ID: charlie@nunit.org-20110327061208-268vaqov3fc1fy71
Merge changes from trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
                /// Construct an empty SimpleNameFilter
21
21
                /// </summary>
22
22
        public SimpleNameFilter() { }
23
 
        
 
23
 
24
24
        /// <summary>
25
25
        /// Construct a SimpleNameFilter for a single name
26
26
        /// </summary>
27
 
        /// <param name="namesToAdd">The name the filter will recognize. Separate multiple names with commas.</param>
28
 
                public SimpleNameFilter( string namesToAdd )
29
 
        {
30
 
            Add(namesToAdd);
31
 
        }
32
 
 
33
 
                /// <summary>
34
 
                /// Add a name to a SimpleNameFilter
35
 
                /// </summary>
36
 
        /// <param name="namesToAdd">The name to be added. Separate multiple names with commas.</param>
37
 
        public void Add(string namesToAdd)
38
 
                {
39
 
            foreach (string name in namesToAdd.Split(','))
40
 
                    {
41
 
                if (IsNotNullOrEmptyTrimmed(name))
42
 
                    names.Add(name.Trim());
43
 
                    }
44
 
                }
45
 
 
46
 
        private bool IsNotNullOrEmptyTrimmed(string s)
47
 
        {
48
 
            return s != null && s.Trim() != string.Empty;
49
 
        }
50
 
 
51
 
                /// <summary>
 
27
        /// <param name="name">The name the filter will recognize.</param>
 
28
        public SimpleNameFilter(string name)
 
29
        {
 
30
            names.Add(name);
 
31
        }
 
32
 
 
33
        /// <summary>
 
34
        /// Construct a SimpleNameFilter for an array of names
 
35
        /// </summary>
 
36
        /// <param names="nameToAdd">The names the filter will recognize.</param>
 
37
        public SimpleNameFilter(string[] namesToAdd)
 
38
        {
 
39
            this.names.AddRange(namesToAdd);
 
40
        }
 
41
 
 
42
        /// <summary>
 
43
        /// Add a name to a SimpleNameFilter
 
44
        /// </summary>
 
45
        /// <param name="name">The name to be added.</param>
 
46
        public void Add(string name)
 
47
        {
 
48
            names.Add(name);
 
49
        }
 
50
 
 
51
        /// <summary>
 
52
        /// Add an array of names to a SimpleNameFilter
 
53
        /// </summary>
 
54
        /// <param name="namesToAdd">The name to be added.</param>
 
55
        public void Add(string[] namesToAdd)
 
56
        {
 
57
            foreach (string name in namesToAdd)
 
58
                names.Add(name);
 
59
        }
 
60
 
 
61
        /// <summary>
52
62
                /// Check whether the filter matches a test
53
63
                /// </summary>
54
64
                /// <param name="test">The test to be matched</param>