< Summary

Class:AssetPromiseKeeper_Gif_Tests.APK_Gif_Promise_Should
Assembly:AssetPromiseKeeper_Gif_Tests
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/Gif/Tests/APK_Gif_Promise_Should.cs
Covered lines:15
Uncovered lines:0
Coverable lines:15
Total lines:46
Line coverage:100% (15 of 15)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
CreatePromise()0%110100%
ShareGifAmongPromises()0%550100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/Gif/Tests/APK_Gif_Promise_Should.cs

#LineLine coverage
 1using AssetPromiseKeeper_Tests;
 2using DCL;
 3using DCL.Helpers;
 4using System.Collections;
 5using UnityEngine.Assertions;
 6using UnityEngine.TestTools;
 7
 8namespace AssetPromiseKeeper_Gif_Tests
 9{
 10    public class APK_Gif_Promise_Should : TestsBase_APK<AssetPromiseKeeper_Gif,
 11        AssetPromise_Gif,
 12        Asset_Gif,
 13        AssetLibrary_RefCounted<Asset_Gif>>
 14    {
 15        protected AssetPromise_Gif CreatePromise()
 16        {
 217            string url = TestAssetsUtils.GetPath() + "/Images/gif1.gif";
 218            var prom = new AssetPromise_Gif(url);
 219            return prom;
 20        }
 21
 22        [UnityTest]
 23        public IEnumerator ShareGifAmongPromises()
 24        {
 125            Asset_Gif[] assets = new Asset_Gif [] { null, null };
 126            AssetPromise_Gif[] promises = new AssetPromise_Gif [] { CreatePromise(), CreatePromise() };
 27
 228            promises[0].OnSuccessEvent += (x) => assets[0] = x;
 229            promises[1].OnSuccessEvent += (x) => assets[1] = x;
 30
 631            for (int i = 0; i < promises.Length; i++)
 32            {
 233                keeper.Keep(promises[i]);
 234                yield return promises[i];
 35            }
 36
 637            for (int i = 0; i < assets.Length; i++)
 38            {
 239                Assert.IsNotNull(assets[i]);
 240                Assert.IsNotNull(assets[i].texture);
 41            }
 42
 143            Assert.IsTrue(assets[0].texture == assets[1].texture);
 144        }
 45    }
 46}