< Summary

Class:ProfanityWordProviderFromResourcesJson
Assembly:ProfanityFiltering
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/ProfanityFiltering/ProfanityWordProviderFromResourcesJson.cs
Covered lines:6
Uncovered lines:3
Coverable lines:9
Total lines:32
Line coverage:66.6% (6 of 9)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
ProfanityWordProviderFromResourcesJson(...)0%2100%
GetExplicitWords()0%110100%
GetNonExplicitWords()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/ProfanityFiltering/ProfanityWordProviderFromResourcesJson.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using UnityEngine;
 3
 4public class ProfanityWordProviderFromResourcesJson : IProfanityWordProvider
 5{
 6    private readonly string jsonFilePath;
 7
 08    public ProfanityWordProviderFromResourcesJson(string jsonFilePath)
 9    {
 010        this.jsonFilePath = jsonFilePath;
 011    }
 12
 13    public IEnumerable<string> GetExplicitWords()
 14    {
 115        var asset = Resources.Load<TextAsset>(jsonFilePath);
 116        var json = JsonUtility.FromJson<ProfanityWordsJsonStructure>(asset.text);
 117        return json.explicitWords;
 18    }
 19
 20    public IEnumerable<string> GetNonExplicitWords()
 21    {
 122        var asset = Resources.Load<TextAsset>(jsonFilePath);
 123        var json = JsonUtility.FromJson<ProfanityWordsJsonStructure>(asset.text);
 124        return json.nonExplicitWords;
 25    }
 26
 27    private struct ProfanityWordsJsonStructure
 28    {
 29        public string[] explicitWords;
 30        public string[] nonExplicitWords;
 31    }
 32}