Summary

Class:WireMock.Matchers.ExactObjectMatcher
Assembly:WireMock.Net
File(s):C:\Users\azureuser\Documents\Github\WireMock.Net\src\WireMock.Net\Matchers\ExactObjectMatcher.cs
Covered lines:15
Uncovered lines:0
Coverable lines:15
Total lines:46
Line coverage:100%

Metrics

MethodCyclomatic complexity  NPath complexity  Sequence coverage  Branch coverage  
.ctor(...)10100100
.ctor(...)10100100
IsMatch(...)20100100
GetName()10100100

File(s)

C:\Users\azureuser\Documents\Github\WireMock.Net\src\WireMock.Net\Matchers\ExactObjectMatcher.cs

#LineLine coverage
 1using System.Linq;
 2using JetBrains.Annotations;
 3
 4namespace WireMock.Matchers
 5{
 6    /// <summary>
 7    /// ExactMatcher
 8    /// </summary>
 9    /// <seealso cref="IObjectMatcher" />
 10    public class ExactObjectMatcher : IObjectMatcher
 11    {
 12        private readonly object _object;
 13        private readonly byte[] _bytes;
 14
 15        /// <summary>
 16        /// Initializes a new instance of the <see cref="ExactMatcher"/> class.
 17        /// </summary>
 18        /// <param name="value">The value.</param>
 219        public ExactObjectMatcher([NotNull] object value)
 220        {
 221            _object = value;
 222        }
 23
 24        /// <summary>
 25        /// Initializes a new instance of the <see cref="ExactMatcher"/> class.
 26        /// </summary>
 27        /// <param name="value">The value.</param>
 128        public ExactObjectMatcher([NotNull] byte[] value)
 129        {
 130            _bytes = value;
 131        }
 32
 33        /// <inheritdoc cref="IObjectMatcher.IsMatch"/>
 34        public double IsMatch(object input)
 235        {
 236            bool equals = _object != null ? Equals(_object, input) : _bytes.SequenceEqual((byte[])input);
 237            return MatchScores.ToScore(equals);
 238        }
 39
 40        /// <inheritdoc cref="IMatcher.GetName"/>
 41        public string GetName()
 142        {
 143            return "ExactObjectMatcher";
 144        }
 45    }
 46}