-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChangeLogItem.cs
More file actions
54 lines (45 loc) · 1.68 KB
/
ChangeLogItem.cs
File metadata and controls
54 lines (45 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using AzureDevopsTracker.Extensions;
using System;
namespace AzureDevopsTracker.Entities
{
public class ChangeLogItem : Entity
{
public string WorkItemId { get; private set; }
public string Title { get; private set; }
public string Description { get; private set; }
public string WorkItemType { get; private set; }
public string ChangeLogId { get; private set; }
public bool WasReleased => string.IsNullOrWhiteSpace(ChangeLogId);
public ChangeLog ChangeLog { get; private set; }
private ChangeLogItem() { }
public ChangeLogItem(string workItemId,
string title,
string description,
string workItemType)
{
WorkItemId = workItemId;
Title = title;
Description = description;
WorkItemType = workItemType;
Validate();
}
public void Release(string changeLogId) => ChangeLogId = changeLogId;
public void Update(string title,
string workItemType,
string description)
{
Title = title;
WorkItemType = workItemType;
Description = description;
}
public void Validate()
{
if (WorkItemId.IsNullOrEmpty() || Convert.ToInt64(WorkItemId) <= 0)
throw new Exception("WorkItemId is required");
if (Title.IsNullOrEmpty())
throw new Exception("Title is required");
if (WorkItemType.IsNullOrEmpty())
throw new Exception("WorkItemType is required");
}
}
}