< Summary

Class:TestHelpers_Chat
Assembly:ChatControllerTests
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/ChatController/Tests/Helpers/TestHelpers_Chat.cs
Covered lines:12
Uncovered lines:3
Coverable lines:15
Total lines:53
Line coverage:80% (12 of 15)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
FakePrivateChatMessage(...)0%330100%
FakePrivateChatMessageTo(...)0%2100%
FakePrivateChatMessageFrom(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/ChatController/Tests/Helpers/TestHelpers_Chat.cs

#LineLine coverage
 1using DCL.Interface;
 2using UnityEngine;
 3
 4public static class TestHelpers_Chat
 5{
 6    private static void FakePrivateChatMessage(IChatController controller, string sender, string recipient, string messa
 7    {
 18        if (!UserProfileController.userProfilesCatalog.Get(recipient))
 9        {
 110            var model = new UserProfileModel()
 11            {
 12                userId = recipient,
 13                name = recipient + "-name",
 14            };
 15
 116            UserProfileController.i.AddUserProfileToCatalog(model);
 17        }
 18
 119        if (!UserProfileController.userProfilesCatalog.Get(sender))
 20        {
 121            var model = new UserProfileModel()
 22            {
 23                userId = sender,
 24                name = sender + "-name",
 25            };
 26
 127            UserProfileController.i.AddUserProfileToCatalog(model);
 28        }
 29
 130        var msg = new ChatMessage()
 31        {
 32            body = message,
 33            sender = sender,
 34            recipient = recipient,
 35            messageType = ChatMessage.Type.PRIVATE,
 36            timestamp = 1000
 37        };
 38
 139        controller.AddMessageToChatWindow(JsonUtility.ToJson(msg));
 140    }
 41
 42    public static void FakePrivateChatMessageTo(IChatController controller, string recipientUserId, string message)
 43    {
 044        UserProfile ownProfile = UserProfile.GetOwnUserProfile();
 045        FakePrivateChatMessage(controller, ownProfile.userId, recipientUserId, message);
 046    }
 47
 48    public static void FakePrivateChatMessageFrom(IChatController controller, string senderUserId, string message)
 49    {
 150        UserProfile ownProfile = UserProfile.GetOwnUserProfile();
 151        FakePrivateChatMessage(controller, senderUserId, ownProfile.userId, message);
 152    }
 53}