Browse Source

Добавьте файлы проекта.

AnbAnbA 2 years ago
parent
commit
e70c891f8d
8 changed files with 174 additions and 0 deletions
  1. 20 0
      TestProject1/TestProject1.csproj
  2. 21 0
      TestProject1/UnitTest1.cs
  3. 33 0
      exzem1.sln
  4. 24 0
      exzem1/DebugT.cs
  5. 13 0
      exzem1/Metod1.cs
  6. 31 0
      exzem1/Program.cs
  7. 24 0
      exzem1/Result.cs
  8. 8 0
      exzem1/exzem1.csproj

+ 20 - 0
TestProject1/TestProject1.csproj

@@ -0,0 +1,20 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>netcoreapp3.1</TargetFramework>
+
+    <IsPackable>false</IsPackable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
+    <PackageReference Include="MSTest.TestAdapter" Version="2.2.3" />
+    <PackageReference Include="MSTest.TestFramework" Version="2.2.3" />
+    <PackageReference Include="coverlet.collector" Version="3.0.2" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\exzem1\exzem1.csproj" />
+  </ItemGroup>
+
+</Project>

+ 21 - 0
TestProject1/UnitTest1.cs

@@ -0,0 +1,21 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using exzem1;
+
+namespace TestProject1
+{
+    [TestClass]
+    public class UnitTest1
+    {
+        [TestMethod]
+        public void TestMethod1()
+        {
+            int a = 123;
+            int b = 154;
+            int except = 277;
+            Program q = new Program();
+            int act = q.resh(a, b);
+            Assert.AreEqual(except, act);
+
+        }
+    }
+}

+ 33 - 0
exzem1.sln

@@ -0,0 +1,33 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31727.386
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "exzem1", "exzem1\exzem1.csproj", "{417851DE-0E33-4EFA-8F97-F53129FC606A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestProject1", "TestProject1\TestProject1.csproj", "{6D521155-9710-402E-B9E6-662E4061B030}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "diagrams", "diagrams", "{D78BD8BC-BDAE-4C74-9A9D-599F2F365A5D}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{417851DE-0E33-4EFA-8F97-F53129FC606A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{417851DE-0E33-4EFA-8F97-F53129FC606A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{417851DE-0E33-4EFA-8F97-F53129FC606A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{417851DE-0E33-4EFA-8F97-F53129FC606A}.Release|Any CPU.Build.0 = Release|Any CPU
+		{6D521155-9710-402E-B9E6-662E4061B030}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{6D521155-9710-402E-B9E6-662E4061B030}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{6D521155-9710-402E-B9E6-662E4061B030}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{6D521155-9710-402E-B9E6-662E4061B030}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {6D80F82C-67DB-40EF-8B5B-F258159493B9}
+	EndGlobalSection
+EndGlobal

+ 24 - 0
exzem1/DebugT.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Diagnostics;
+using System.IO;
+
+namespace exzem1
+{
+    class DebugT
+    {
+        /// <summary>
+        /// запись строки в файл diag
+        /// </summary>
+        /// <param name="str">Строка для записи в файл</param>
+        public static void diagW(string str) 
+        {
+            TextWriterTraceListener x = new TextWriterTraceListener(File.AppendText("diag.txt"));
+            Trace.Listeners.Add(x);
+            Debug.WriteLine(str);
+            Debug.Flush();
+            x.Close();
+        }
+    }
+}

+ 13 - 0
exzem1/Metod1.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Diagnostics;
+using System.IO;
+
+namespace exzem1
+{
+    class Metod1
+    {
+
+    }
+}

+ 31 - 0
exzem1/Program.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Diagnostics;
+using System.IO;
+
+namespace exzem1
+{
+   public class Program
+    {
+        public static void Main(string[] args)
+        {
+            int a = 123;
+            int b = 154;
+            Program c = new Program();
+            Console.WriteLine(c.resh(a, b));
+            otvet(c.resh(a, b));
+            DebugT.diagW(Convert.ToString(c.resh(a, b)));
+            //Debug.WriteLine($"{Convert.ToString(c.resh(a, b))}");
+        }
+        public static double otvet(int otvet)// метод для записи ответа в файл
+        {
+            string[] line = new string[] { Convert.ToString(otvet) };
+            File.WriteAllLines("Otvet.txt", line);
+            //Result.resW(Convert.ToString(otvet));
+            return otvet;
+        }
+        public int resh(int a, int b)
+        {
+            return a + b;
+        }
+    }
+}

+ 24 - 0
exzem1/Result.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Diagnostics;
+using System.IO;
+
+namespace exzem1
+{
+    class Result
+    {
+        /// <summary>
+        /// запись строки в файл result
+        /// </summary>
+        /// <param name="res">Строка для записи в файл</param>
+        public static void resW(string res)
+        {
+            TextWriterTraceListener x = new TextWriterTraceListener(File.AppendText("res.txt"));
+            Trace.Listeners.Add(x);
+            Debug.WriteLine(res);
+            Debug.Flush();
+            x.Close();
+        }
+    }
+}

+ 8 - 0
exzem1/exzem1.csproj

@@ -0,0 +1,8 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>netcoreapp3.1</TargetFramework>
+  </PropertyGroup>
+
+</Project>