Summary

Class:WireMock.Matchers.ExactMatcher
Assembly:WireMock.Net
File(s):C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\ExactMatcher.cs
Covered lines:17
Uncovered lines:0
Coverable lines:17
Total lines:54
Line coverage:100%

Metrics

MethodCyclomatic complexity NPath complexity Sequence coverage Branch coverage
IsMatch(...)0010
GetPatterns()0010
.ctor(...)0010
.ctor(...)0010

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\ExactMatcher.cs

#LineLine coverage
 1using System.Linq;
 2using JetBrains.Annotations;
 3using WireMock.Validation;
 4
 5namespace WireMock.Matchers
 6{
 7    /// <summary>
 8    /// ExactMatcher
 9    /// </summary>
 10    /// <seealso cref="IStringMatcher" />
 11    public class ExactMatcher : IStringMatcher
 12    {
 13        private readonly string[] _values;
 14
 15        /// <inheritdoc cref="IMatcher.MatchBehaviour"/>
 2316        public MatchBehaviour MatchBehaviour { get; }
 17
 18        /// <summary>
 19        /// Initializes a new instance of the <see cref="ExactMatcher"/> class.
 20        /// </summary>
 21        /// <param name="values">The values.</param>
 1522        public ExactMatcher([NotNull] params string[] values) : this(MatchBehaviour.AcceptOnMatch, values)
 1523        {
 1524        }
 25
 26        /// <summary>
 27        /// Initializes a new instance of the <see cref="ExactMatcher"/> class.
 28        /// </summary>
 29        /// <param name="matchBehaviour">The match behaviour.</param>
 30        /// <param name="values">The values.</param>
 3931        public ExactMatcher(MatchBehaviour matchBehaviour, [NotNull] params string[] values)
 3932        {
 3933            Check.HasNoNulls(values, nameof(values));
 34
 3935            _values = values;
 3936            MatchBehaviour = matchBehaviour;
 3937        }
 38
 39        /// <inheritdoc cref="IStringMatcher.IsMatch"/>
 40        public double IsMatch(string input)
 2341        {
 7042            return MatchBehaviourHelper.Convert(MatchBehaviour, MatchScores.ToScore(_values.Select(value => value.Equals
 2343        }
 44
 45        /// <inheritdoc cref="IStringMatcher.GetPatterns"/>
 46        public string[] GetPatterns()
 347        {
 348            return _values;
 349        }
 50
 51        /// <inheritdoc cref="IMatcher.Name"/>
 152        public string Name => "ExactMatcher";
 53    }
 54}