< Summary

Class:WaitForSecondsCache
Assembly:WaitForSecondsCache
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/WaitForSecondsHelpers/WaitForSecondsCache.cs
Covered lines:6
Uncovered lines:0
Coverable lines:6
Total lines:22
Line coverage:100% (6 of 6)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
WaitForSecondsCache()0%110100%
Get(...)0%220100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/WaitForSecondsHelpers/WaitForSecondsCache.cs

#LineLine coverage
 1using System;
 2using System.Collections;
 3using System.Collections.Generic;
 4using UnityEngine;
 5
 6public class WaitForSecondsCache
 7{
 18    private static Dictionary<string, WaitForSeconds> waitCache = new Dictionary<string, WaitForSeconds>();
 9
 10    public static WaitForSeconds Get(float seconds)
 11    {
 9612        string key = seconds.ToString("0.0");
 13
 9614        if (!waitCache.ContainsKey(key))
 15        {
 1016            float rounded = (float)Math.Round(seconds, 1);
 1017            waitCache.Add(key, new WaitForSeconds(rounded));
 18        }
 19
 9620        return waitCache[key];
 21    }
 22}