< 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:263_26948838820

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
 31811    public RouterDbProfileConfiguration()
 31812    {
 31813        _profiles = new Dictionary<string, (Profile profile, EdgeFactorCache cache, TurnCostFactorCache turnCostFactorCa
 31814    }
 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)
 6327    {
 31528        foreach (var profile in profiles)
 6329        {
 6330            _profiles[profile.Name] = (profile, new EdgeFactorCache(), new TurnCostFactorCache());
 6331        }
 6332    }
 33
 34    internal bool TryGetProfileHandlerEdgeTypesCache(string profileName, out EdgeFactorCache? cache, out TurnCostFactorC
 1392435    {
 1392436        cache = null;
 1392437        turnCostFactorCache = null;
 1392438        if (!_profiles.TryGetValue(profileName, out var profileValue))
 18739        {
 18740            return false;
 41        }
 42
 1373743        cache = profileValue.cache;
 1373744        turnCostFactorCache = profileValue.turnCostFactorCache;
 1373745        return true;
 1392446    }
 47
 048    public IEnumerable<Profile> Profiles => _profiles.Values.Select(x => x.profile);
 49}