< Summary

Class:AvatarAssets_Test.GeneralReplacesListShould
Assembly:AvatarAssetsTest
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Models/AvatarAssets/Tests/AvatarAsetsTest.cs
Covered lines:12
Uncovered lines:0
Coverable lines:12
Total lines:157
Line coverage:100% (12 of 12)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
BeRetrievedProperly()0%110100%
BeRetrievedWhenBodyShapeDoesntMatchOverride()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Models/AvatarAssets/Tests/AvatarAsetsTest.cs

#LineLine coverage
 1using DCL.Helpers;
 2using NUnit.Framework;
 3
 4namespace AvatarAssets_Test
 5{
 6    public class GeneralReplacesListShould : IntegrationTestSuite_Legacy
 7    {
 8        [Test]
 9        public void BeRetrievedProperly()
 10        {
 111            WearableItem wearableItem = new WearableItem
 12            {
 13                data = new WearableItem.Data()
 14                {
 15                    replaces = new [] { "category1", "category2", "category3" }
 16                }
 17            };
 18
 119            var replaces = wearableItem.GetReplacesList(null);
 20
 121            Assert.AreEqual("category1", replaces[0]);
 122            Assert.AreEqual("category2", replaces[1]);
 123            Assert.AreEqual("category3", replaces[2]);
 124        }
 25
 26        [Test]
 27        public void BeRetrievedWhenBodyShapeDoesntMatchOverride()
 28        {
 129            WearableItem wearableItem = new WearableItem
 30            {
 31                data = new WearableItem.Data()
 32                {
 33                    replaces = new [] { "category1", "category2", "category3" },
 34                    representations = new []
 35                    {
 36                        new WearableItem.Representation()
 37                        {
 38                            bodyShapes = new [] { "bodyShape1" },
 39                            overrideReplaces = new [] { "override1", "override2", "override3" },
 40                        }
 41                    }
 42                }
 43            };
 44
 145            var replaces = wearableItem.GetReplacesList("not_bodyShape1");
 46
 147            Assert.AreEqual("category1", replaces[0]);
 148            Assert.AreEqual("category2", replaces[1]);
 149            Assert.AreEqual("category3", replaces[2]);
 150        }
 51    }
 52
 53    public class OverrideReplacesListShould : IntegrationTestSuite_Legacy
 54    {
 55        [Test]
 56        public void BeRetrievedProperly()
 57        {
 58            WearableItem wearableItem = new WearableItem
 59            {
 60                data = new WearableItem.Data()
 61                {
 62                    replaces = new [] { "category1", "category2", "category3" },
 63                    representations = new []
 64                    {
 65                        new WearableItem.Representation()
 66                        {
 67                            bodyShapes = new [] { "bodyShape1" },
 68                            overrideReplaces = new [] { "override1", "override2", "override3" },
 69                        }
 70                    }
 71                }
 72            };
 73
 74            var replaces = wearableItem.GetReplacesList("bodyShape1");
 75
 76            Assert.AreEqual("override1", replaces[0]);
 77            Assert.AreEqual("override2", replaces[1]);
 78            Assert.AreEqual("override3", replaces[2]);
 79        }
 80    }
 81
 82    public class GeneralHidesListShould : IntegrationTestSuite_Legacy
 83    {
 84        [Test]
 85        public void BeRetrievedProperly()
 86        {
 87            WearableItem wearableItem = new WearableItem
 88            {
 89                data = new WearableItem.Data()
 90                {
 91                    hides = new [] { "category1", "category2", "category3" }
 92                }
 93            };
 94
 95            var hides = wearableItem.GetHidesList(null);
 96
 97            Assert.AreEqual("category1", hides[0]);
 98            Assert.AreEqual("category2", hides[1]);
 99            Assert.AreEqual("category3", hides[2]);
 100        }
 101
 102        [Test]
 103        public void BeRetrievedWhenBodyShapeDoesntMatchOverride()
 104        {
 105            WearableItem wearableItem = new WearableItem
 106            {
 107                data = new WearableItem.Data()
 108                {
 109                    hides = new [] { "category1", "category2", "category3" },
 110                    representations = new []
 111                    {
 112                        new WearableItem.Representation()
 113                        {
 114                            bodyShapes = new [] { "bodyShape1" },
 115                            overrideHides = new [] { "override1", "override2", "override3" },
 116                        }
 117                    }
 118                }
 119            };
 120
 121            var hides = wearableItem.GetHidesList("not_bodyShape1");
 122
 123            Assert.AreEqual("category1", hides[0]);
 124            Assert.AreEqual("category2", hides[1]);
 125            Assert.AreEqual("category3", hides[2]);
 126        }
 127    }
 128
 129    public class OverrideHidesListShould : IntegrationTestSuite_Legacy
 130    {
 131        [Test]
 132        public void BeRetrievedProperly()
 133        {
 134            WearableItem wearableItem = new WearableItem
 135            {
 136                data = new WearableItem.Data()
 137                {
 138                    hides = new [] { "category1", "category2", "category3" },
 139                    representations = new []
 140                    {
 141                        new WearableItem.Representation()
 142                        {
 143                            bodyShapes = new [] { "bodyShape1" },
 144                            overrideHides = new [] { "override1", "override2", "override3" },
 145                        }
 146                    }
 147                }
 148            };
 149
 150            var hides = wearableItem.GetHidesList("bodyShape1");
 151
 152            Assert.AreEqual("override1", hides[0]);
 153            Assert.AreEqual("override2", hides[1]);
 154            Assert.AreEqual("override3", hides[2]);
 155        }
 156    }
 157}