• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

MangoInstantMessenger / MangoMessengerAPI / 4430788880

pending completion
4430788880

Pull #370

github

GitHub
Merge 4f50c4947 into a80119744
Pull Request #370: Azure for students

151 of 210 branches covered (71.9%)

Branch coverage included in aggregate %.

29 of 29 new or added lines in 5 files covered. (100.0%)

2292 of 2568 relevant lines covered (89.25%)

27.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.45
/MangoAPI.Domain/Entities/MessageEntity.cs
1
using FluentValidation;
2
using System;
3

4
namespace MangoAPI.Domain.Entities;
5

6
public sealed class MessageEntity
7
{
8
    public Guid Id { get; private set; }
454✔
9

10
    public Guid UserId { get; private set; }
355✔
11

12
    public Guid ChatId { get; private set; }
348✔
13

14
    public string Text { get; private set; }
434✔
15

16
    public string InReplyToUser { get; private set; }
196✔
17

18
    public string InReplyToText { get; private set; }
196✔
19

20
    public string AttachmentFileName { get; private set; }
187✔
21

22
    public DateTime CreatedAt { get; private set; }
272✔
23

24
    public DateTime? UpdatedAt { get; private set; }
10✔
25

26
    public UserEntity User { get; private set; }
8✔
27

28
    public ChatEntity Chat { get; private set; }
2✔
29

30
    private MessageEntity()
7✔
31
    {
32
    }
7✔
33

34
    private MessageEntity(Guid userId, Guid chatId, string text)
159✔
35
    {
36
        Id = Guid.NewGuid();
159✔
37
        UserId = userId;
159✔
38
        ChatId = chatId;
159✔
39
        Text = text;
159✔
40
        CreatedAt = DateTime.UtcNow;
159✔
41

42
        new MessageEntityValidator().ValidateAndThrow(this);
159✔
43
    }
159✔
44

45
    private MessageEntity(
46
        Guid userId,
47
        Guid chatId,
48
        string text,
49
        string inReplyToUser,
50
        string inReplyToText,
51
        string attachmentFileName) : this(userId, chatId, text)
9✔
52
    {
53
        CreatedAt = DateTime.UtcNow;
9✔
54
        InReplyToUser = inReplyToUser;
9✔
55
        InReplyToText = inReplyToText;
9✔
56
        AttachmentFileName = attachmentFileName;
9✔
57

58
        new MessageEntityValidator().ValidateAndThrow(this);
9✔
59
    }
9✔
60

61
    private MessageEntity(
62
        Guid id,
63
        Guid userId,
64
        Guid chatId,
65
        string text,
66
        string inReplyToUser,
67
        string inReplyToText,
68
        string attachmentFileName) : this(userId, chatId, text, inReplyToUser, inReplyToText, attachmentFileName)
9✔
69
    {
70
        Id = id;
9✔
71
        new MessageEntityValidator().ValidateAndThrow(this);
9✔
72
    }
9✔
73

74
    public static MessageEntity Create(
75
        Guid userId,
76
        Guid chatId,
77
        string text,
78
        string inReplyToUser,
79
        string inReplyToText,
80
        string attachmentFileName)
81
    {
82
        var message = new MessageEntity(
×
83
            userId,
×
84
            chatId,
×
85
            text,
×
86
            inReplyToUser,
×
87
            inReplyToText,
×
88
            attachmentFileName);
×
89

90
        return message;
×
91
    }
92

93
    public static MessageEntity Create(
94
        Guid id,
95
        Guid userId,
96
        Guid chatId,
97
        string text,
98
        string inReplyToUser,
99
        string inReplyToText,
100
        string attachmentFileName)
101
    {
102
        var message = new MessageEntity(
9✔
103
            id,
9✔
104
            userId,
9✔
105
            chatId,
9✔
106
            text,
9✔
107
            inReplyToUser,
9✔
108
            inReplyToText,
9✔
109
            attachmentFileName);
9✔
110

111
        return message;
9✔
112
    }
113

114
    public static MessageEntity Create(Guid userId, Guid chatId, string text)
115
    {
116
        var message = new MessageEntity(userId, chatId, text);
150✔
117

118
        return message;
150✔
119
    }
120

121
    public void UpdateMessageText(string text)
122
    {
123
        Text = text;
1✔
124
        UpdatedAt = DateTime.UtcNow;
1✔
125

126
        new MessageEntityValidator().ValidateAndThrow(this);
1✔
127
    }
1✔
128
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc