< Summary

Class:Itinero.Profiles.RouterDbProfileConfiguration
Assembly:Itinero
File(s):/home/runner/work/routing2/routing2/src/Itinero/Profiles/RouterDbProfileConfiguration.cs
Covered lines:20
Uncovered lines:7
Coverable lines:27
Total lines:49
Line coverage:74% (20 of 27)
Covered branches:4
Total branches:4
Branch coverage:100% (4 of 4)
Tag:251_23667616543

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
.ctor()100%1100%
GetProfileNames()100%10%
HasProfile(...)100%10%
AddProfiles(...)100%2100%
TryGetProfileHandlerEdgeTypesCache(...)100%2100%
get_Profiles()100%10%

File(s)

/home/runner/work/routing2/routing2/src/Itinero/Profiles/RouterDbProfileConfiguration.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using System.Linq;
 3using Itinero.Routing.Costs.Caches;
 4
 5namespace Itinero.Profiles;
 6
 7internal class RouterDbProfileConfiguration
 8{
 9    private readonly Dictionary<string, (Profile profile, EdgeFactorCache cache, TurnCostFactorCache turnCostFactorCache
 10
 21111    public RouterDbProfileConfiguration()
 21112    {
 21113        _profiles = new Dictionary<string, (Profile profile, EdgeFactorCache cache, TurnCostFactorCache turnCostFactorCa
 21114    }
 15
 16    internal IEnumerable<string> GetProfileNames()
 017    {
 018        return _profiles.Keys.ToList();
 019    }
 20
 21    internal bool HasProfile(string name)
 022    {
 023        return _profiles.ContainsKey(name);
 024    }
 25
 26    public void AddProfiles(IEnumerable<Profile> profiles)
 3727    {
 18528        foreach (var profile in profiles)
 3729        {
 3730            _profiles[profile.Name] = (profile, new EdgeFactorCache(), new TurnCostFactorCache());
 3731        }
 3732    }
 33
 34    internal bool TryGetProfileHandlerEdgeTypesCache(string profileName, out EdgeFactorCache? cache, out TurnCostFactorC
 1148735    {
 1148736        cache = null;
 1148737        turnCostFactorCache = null;
 1148738        if (!_profiles.TryGetValue(profileName, out var profileValue))
 6939        {
 6940            return false;
 41        }
 42
 1141843        cache = profileValue.cache;
 1141844        turnCostFactorCache = profileValue.turnCostFactorCache;
 1141845        return true;
 1148746    }
 47
 048    public IEnumerable<Profile> Profiles => _profiles.Values.Select(x => x.profile);
 49}