Summary

Class:WireMock.Serialization.MatcherMapper
Assembly:WireMock.Net
File(s):C:\Users\azureuser\Documents\Github\WireMock.Net\src\WireMock.Net\Serialization\MatcherMapper.cs
Covered lines:17
Uncovered lines:0
Coverable lines:17
Total lines:35
Line coverage:100%
Branch coverage:90%

Metrics

MethodCyclomatic complexity  NPath complexity  Sequence coverage  Branch coverage  
Map(...)42100100
Map(...)91610088.89

File(s)

C:\Users\azureuser\Documents\Github\WireMock.Net\src\WireMock.Net\Serialization\MatcherMapper.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using System.Linq;
 3using JetBrains.Annotations;
 4using WireMock.Admin.Mappings;
 5using WireMock.Matchers;
 6
 7namespace WireMock.Serialization
 8{
 9    internal static class MatcherMapper
 10    {
 11        public static MatcherModel[] Map([CanBeNull] IEnumerable<IMatcher> matchers)
 212        {
 413             return matchers?.Select(Map).Where(x => x != null).ToArray();
 214        }
 15
 16        public static MatcherModel Map([CanBeNull] IMatcher matcher)
 517        {
 518             if (matcher == null)
 119            {
 120                return null;
 21            }
 22
 423             string[] patterns = matcher is IStringMatcher stringMatcher ? stringMatcher.GetPatterns() : new string[0];
 424            bool? ignorecase = matcher is IIgnoreCaseMatcher ignoreCaseMatcher ? ignoreCaseMatcher.IgnoreCase : (bool?)n
 25
 426             return new MatcherModel
 427            {
 428                IgnoreCase = ignorecase,
 429                Name = matcher.GetName(),
 430                Pattern = patterns.Length == 1 ? patterns.First() : null,
 431                Patterns = patterns.Length > 1 ? patterns : null
 432            };
 533        }
 34    }
 35}