From bb9584802fd36f29adcfdc3bbeee81637df934a9 Mon Sep 17 00:00:00 2001 From: jskonst Date: Mon, 16 Sep 2019 09:29:33 +0300 Subject: [PATCH 1/6] Sample .net app --- .gitignore | 206 +++++++++++++++++++++++++++++++++++++ CourseApp/CourseApp.csproj | 8 ++ CourseApp/Program.cs | 14 +++ 3 files changed, 228 insertions(+) create mode 100644 .gitignore create mode 100644 CourseApp/CourseApp.csproj create mode 100644 CourseApp/Program.cs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..35d4ccd --- /dev/null +++ b/.gitignore @@ -0,0 +1,206 @@ +# Download this file using PowerShell v3 under Windows with the following comand: +# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore +# or wget: +# wget --no-check-certificate http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# OS generated files # +.DS_Store* +Icon? + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +*.Cache +ClientBin/ +# [Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings +modulesbin/ +tempbin/ + +# EPiServer Site file (VPP) +AppData/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# vim +*.txt~ +*.swp +*.swo + +# svn +.svn + +# Remainings from resolvings conflicts in Source Control +*.orig + +# SQL Server files +**/App_Data/*.mdf +**/App_Data/*.ldf +**/App_Data/*.sdf + + +#LightSwitch generated files +GeneratedArtifacts/ +_Pvt_Extensions/ +ModelManifest.xml + +# ========================= +# Windows detritus +# ========================= + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac desktop service store files +.DS_Store + +# SASS Compiler cache +.sass-cache + +# Visual Studio 2014 CTP +**/*.sln.ide + +# Visual Studio temp something +.vs/ + +# VS 2015+ +*.vc.vc.opendb +*.vc.db + +# Rider +.idea/ + +**/node_modules/* + +# Added by Jskonst +.vscode/ +Properties/ + +##### +# End of core ignore list, below put you custom 'per project' settings (patterns or path) +##### \ No newline at end of file diff --git a/CourseApp/CourseApp.csproj b/CourseApp/CourseApp.csproj new file mode 100644 index 0000000..01d5113 --- /dev/null +++ b/CourseApp/CourseApp.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.2 + + + diff --git a/CourseApp/Program.cs b/CourseApp/Program.cs new file mode 100644 index 0000000..b747802 --- /dev/null +++ b/CourseApp/Program.cs @@ -0,0 +1,14 @@ +using System; + +namespace CourseApp +{ + class Program + { + static void Main(string[] args) + { + var a = 5; + Console.WriteLine(a); + Console.WriteLine("Hello World!"); + } + } +} From cf10946561ade24a258e47b818b3f02ed3bcf706 Mon Sep 17 00:00:00 2001 From: jskonst Date: Mon, 30 Sep 2019 08:53:25 +0300 Subject: [PATCH 2/6] Initial app with tests --- CourseApp.Tests/CourseApp.Tests.csproj | 30 +++++++++++++++++++++++++ CourseApp.Tests/DemoTest.cs | 14 ++++++++++++ CourseApp/CourseApp.csproj | 31 +++++++++++++++++++------- CourseApp/Program.cs | 27 +++++++++++----------- _stylecop/stylecop.json | 12 ++++++++++ _stylecop/stylecop.ruleset | 12 ++++++++++ 6 files changed, 104 insertions(+), 22 deletions(-) create mode 100644 CourseApp.Tests/CourseApp.Tests.csproj create mode 100644 CourseApp.Tests/DemoTest.cs create mode 100644 _stylecop/stylecop.json create mode 100644 _stylecop/stylecop.ruleset diff --git a/CourseApp.Tests/CourseApp.Tests.csproj b/CourseApp.Tests/CourseApp.Tests.csproj new file mode 100644 index 0000000..9e401c8 --- /dev/null +++ b/CourseApp.Tests/CourseApp.Tests.csproj @@ -0,0 +1,30 @@ + + + + netcoreapp2.1 + True + 1573,1591,1701;1702;1705 + false + + + + + + + + + + + + + + + ../stylecop/stylecop.ruleset + true + + + + + + + diff --git a/CourseApp.Tests/DemoTest.cs b/CourseApp.Tests/DemoTest.cs new file mode 100644 index 0000000..109618e --- /dev/null +++ b/CourseApp.Tests/DemoTest.cs @@ -0,0 +1,14 @@ +using System; +using Xunit; + +namespace CourseApp.Tests +{ + public class DemoTest + { + [Fact] + public void Test1() + { + Assert.True(true); + } + } +} diff --git a/CourseApp/CourseApp.csproj b/CourseApp/CourseApp.csproj index 01d5113..cc0df39 100644 --- a/CourseApp/CourseApp.csproj +++ b/CourseApp/CourseApp.csproj @@ -1,8 +1,23 @@ - - - - Exe - netcoreapp2.2 - - - + + + + Exe + netcoreapp2.1 + True + 1573,1591,1701;1702;1705 + + + + + + + + ../stylecop/stylecop.ruleset + true + + + + + + + diff --git a/CourseApp/Program.cs b/CourseApp/Program.cs index b747802..248bbe4 100644 --- a/CourseApp/Program.cs +++ b/CourseApp/Program.cs @@ -1,14 +1,13 @@ -using System; - -namespace CourseApp -{ - class Program - { - static void Main(string[] args) - { - var a = 5; - Console.WriteLine(a); - Console.WriteLine("Hello World!"); - } - } -} +using System; + +namespace CourseApp +{ + public class Program + { + public static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + Console.ReadLine(); + } + } +} diff --git a/_stylecop/stylecop.json b/_stylecop/stylecop.json new file mode 100644 index 0000000..4a96e8f --- /dev/null +++ b/_stylecop/stylecop.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", + "settings": { + "documentationRules": { + "documentExposedElements": false, + "documentInterfaces": false, + "companyName": "Test Company", + "copyrightText": "This source code is Copyright © {companyName} and MAY NOT be copied, reproduced,\npublished, distributed or transmitted to or stored in any manner without prior\nwritten consent from {companyName} (www.yourcompany.com).", + "xmlHeader":false + } + } +} \ No newline at end of file diff --git a/_stylecop/stylecop.ruleset b/_stylecop/stylecop.ruleset new file mode 100644 index 0000000..3302a70 --- /dev/null +++ b/_stylecop/stylecop.ruleset @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file From 591e070287b069060a3d690c466cef678750a33d Mon Sep 17 00:00:00 2001 From: jskonst Date: Mon, 30 Sep 2019 08:54:37 +0300 Subject: [PATCH 3/6] Added workspace for vsCode --- courseworkspace.code-workspace | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 courseworkspace.code-workspace diff --git a/courseworkspace.code-workspace b/courseworkspace.code-workspace new file mode 100644 index 0000000..4f9af01 --- /dev/null +++ b/courseworkspace.code-workspace @@ -0,0 +1,11 @@ +{ + "folders": [ + { + "path": "CourseApp" + }, + { + "path": "CourseApp.Tests" + } + ], + "settings": {} +} \ No newline at end of file From 435b5bceb42998f5a1161c17f50fd2cd9086cdce Mon Sep 17 00:00:00 2001 From: jskonst Date: Mon, 30 Sep 2019 09:13:45 +0300 Subject: [PATCH 4/6] FIxed stylecop file --- CourseApp.Tests/CourseApp.Tests.csproj | 4 ++-- CourseApp/CourseApp.csproj | 6 +++--- _stylecop/stylecop.ruleset | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CourseApp.Tests/CourseApp.Tests.csproj b/CourseApp.Tests/CourseApp.Tests.csproj index 9e401c8..668406b 100644 --- a/CourseApp.Tests/CourseApp.Tests.csproj +++ b/CourseApp.Tests/CourseApp.Tests.csproj @@ -19,12 +19,12 @@ - ../stylecop/stylecop.ruleset + ../_stylecop/stylecop.ruleset true - + diff --git a/CourseApp/CourseApp.csproj b/CourseApp/CourseApp.csproj index cc0df39..b244e47 100644 --- a/CourseApp/CourseApp.csproj +++ b/CourseApp/CourseApp.csproj @@ -4,7 +4,7 @@ Exe netcoreapp2.1 True - 1573,1591,1701;1702;1705 + 1573,1591,1701;1702;1705; @@ -12,12 +12,12 @@ - ../stylecop/stylecop.ruleset + ../_stylecop/stylecop.ruleset true - + diff --git a/_stylecop/stylecop.ruleset b/_stylecop/stylecop.ruleset index 3302a70..98806c8 100644 --- a/_stylecop/stylecop.ruleset +++ b/_stylecop/stylecop.ruleset @@ -5,8 +5,10 @@ + + \ No newline at end of file From 84dcf263ce3acad9877dce58a4ec24db78c725a7 Mon Sep 17 00:00:00 2001 From: Eugeny Konstantinov Date: Sat, 12 Oct 2019 14:49:02 +0300 Subject: [PATCH 5/6] First lab sample --- CourseApp.Tests/DemoTest.cs | 14 ++++++++++++++ CourseApp/Program.cs | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/CourseApp.Tests/DemoTest.cs b/CourseApp.Tests/DemoTest.cs index 109618e..df2f278 100644 --- a/CourseApp.Tests/DemoTest.cs +++ b/CourseApp.Tests/DemoTest.cs @@ -10,5 +10,19 @@ public void Test1() { Assert.True(true); } + + [Fact] + public void TestSummPositive() + { + var res = Program.Summ(2, 3); + Assert.Equal(5, res); + } + + [Fact] + public void TestSummPositiveNegative() + { + var actualRes = Program.Summ(-2, 2); + Assert.Equal(0, actualRes); + } } } diff --git a/CourseApp/Program.cs b/CourseApp/Program.cs index 248bbe4..7450310 100644 --- a/CourseApp/Program.cs +++ b/CourseApp/Program.cs @@ -4,9 +4,42 @@ namespace CourseApp { public class Program { + public static double MyFunction(double a, double b, double x) + { + var y = (a * Math.Pow(x, 2)) + (b * x); + return y; + } + + public static double[] TaskA(double a, double b, double xn, double xk, double dx) + { + return new double[0]; + } + + public static double[] TaskB(double a, double b, double[] x) + { + var y = new double[x.Length]; + for (var i = 0; i < x.Length; i++) + { + y[i] = MyFunction(a, b, x[i]); + } + + return y; + } + public static void Main(string[] args) { Console.WriteLine("Hello World!"); + const double a = 2.2; + const double b = 3.8; + var resSingle = MyFunction(a, b, 4); + Console.WriteLine(resSingle); + var x = new double[] { 1, 2, 3, 4, 5 }; + var taskBRes = TaskB(a, b, x); + foreach (var item in taskBRes) + { + Console.WriteLine($"y = {item}"); + } + Console.ReadLine(); } } From 9eebb5005e261400ce98c137fc3f865604d287b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80?= <Александр@DESKTOP-6G1MCJ8> Date: Sun, 20 Oct 2019 19:32:48 +0300 Subject: [PATCH 6/6] =?UTF-8?q?=D0=97=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8=D0=B5?= =?UTF-8?q?=20A=20=D0=B8=20B=20=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D0=BD=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CourseApp/Program.cs | 48 +++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/CourseApp/Program.cs b/CourseApp/Program.cs index 7450310..13eb69f 100644 --- a/CourseApp/Program.cs +++ b/CourseApp/Program.cs @@ -1,26 +1,40 @@ using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; namespace CourseApp { public class Program { - public static double MyFunction(double a, double b, double x) + public static double FuncthionZnach(double x) { - var y = (a * Math.Pow(x, 2)) + (b * x); - return y; + double a = 1.2; + double b = 0.28; + double result = (Math.Pow(b, 3) + Math.Pow(Math.Sin(a * x), 2)) / (Math.Asin(x * b * x) + Math.Exp(-x / 2)); + return result; } - public static double[] TaskA(double a, double b, double xn, double xk, double dx) + public static double[] FuncthionForShag(double x_natch, double x_konch, double x_shag) { - return new double[0]; + var result = new double[(int)((x_konch - x_natch) / x_shag) + 1]; + int kolch = 0; + for (double i = x_natch; i <= x_konch; i += x_shag) + { + result[kolch] = FuncthionZnach(i); + kolch++; + } + + return result; } - public static double[] TaskB(double a, double b, double[] x) + public static double[] FuncthionForMass(double[] x) { var y = new double[x.Length]; for (var i = 0; i < x.Length; i++) { - y[i] = MyFunction(a, b, x[i]); + y[i] = FuncthionZnach(x[i]); } return y; @@ -28,18 +42,20 @@ public static double[] TaskB(double a, double b, double[] x) public static void Main(string[] args) { - Console.WriteLine("Hello World!"); - const double a = 2.2; - const double b = 3.8; - var resSingle = MyFunction(a, b, 4); - Console.WriteLine(resSingle); - var x = new double[] { 1, 2, 3, 4, 5 }; - var taskBRes = TaskB(a, b, x); - foreach (var item in taskBRes) + Console.WriteLine($"Задание A:"); + foreach (double element in FuncthionForShag(0.7, 2.2, 0.3)) + { + Console.WriteLine(element); + } + + Console.WriteLine($"\nЗадание B:"); + var x = new double[] { 0.25, 0.36, 0.56, 0.94, 1.28 }; + foreach (var element in FuncthionForMass(x)) { - Console.WriteLine($"y = {item}"); + Console.WriteLine($"y = {element}"); } + Console.WriteLine(); Console.ReadLine(); } }