-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimeByState.cs
More file actions
37 lines (32 loc) · 1.13 KB
/
TimeByState.cs
File metadata and controls
37 lines (32 loc) · 1.13 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
using AzureDevopsTracker.Extensions;
using System;
namespace AzureDevopsTracker.Entities
{
public class TimeByState : Entity
{
public string WorkItemId { get; private set; }
public string State { get; private set; }
public double TotalTime { get; private set; }
public double TotalWorkedTime { get; private set; }
public WorkItem WorkItem { get; private set; }
private TimeByState() { }
public TimeByState(string workItemId,
string state,
TimeSpan totalTime,
TimeSpan totalWorkedTime)
{
WorkItemId = workItemId;
State = state;
TotalTime = totalTime.TotalSeconds;
TotalWorkedTime = totalWorkedTime.TotalSeconds;
Validate();
}
public void Validate()
{
if (WorkItemId.IsNullOrEmpty() || Convert.ToInt64(WorkItemId) <= 0)
throw new Exception("WorkItemId is required");
if (State.IsNullOrEmpty())
throw new Exception("State is required");
}
}
}