aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.UnitTesting/TFS
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2019-02-23 20:15:36 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2019-02-23 20:15:36 +0200
commit17612c08da93c75d4c941a643bc7602c18f351d8 (patch)
tree7fb879ef52d5460149b199f752279c3889cb5271 /Software/Visual_Studio/Tango.UnitTesting/TFS
parentd7c8a8e9a6320ade6098e0d8e182c7ada4e30a97 (diff)
downloadTango-17612c08da93c75d4c941a643bc7602c18f351d8.tar.gz
Tango-17612c08da93c75d4c941a643bc7602c18f351d8.zip
Implemented auto DTO generation.
Implemented mapping of DTO <=> Observables. Organization of unit tests. Removed DELETED from ADDRESS & CONTACT.
Diffstat (limited to 'Software/Visual_Studio/Tango.UnitTesting/TFS')
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/TFS/TFS_TST.cs145
1 files changed, 145 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.UnitTesting/TFS/TFS_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/TFS/TFS_TST.cs
new file mode 100644
index 000000000..613cfb8c5
--- /dev/null
+++ b/Software/Visual_Studio/Tango.UnitTesting/TFS/TFS_TST.cs
@@ -0,0 +1,145 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core.Helpers;
+using Tango.Core.IO;
+using Tango.TFS;
+
+namespace Tango.UnitTesting.TFS
+{
+ [TestClass]
+ [TestCategory("Team Foundation Service")]
+ public class TFS_TST
+ {
+ private ITeamFoundationServiceClient CreateClient()
+ {
+ ITeamFoundationServiceClient client = new TeamFoundationServiceClient(
+
+ "https://twinetfs.visualstudio.com/DefaultCollection",
+ "Roy",
+ "szzfokrceo4rhd4eqi5qpmxn3pa5iwl3q7tlqd36l2m7smz2ynoa");
+ return client;
+ }
+
+ [TestMethod]
+ public void Get_Tango_Project()
+ {
+ ITeamFoundationServiceClient client = CreateClient();
+
+ var project = client.GetProject("Tango").Result;
+
+ Assert.IsNotNull(project);
+ }
+
+ [TestMethod]
+ public void Get_Work_Item()
+ {
+ ITeamFoundationServiceClient client = CreateClient();
+
+ var project = client.GetProject("Tango").Result;
+
+ Assert.IsNotNull(project);
+
+ var workItem = client.GetWorkItem(project, 168).Result;
+
+ Assert.IsNotNull(workItem);
+ }
+
+ [TestMethod]
+ public void Get_Work_Items_Created_By()
+ {
+ ITeamFoundationServiceClient client = CreateClient();
+
+ var project = client.GetProject("Tango").Result;
+
+ Assert.IsNotNull(project);
+
+ var workItems = client.GetWorkItemsCreatedBy(project, project.Members.SingleOrDefault(x => x.AssignName.ToLower().Contains("roy"))).Result;
+
+ Assert.IsTrue(workItems.Count > 0);
+ }
+
+ [TestMethod]
+ public void Set_Work_Item_State()
+ {
+ ITeamFoundationServiceClient client = CreateClient();
+
+ var project = client.GetProject("Tango").Result;
+
+ Assert.IsNotNull(project);
+
+ var workItem = client.GetWorkItem(project, 164).Result;
+
+ Assert.IsNotNull(workItem);
+
+ var updated = client.SetWorkItemState(project, workItem, State.Active).Result;
+
+ Assert.IsTrue(updated.State == State.Active);
+ }
+
+ [TestMethod]
+ public void Add_Work_Item_Comment()
+ {
+ ITeamFoundationServiceClient client = CreateClient();
+
+ var project = client.GetProject("Tango").Result;
+
+ Assert.IsNotNull(project);
+
+ var workItem = client.GetWorkItem(project, 165).Result;
+
+ Assert.IsNotNull(workItem);
+
+ var updated = client.AddWorkItemComment(project, workItem, project.Members.SingleOrDefault(x => x.AssignName.ToLower().Contains("roy")), "Test Comment").Result;
+
+ Assert.AreEqual(updated.Comment, "Test Comment");
+ }
+
+ [TestMethod]
+ public void Upload_Work_Item()
+ {
+ ITeamFoundationServiceClient client = CreateClient();
+
+ var project = client.GetProject("Tango").Result;
+
+ Assert.IsNotNull(project);
+
+ WorkItem item = new WorkItem();
+ item.Area = project.Areas.First();
+ item.AssignedTo = project.Members.Single(x => x.DisplayName.Contains("Roy"));
+ item.CreatedBy = project.Members.Single(x => x.DisplayName.Contains("Shlomo"));
+ item.ChangedBy = project.Members.Single(x => x.DisplayName.Contains("Shlomo"));
+ item.AuthorizedAs = project.Members.Single(x => x.DisplayName.Contains("Shlomo"));
+
+ var tempFile = TemporaryManager.Default.CreateFile();
+ File.AppendAllText(tempFile.Path, "This is a test text file...");
+
+ item.Attachments.Add(new Attachment()
+ {
+ Description = "Test Attachment",
+ FilePath = tempFile.Path,
+ Name = "TestDocument.txt"
+ });
+
+ item.Description = "This is a test description";
+ item.FoundInBuild = "1.0.0.9";
+ item.Iteration = project.Iterations.First();
+ item.Priority = Priority.Priority3;
+ item.Severity = Severity.Medium;
+ item.State = State.New;
+ item.StepsToReproduce = "Step 1" + Environment.NewLine + "Step 2";
+ item.SystemInformation = "This is the system information";
+ item.Tags.Add(project.Tags.First());
+ item.Title = "Test Bug";
+ item.Type = WorkItemType.Bug;
+
+ var workItem = client.UploadWorkItem(project, item).Result;
+
+ Assert.IsNotNull(workItem);
+ }
+ }
+}