Explorar o código

Тестирование

Саша Лебедева %!s(int64=2) %!d(string=hai) anos
pai
achega
37d5386625

+ 6 - 6
Examen31P_LebedevaAF.sln

@@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio Version 17
 VisualStudioVersion = 17.2.32526.322
 MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Examen31P_LebedevaAF", "Examen31P_LebedevaAF\Examen31P_LebedevaAF.csproj", "{A97F3C4B-CCA7-46D1-A1D8-84709CC25FFA}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Examen31P_LebedevaAF", "Examen31P_LebedevaAF\Examen31P_LebedevaAF.csproj", "{A97F3C4B-CCA7-46D1-A1D8-84709CC25FFA}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestProject1", "UnitTestProject1\UnitTestProject1.csproj", "{9F912C33-201C-4307-9808-C2158C64B9B6}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestProject2", "TestProject2\TestProject2.csproj", "{797DE2B1-0656-4A4C-9F1C-CC19857BABD8}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -17,10 +17,10 @@ Global
 		{A97F3C4B-CCA7-46D1-A1D8-84709CC25FFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{A97F3C4B-CCA7-46D1-A1D8-84709CC25FFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{A97F3C4B-CCA7-46D1-A1D8-84709CC25FFA}.Release|Any CPU.Build.0 = Release|Any CPU
-		{9F912C33-201C-4307-9808-C2158C64B9B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{9F912C33-201C-4307-9808-C2158C64B9B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{9F912C33-201C-4307-9808-C2158C64B9B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{9F912C33-201C-4307-9808-C2158C64B9B6}.Release|Any CPU.Build.0 = Release|Any CPU
+		{797DE2B1-0656-4A4C-9F1C-CC19857BABD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{797DE2B1-0656-4A4C-9F1C-CC19857BABD8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{797DE2B1-0656-4A4C-9F1C-CC19857BABD8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{797DE2B1-0656-4A4C-9F1C-CC19857BABD8}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 3 - 0
Examen31P_LebedevaAF/Brak.cs

@@ -19,6 +19,9 @@ namespace Examen31P_LebedevaAF
             dlprover = 4000 / 100 * 1; // один процент допустимой погрешности длины 
             return dlprover;
         }
+
+
+
         public int PN10()
         {
             int PN = 0;

+ 18 - 0
TestProject1/TestProject1.csproj

@@ -0,0 +1,18 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net6.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+
+    <IsPackable>false</IsPackable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
+    <PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
+    <PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
+    <PackageReference Include="coverlet.collector" Version="3.1.2" />
+  </ItemGroup>
+
+</Project>

+ 11 - 0
TestProject1/UnitTest1.cs

@@ -0,0 +1,11 @@
+namespace TestProject1
+{
+    [TestClass]
+    public class UnitTest1
+    {
+        [TestMethod]
+        public void TestMethod1()
+        {
+        }
+    }
+}

+ 1 - 0
TestProject1/Usings.cs

@@ -0,0 +1 @@
+global using Microsoft.VisualStudio.TestTools.UnitTesting;

+ 22 - 0
TestProject2/TestProject2.csproj

@@ -0,0 +1,22 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net6.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+
+    <IsPackable>false</IsPackable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
+    <PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
+    <PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
+    <PackageReference Include="coverlet.collector" Version="3.1.2" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\Examen31P_LebedevaAF\Examen31P_LebedevaAF.csproj" />
+  </ItemGroup>
+
+</Project>

+ 26 - 0
TestProject2/UnitTest1.cs

@@ -0,0 +1,26 @@
+using Examen31P_LebedevaAF;
+
+namespace TestProject2
+{
+    [TestClass]
+    public class UnitTest1
+    {
+        [TestMethod]
+        public void TestMethod1() 
+        {
+            int expept = 4000;
+            Brak b = new Brak();
+            int actual = b.Dlina();
+            Assert.AreEqual(expept, actual);
+        }
+
+        [TestMethod]
+        public void TestMethod2()
+        {
+            int expept = 40;
+            Brak b = new Brak();
+            int actual = b.Dlina();
+            Assert.AreEqual(expept, actual);
+        }
+    }
+}

+ 1 - 0
TestProject2/Usings.cs

@@ -0,0 +1 @@
+global using Microsoft.VisualStudio.TestTools.UnitTesting;

+ 18 - 0
TestProject3/TestProject3.csproj

@@ -0,0 +1,18 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net6.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+
+    <IsPackable>false</IsPackable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
+    <PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
+    <PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
+    <PackageReference Include="coverlet.collector" Version="3.1.2" />
+  </ItemGroup>
+
+</Project>

+ 17 - 0
TestProject3/UnitTest1.cs

@@ -0,0 +1,17 @@
+using Examen31P_LebedevaAF;
+
+namespace TestProject3
+{
+    [TestClass]
+    public class UnitTest1
+    {
+        [TestMethod]
+        public void TestMethod1()
+        {
+            int expept = 4000;
+            Brak b = new Brak();
+            int actual = b.Dlina();
+            Assert.AreEqual(expept, actual);
+        }
+    }
+}

+ 1 - 0
TestProject3/Usings.cs

@@ -0,0 +1 @@
+global using Microsoft.VisualStudio.TestTools.UnitTesting;

+ 5 - 3
UnitTestProject1/UnitTest1.cs

@@ -9,9 +9,11 @@ namespace UnitTestProject1
         [TestMethod]
         public void TestMethod1()
         {
-            int x = 4000;
-            int y = 4500;
-            
+            int expept = 4000;
+            Brak b = new Brak();
+            int actual = b.Dlina();
+            Assert.AreEqual(expept, actual);
+
         }
     }
 }