added first unit test
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -41,6 +41,7 @@ | ||||
|             this.button4 = new System.Windows.Forms.Button(); | ||||
|             this.label4 = new System.Windows.Forms.Label(); | ||||
|             this.label5 = new System.Windows.Forms.Label(); | ||||
|             this.button5 = new System.Windows.Forms.Button(); | ||||
|             ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); | ||||
|             ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); | ||||
|             ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit(); | ||||
| @ -173,6 +174,16 @@ | ||||
|             this.label5.TabIndex = 12; | ||||
|             this.label5.Text = "label5"; | ||||
|             //  | ||||
|             // button5 | ||||
|             //  | ||||
|             this.button5.Location = new System.Drawing.Point(68, 396); | ||||
|             this.button5.Name = "button5"; | ||||
|             this.button5.Size = new System.Drawing.Size(75, 23); | ||||
|             this.button5.TabIndex = 13; | ||||
|             this.button5.Text = "store"; | ||||
|             this.button5.UseVisualStyleBackColor = true; | ||||
|             this.button5.Click += new System.EventHandler(this.Button5_Click); | ||||
|             //  | ||||
|             // Form1 | ||||
|             //  | ||||
|             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); | ||||
| @ -180,6 +191,7 @@ | ||||
|             this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; | ||||
|             this.BackColor = System.Drawing.SystemColors.ActiveCaptionText; | ||||
|             this.ClientSize = new System.Drawing.Size(800, 450); | ||||
|             this.Controls.Add(this.button5); | ||||
|             this.Controls.Add(this.label5); | ||||
|             this.Controls.Add(this.label4); | ||||
|             this.Controls.Add(this.button4); | ||||
| @ -221,6 +233,7 @@ | ||||
|         private System.Windows.Forms.Button button4; | ||||
|         private System.Windows.Forms.Label label4; | ||||
|         private System.Windows.Forms.Label label5; | ||||
|         private System.Windows.Forms.Button button5; | ||||
|     } | ||||
| } | ||||
|  | ||||
|  | ||||
| @ -76,12 +76,10 @@ namespace WindowsFormsApp01 | ||||
|             var f = new CalcEventArgs(res); | ||||
|             //trigger handler | ||||
|  | ||||
|            // if (CalcFinished != null) | ||||
|           //  { | ||||
|                 CalcFinished(f); | ||||
|            // } | ||||
|  | ||||
|  | ||||
|             // if (CalcFinished != null) | ||||
|             //  { | ||||
|             CalcFinished(f); | ||||
|             // } | ||||
|         } | ||||
|  | ||||
|  | ||||
| @ -91,11 +89,46 @@ namespace WindowsFormsApp01 | ||||
|  | ||||
|             Pen _pen = new ClassLibrary01.Class1().getPen(); | ||||
|  | ||||
|             using (var p = _pen) | ||||
|             { | ||||
|                 draw(graphics); | ||||
|             } | ||||
|  | ||||
|             Brush aBrush = (Brush) Brushes.Red; | ||||
|  | ||||
|  | ||||
|             for (int i = 10; i < (502); i++) | ||||
|             { | ||||
|                 int y = (int) (246 - (((Math.Log(i) * 10) - 23) * _scale)); | ||||
|  | ||||
|                 graphics.FillRectangle(aBrush, i, y, 2, 2); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private void storeToFile() | ||||
|         { | ||||
|             Bitmap bmp = new Bitmap(100, 200); | ||||
|  | ||||
|             var graphics = Graphics.FromImage(bmp); | ||||
|  | ||||
|             draw(graphics); | ||||
|  | ||||
|             bmp.Save(@"C:\Temp\AI.png"); | ||||
|         } | ||||
|  | ||||
|         private void draw(Graphics graphics) | ||||
|         { | ||||
|             Pen _pen = new ClassLibrary01.Class1().getPen(); | ||||
|  | ||||
|             graphics.Clear(Color.Aqua); | ||||
|              | ||||
|  | ||||
|             using (var p = _pen) | ||||
|             { | ||||
|                 //y axis | ||||
|                 graphics.DrawLine(p, 10, 10, 10, 246); | ||||
|  | ||||
|  | ||||
|                 //x axis | ||||
|                 graphics.DrawLine(p, 10, 246, 502, 246); | ||||
|  | ||||
| @ -107,19 +140,6 @@ namespace WindowsFormsApp01 | ||||
|                 graphics.DrawLine(p, 498, 241, 502, 246); | ||||
|                 graphics.DrawLine(p, 498, 251, 502, 246); | ||||
|             } | ||||
|  | ||||
|             Brush aBrush = (Brush) Brushes.Red; | ||||
|  | ||||
|  | ||||
|             for (int i = 10; i < (502); i++) | ||||
|             { | ||||
|                 int y = (int) (246 - (((Math.Log(i) * 10) - 23) * _scale)); | ||||
|  | ||||
|                 graphics.FillRectangle(aBrush, i, y, 2, 2); | ||||
|             } | ||||
|  | ||||
|  | ||||
|             //graphics.DrawEllipse(new Pen(Color.Black), 70, 70, 30, 10); | ||||
|         } | ||||
|  | ||||
|         private void Form1_Load(object sender, EventArgs e) | ||||
| @ -204,11 +224,7 @@ namespace WindowsFormsApp01 | ||||
|             } | ||||
|             catch (Exception) | ||||
|             { | ||||
|  | ||||
|  | ||||
|                 label4.Text = "Fehler"; | ||||
|  | ||||
|  | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @ -216,6 +232,11 @@ namespace WindowsFormsApp01 | ||||
|         { | ||||
|             label4.Text = e.Result.ToString(); | ||||
|         } | ||||
|  | ||||
|         private void Button5_Click(object sender, EventArgs e) | ||||
|         { | ||||
|             storeToFile(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public class CalcEventArgs | ||||
| @ -236,9 +257,6 @@ namespace WindowsFormsApp01 | ||||
|         public static event CalcEventHandler CalcFinished; | ||||
|  | ||||
|  | ||||
|         | ||||
|  | ||||
|  | ||||
|         public static void CalcIt() | ||||
|         { | ||||
|             int res = DateTime.Now.Second; | ||||
|  | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -201,6 +201,8 @@ public class SvcrPlay : StateVCR | ||||
|     { | ||||
|         Debug.Print("Play\n"); | ||||
|  | ||||
|  | ||||
|  | ||||
|         SMvcr.triggerUpdateLabel("Play"); | ||||
|  | ||||
|         SMvcr.evStopbutton += evStopbutton; | ||||
|  | ||||
							
								
								
									
										36
									
								
								winVCR/VCRlogicTests/Properties/AssemblyInfo.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								winVCR/VCRlogicTests/Properties/AssemblyInfo.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,36 @@ | ||||
| using System.Reflection; | ||||
| using System.Runtime.CompilerServices; | ||||
| using System.Runtime.InteropServices; | ||||
|  | ||||
| // General Information about an assembly is controlled through the following  | ||||
| // set of attributes. Change these attribute values to modify the information | ||||
| // associated with an assembly. | ||||
| [assembly: AssemblyTitle("VCRlogicTests")] | ||||
| [assembly: AssemblyDescription("")] | ||||
| [assembly: AssemblyConfiguration("")] | ||||
| [assembly: AssemblyCompany("Microsoft")] | ||||
| [assembly: AssemblyProduct("VCRlogicTests")] | ||||
| [assembly: AssemblyCopyright("Copyright © Microsoft 2019")] | ||||
| [assembly: AssemblyTrademark("")] | ||||
| [assembly: AssemblyCulture("")] | ||||
|  | ||||
| // Setting ComVisible to false makes the types in this assembly not visible  | ||||
| // to COM components.  If you need to access a type in this assembly from  | ||||
| // COM, set the ComVisible attribute to true on that type. | ||||
| [assembly: ComVisible(false)] | ||||
|  | ||||
| // The following GUID is for the ID of the typelib if this project is exposed to COM | ||||
| [assembly: Guid("368a9165-1e8f-4d98-b68f-84ce2a9baaed")] | ||||
|  | ||||
| // Version information for an assembly consists of the following four values: | ||||
| // | ||||
| //      Major Version | ||||
| //      Minor Version  | ||||
| //      Build Number | ||||
| //      Revision | ||||
| // | ||||
| // You can specify all the values or you can default the Build and Revision Numbers  | ||||
| // by using the '*' as shown below: | ||||
| // [assembly: AssemblyVersion("1.0.*")] | ||||
| [assembly: AssemblyVersion("1.0.0.0")] | ||||
| [assembly: AssemblyFileVersion("1.0.0.0")] | ||||
							
								
								
									
										19
									
								
								winVCR/VCRlogicTests/SvcrPlayTests.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								winVCR/VCRlogicTests/SvcrPlayTests.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | ||||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| namespace Tests | ||||
| { | ||||
|     [TestClass()] | ||||
|     public class SvcrPlayTests | ||||
|     { | ||||
|         [TestMethod()] | ||||
|         public void evStopbuttonTest() | ||||
|         { | ||||
|             Assert.IsTrue(true); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										106
									
								
								winVCR/VCRlogicTests/VCRlogicTests.csproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										106
									
								
								winVCR/VCRlogicTests/VCRlogicTests.csproj
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,106 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" /> | ||||
|   <PropertyGroup> | ||||
|     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||||
|     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||||
|     <ProjectGuid>{368A9165-1E8F-4D98-B68F-84CE2A9BAAED}</ProjectGuid> | ||||
|     <OutputType>Library</OutputType> | ||||
|     <AppDesignerFolder>Properties</AppDesignerFolder> | ||||
|     <RootNamespace>VCRlogicTests</RootNamespace> | ||||
|     <AssemblyName>VCRlogicTests</AssemblyName> | ||||
|     <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> | ||||
|     <FileAlignment>512</FileAlignment> | ||||
|     <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||||
|     <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> | ||||
|     <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> | ||||
|     <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath> | ||||
|     <IsCodedUITest>False</IsCodedUITest> | ||||
|     <TestProjectType>UnitTest</TestProjectType> | ||||
|     <TargetFrameworkProfile /> | ||||
|     <NuGetPackageImportStamp> | ||||
|     </NuGetPackageImportStamp> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||||
|     <DebugSymbols>true</DebugSymbols> | ||||
|     <DebugType>full</DebugType> | ||||
|     <Optimize>false</Optimize> | ||||
|     <OutputPath>bin\Debug\</OutputPath> | ||||
|     <DefineConstants>DEBUG;TRACE</DefineConstants> | ||||
|     <ErrorReport>prompt</ErrorReport> | ||||
|     <WarningLevel>4</WarningLevel> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||||
|     <DebugType>pdbonly</DebugType> | ||||
|     <Optimize>true</Optimize> | ||||
|     <OutputPath>bin\Release\</OutputPath> | ||||
|     <DefineConstants>TRACE</DefineConstants> | ||||
|     <ErrorReport>prompt</ErrorReport> | ||||
|     <WarningLevel>4</WarningLevel> | ||||
|   </PropertyGroup> | ||||
|   <ItemGroup> | ||||
|     <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||||
|       <HintPath>..\packages\MSTest.TestFramework.1.3.2\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.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath> | ||||
|     </Reference> | ||||
|     <Reference Include="System" /> | ||||
|   </ItemGroup> | ||||
|   <Choose> | ||||
|     <When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'"> | ||||
|       <ItemGroup> | ||||
|         <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> | ||||
|       </ItemGroup> | ||||
|     </When> | ||||
|     <Otherwise /> | ||||
|   </Choose> | ||||
|   <ItemGroup> | ||||
|     <Compile Include="Properties\AssemblyInfo.cs" /> | ||||
|     <Compile Include="SvcrPlayTests.cs" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <None Include="packages.config" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ProjectReference Include="..\VCRlogic\VCRlogic.csproj"> | ||||
|       <Project>{74F418C8-F030-41C7-BA8D-8A9B57253E45}</Project> | ||||
|       <Name>VCRlogic</Name> | ||||
|     </ProjectReference> | ||||
|   </ItemGroup> | ||||
|   <Choose> | ||||
|     <When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'"> | ||||
|       <ItemGroup> | ||||
|         <Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||||
|           <Private>False</Private> | ||||
|         </Reference> | ||||
|         <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||||
|           <Private>False</Private> | ||||
|         </Reference> | ||||
|         <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||||
|           <Private>False</Private> | ||||
|         </Reference> | ||||
|         <Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||||
|           <Private>False</Private> | ||||
|         </Reference> | ||||
|       </ItemGroup> | ||||
|     </When> | ||||
|   </Choose> | ||||
|   <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"> | ||||
|     <PropertyGroup> | ||||
|       <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||||
|     </PropertyGroup> | ||||
|     <Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props'))" /> | ||||
|     <Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets'))" /> | ||||
|   </Target> | ||||
|   <Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" /> | ||||
|   <!-- To modify your build process, add your task inside one of the targets below and uncomment it.  | ||||
|        Other similar extension points exist, see Microsoft.Common.targets. | ||||
|   <Target Name="BeforeBuild"> | ||||
|   </Target> | ||||
|   <Target Name="AfterBuild"> | ||||
|   </Target> | ||||
|   --> | ||||
| </Project> | ||||
							
								
								
									
										5
									
								
								winVCR/VCRlogicTests/packages.config
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								winVCR/VCRlogicTests/packages.config
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <packages> | ||||
|   <package id="MSTest.TestAdapter" version="1.3.2" targetFramework="net472" /> | ||||
|   <package id="MSTest.TestFramework" version="1.3.2" targetFramework="net472" /> | ||||
| </packages> | ||||
| @ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "winVCR", "winVCR\winVCR.csp | ||||
| EndProject | ||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VCRlogic", "VCRlogic\VCRlogic.csproj", "{74F418C8-F030-41C7-BA8D-8A9B57253E45}" | ||||
| EndProject | ||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VCRlogicTests", "VCRlogicTests\VCRlogicTests.csproj", "{368A9165-1E8F-4D98-B68F-84CE2A9BAAED}" | ||||
| EndProject | ||||
| Global | ||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
| 		Debug|Any CPU = Debug|Any CPU | ||||
| @ -21,6 +23,10 @@ Global | ||||
| 		{74F418C8-F030-41C7-BA8D-8A9B57253E45}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||
| 		{74F418C8-F030-41C7-BA8D-8A9B57253E45}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||
| 		{74F418C8-F030-41C7-BA8D-8A9B57253E45}.Release|Any CPU.Build.0 = Release|Any CPU | ||||
| 		{368A9165-1E8F-4D98-B68F-84CE2A9BAAED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||||
| 		{368A9165-1E8F-4D98-B68F-84CE2A9BAAED}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||
| 		{368A9165-1E8F-4D98-B68F-84CE2A9BAAED}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||
| 		{368A9165-1E8F-4D98-B68F-84CE2A9BAAED}.Release|Any CPU.Build.0 = Release|Any CPU | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(SolutionProperties) = preSolution | ||||
| 		HideSolutionNode = FALSE | ||||
|  | ||||
		Reference in New Issue
	
	Block a user