forked from microsoft/mail2bug
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTfsQueryParserUnitTest.cs
39 lines (35 loc) · 2.28 KB
/
TfsQueryParserUnitTest.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
31
32
33
34
35
36
37
38
39
using System;
using System.Collections.Generic;
using Mail2Bug.WorkItemManagement;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Mail2BugUnitTests
{
[TestClass]
public class TfsQueryParserUnitTest
{
[TestMethod]
public void TestBasicQueries()
{
var testCases = new List<Tuple<string, string>>
{
new Tuple<string, string>(
@"<?xml version=""1.0"" encoding=""utf-8""?><WorkItemQuery Version=""1""><TeamFoundationServer>http://myserver:8080/tfs/abcd</TeamFoundationServer>" +
@"<TeamProject>Project</TeamProject><Wiql>SELECT [System.Id], [System.Title] FROM WorkItems WHERE [System.WorkItemType] <> '' AND ([System.CreatedBy] =" +
@" 'mail2bug' OR [System.CreatedBy] = 'mail2buguser') AND [System.ChangedDate] > @today - 60 ORDER BY [System.Id]</Wiql></WorkItemQuery>",
"SELECT [System.Id], [System.Title] FROM WorkItems WHERE [System.WorkItemType] <> '' AND ([System.CreatedBy] = 'mail2bug' OR [System.CreatedBy] " +
"= 'mail2buguser') AND [System.ChangedDate] > @today - 60 ORDER BY [System.Id]"),
new Tuple<string, string>(
@"<?xml version=""1.0"" encoding=""utf-8""?><WorkItemQuery Version=""1""><TeamFoundationServer>http://myserver:8080/tfs/abcd</TeamFoundationServer>" +
@"<TeamProject>Project</TeamProject><Wiql>SELECT [System.Id], [System.Title] FROM WorkItems WHERE ([System.WorkItemType] = 'Bug' OR " +
@"[System.WorkItemType] = 'Task') AND ([System.CreatedBy] = 'mail2bug' OR [System.CreatedBy] = 'mail2buguser') AND [System.ChangedDate] > " +
@"@today - 60 ORDER BY [System.Id]</Wiql></WorkItemQuery>",
"SELECT [System.Id], [System.Title] FROM WorkItems WHERE ([System.WorkItemType] = 'Bug' OR [System.WorkItemType] = 'Task') AND ([System.CreatedBy] = " +
"'mail2bug' OR [System.CreatedBy] = 'mail2buguser') AND [System.ChangedDate] > @today - 60 ORDER BY [System.Id]")
};
foreach (var testCase in testCases)
{
Assert.AreEqual(testCase.Item2, TFSQueryParser.ParseQueryFile(testCase.Item1));
}
}
}
}