forked from christianrondeau/jira-toggl-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWorkLogEntryTests.cs
30 lines (27 loc) · 1.41 KB
/
WorkLogEntryTests.cs
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
using System;
using JiraTogglSync.Services;
using NUnit.Framework;
namespace JiraTogglSync.Tests;
public class WorkLogEntryTests
{
[Test]
public void CanDisplayNicelyAsString()
{
var workLogEntryDate = new DateTime(2014, 03, 25);
Assert.That(
$"[some-issue-key] - {workLogEntryDate:d} - 01:30:00 - My Entry",
Is.EqualTo(new WorkLogEntry("some-issue-key", "some-source-id", workLogEntryDate, 90, "My Entry").ToString())
);
}
[TestCase(null, ExpectedResult = null, TestName = "Sould return null, if input is null")]
[TestCase("", ExpectedResult = null, TestName = "Sould return null, if input is empty")]
[TestCase("Some random text", ExpectedResult = null, TestName = "Sould return null, if input doesn't have a match")]
[TestCase("No source id value [toggl-id:]", ExpectedResult = null, TestName = "Sould return null, if value of toggl id is not provided")]
[TestCase("Alpha source id value [toggl-id:123a]", ExpectedResult = null, TestName = "Sould return null, if value of toggle id contains non-numeric characters")]
[TestCase("Source id has value [toggl-id:123] !", ExpectedResult = "123", TestName = "Sould return toggle id value if it was provided")]
[TestCase("Multiple source id values [toggl-id:123] [toggl-id:456]!", ExpectedResult = "123", TestName = "Sould return first toggle id value is multiple are provided")]
public string GetSourceId(string input)
{
return WorkLogEntry.GetSourceId(input);
}
}