aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.UnitTesting
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-04-23 19:56:48 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-04-23 19:56:48 +0300
commit8046598cb1439b66a8d6e556a61b715fc859a6b0 (patch)
tree5beaa8ca495f48ffbb40174b3569aab18debd6c1 /Software/Visual_Studio/Tango.UnitTesting
parent680563266381a80a453ff93214812796fe519fec (diff)
downloadTango-8046598cb1439b66a8d6e556a61b715fc859a6b0.tar.gz
Tango-8046598cb1439b66a8d6e556a61b715fc859a6b0.zip
Implemented TeamFoundationClient components !!!
Diffstat (limited to 'Software/Visual_Studio/Tango.UnitTesting')
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/App.config8
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/Outlook_TST.cs35
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/TFS_TST.cs94
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj40
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/packages.config2
5 files changed, 176 insertions, 3 deletions
diff --git a/Software/Visual_Studio/Tango.UnitTesting/App.config b/Software/Visual_Studio/Tango.UnitTesting/App.config
index 516b46de6..346a716a3 100644
--- a/Software/Visual_Studio/Tango.UnitTesting/App.config
+++ b/Software/Visual_Studio/Tango.UnitTesting/App.config
@@ -63,6 +63,14 @@
<assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
+ </dependentAssembly>
</assemblyBinding>
</runtime>
</configuration> \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.UnitTesting/Outlook_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/Outlook_TST.cs
new file mode 100644
index 000000000..b34db8578
--- /dev/null
+++ b/Software/Visual_Studio/Tango.UnitTesting/Outlook_TST.cs
@@ -0,0 +1,35 @@
+using Microsoft.Office.Interop.Outlook;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Outlook = Microsoft.Office.Interop.Outlook;
+
+namespace Tango.UnitTesting
+{
+ [TestClass]
+ [TestCategory("Outlook")]
+ public class Outlook_TST
+ {
+ [TestMethod]
+ public void Send_Email_With_Logs()
+ {
+ Application app = new Application();
+ MailItem email = (MailItem)app.CreateItem(OlItemType.olMailItem);
+ email.Subject = "Machine Studio Test";
+ email.To = "roy@twine-s.com";
+ email.Body = "Some body";
+
+ email.Attachments.Add(
+ "D:\\C#.txt",
+ OlAttachmentType.olByValue,
+ 1,
+ "CSharp Code");
+
+ email.Importance = OlImportance.olImportanceNormal;
+ email.Send();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.UnitTesting/TFS_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/TFS_TST.cs
new file mode 100644
index 000000000..2727ad00e
--- /dev/null
+++ b/Software/Visual_Studio/Tango.UnitTesting/TFS_TST.cs
@@ -0,0 +1,94 @@
+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.TFS;
+
+namespace Tango.UnitTesting
+{
+ [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, 153).Result;
+
+ Assert.IsNotNull(workItem);
+ }
+
+ [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"));
+
+ String tempFile = PathHelper.GetTempFilePath();
+ File.AppendAllText(tempFile, "This is a test text file...");
+
+ item.Attachments.Add(new Attachment()
+ {
+ Description = "Test Attachment",
+ FilePath = tempFile,
+ 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);
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj
index 9a4e25264..fd7de86c4 100644
--- a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj
+++ b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj
@@ -53,14 +53,15 @@
<Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
+ <Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.1.11\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.1.11\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
- <Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
- <HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
+ <Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
@@ -88,6 +89,8 @@
<Compile Include="DependencyInjection_TST.cs" />
<Compile Include="Logging_TST.cs" />
<Compile Include="MachineStudio_TST.cs" />
+ <Compile Include="TFS_TST.cs" />
+ <Compile Include="Outlook_TST.cs" />
<Compile Include="Scripting_TST.cs" />
<Compile Include="Embroidery_TST.cs" />
<Compile Include="Helper.cs" />
@@ -159,11 +162,44 @@
<Project>{7ada4e86-cad7-4968-a210-3a8a9e5153ab}</Project>
<Name>Tango.Synchronization</Name>
</ProjectReference>
+ <ProjectReference Include="..\Tango.TFS\Tango.TFS.csproj">
+ <Project>{998f8471-dc1b-41b6-9d96-354e1b4e7a32}</Project>
+ <Name>Tango.TFS</Name>
+ </ProjectReference>
<ProjectReference Include="..\Utilities\Tango.DBObservablesGenerator.CLI\Tango.DBObservablesGenerator.CLI.csproj">
<Project>{ebb7cb9f-6af2-456b-a5dd-1b136b605d90}</Project>
<Name>Tango.DBObservablesGenerator.CLI</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <COMReference Include="Microsoft.Office.Core">
+ <Guid>{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}</Guid>
+ <VersionMajor>2</VersionMajor>
+ <VersionMinor>8</VersionMinor>
+ <Lcid>0</Lcid>
+ <WrapperTool>primary</WrapperTool>
+ <Isolated>False</Isolated>
+ <EmbedInteropTypes>True</EmbedInteropTypes>
+ </COMReference>
+ <COMReference Include="Microsoft.Office.Interop.Outlook">
+ <Guid>{00062FFF-0000-0000-C000-000000000046}</Guid>
+ <VersionMajor>9</VersionMajor>
+ <VersionMinor>6</VersionMinor>
+ <Lcid>0</Lcid>
+ <WrapperTool>primary</WrapperTool>
+ <Isolated>False</Isolated>
+ <EmbedInteropTypes>True</EmbedInteropTypes>
+ </COMReference>
+ <COMReference Include="stdole">
+ <Guid>{00020430-0000-0000-C000-000000000046}</Guid>
+ <VersionMajor>2</VersionMajor>
+ <VersionMinor>0</VersionMinor>
+ <Lcid>0</Lcid>
+ <WrapperTool>primary</WrapperTool>
+ <Isolated>False</Isolated>
+ <EmbedInteropTypes>True</EmbedInteropTypes>
+ </COMReference>
+ </ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
diff --git a/Software/Visual_Studio/Tango.UnitTesting/packages.config b/Software/Visual_Studio/Tango.UnitTesting/packages.config
index 7df5dedbd..16e993ae8 100644
--- a/Software/Visual_Studio/Tango.UnitTesting/packages.config
+++ b/Software/Visual_Studio/Tango.UnitTesting/packages.config
@@ -5,7 +5,7 @@
<package id="Google.Protobuf" version="3.4.1" targetFramework="net46" />
<package id="MSTest.TestAdapter" version="1.1.11" targetFramework="net45" />
<package id="MSTest.TestFramework" version="1.1.11" targetFramework="net45" />
- <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
+ <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net46" />
<package id="System.Data.SQLite" version="1.0.106.0" targetFramework="net46" />
<package id="System.Data.SQLite.Core" version="1.0.106.0" targetFramework="net46" />
<package id="System.Data.SQLite.EF6" version="1.0.106.0" targetFramework="net46" />