diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml new file mode 100644 index 0000000..22cc4eb --- /dev/null +++ b/.github/workflows/dotnetcore.yml @@ -0,0 +1,23 @@ +name: .NET Core + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 2.1.802 + - name: Build with dotnet + run: | + cd CourseApp + dotnet build --configuration Release + - name: Run tests + run: | + cd CourseApp.Tests + dotnet test 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.Tests/CourseApp.Tests.csproj b/CourseApp.Tests/CourseApp.Tests.csproj new file mode 100644 index 0000000..cb0486b --- /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 + + + + + + + \ No newline at end of file diff --git a/CourseApp.Tests/DemoTest.cs b/CourseApp.Tests/DemoTest.cs new file mode 100644 index 0000000..41cb21c --- /dev/null +++ b/CourseApp.Tests/DemoTest.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using Xunit; + +namespace CourseApp.Tests +{ + public class DemoTest + { + [Fact] + public void Test1() + { + Assert.True(true); + } + + [Fact] + public void TestMyFunctionZeros() + { + var res = Program.Сalculation(0.0, 0.0, 0.0).Count; + Assert.Equal(double.NaN, res); + } + + [Fact] + public void TestNullB() + { + List e = new List(); + var res = Program.Сalculation2(e).Count; + Assert.Equal(double.NaN, res); + } + + [Fact] + public void TestTrueA() + { + var res = Program.Сalculation(0.26, 0.66, 0.08); + List result = new List() { 0.834215045903759, 0.75429795697566, 0.688425423366074, 0.652365112574963, 0.663883187692699, 0.751251000538057 }; + Assert.Equal(result, res, 3); + } + + [Fact] + public void TestTrueB() + { + List input = new List() { 0.1, 0.35, 0.4, 0.55, 0.6 }; + var res = Program.Сalculation2(input); + List result = new List() { 0.970885488727385, 0.744968715506544, 0.702712806929317, 0.65257962383342, 0.677063603240845 }; + Assert.Equal(res, result, 3); + } + } +} \ No newline at end of file diff --git a/CourseApp/CourseApp.csproj b/CourseApp/CourseApp.csproj new file mode 100644 index 0000000..b244e47 --- /dev/null +++ b/CourseApp/CourseApp.csproj @@ -0,0 +1,23 @@ + + + + Exe + netcoreapp2.1 + True + 1573,1591,1701;1702;1705; + + + + + + + + ../_stylecop/stylecop.ruleset + true + + + + + + + diff --git a/CourseApp/CourseApp.sln b/CourseApp/CourseApp.sln new file mode 100644 index 0000000..9eae834 --- /dev/null +++ b/CourseApp/CourseApp.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2027 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CourseApp", "CourseApp.csproj", "{9B953FDD-1645-4B1A-B148-5849E7C2D3A7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CourseApp.Tests", "..\CourseApp.Tests\CourseApp.Tests.csproj", "{C348D2ED-C90F-4CE7-A1D8-9E57CBB33BDE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9B953FDD-1645-4B1A-B148-5849E7C2D3A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9B953FDD-1645-4B1A-B148-5849E7C2D3A7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B953FDD-1645-4B1A-B148-5849E7C2D3A7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9B953FDD-1645-4B1A-B148-5849E7C2D3A7}.Release|Any CPU.Build.0 = Release|Any CPU + {C348D2ED-C90F-4CE7-A1D8-9E57CBB33BDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C348D2ED-C90F-4CE7-A1D8-9E57CBB33BDE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C348D2ED-C90F-4CE7-A1D8-9E57CBB33BDE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C348D2ED-C90F-4CE7-A1D8-9E57CBB33BDE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {064E603C-674E-4DB9-A061-4B08C0ACD98C} + EndGlobalSection +EndGlobal diff --git a/CourseApp/Program.cs b/CourseApp/Program.cs new file mode 100644 index 0000000..90f9656 --- /dev/null +++ b/CourseApp/Program.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; + +namespace CourseApp +{ + public class Program + { + public static double Mathhh(double x) + { + double y; + y = Math.Pow(Math.Pow(Math.Asin(x), 2) + Math.Pow(Math.Cos(x), 4), 3); + return y; + } + + public static List Сalculation(double xH, double xK, double dx) + { + List output = new List(); + for (double x = xH; x <= xK; x = x + dx) + { + output.Add(Mathhh(x)); + } + + return output; + } + + public static List Сalculation2(List b) + { + List output = new List(); + foreach (double i in b) + { + output.Add(Mathhh(i)); + } + + return output; + } + + public static void Main() + { + Console.WriteLine("Task A:"); + Сalculation(0.26, 0.66, 0.08); + Console.WriteLine("Task B:"); + List b = new List() { 0.1, 0.35, 0.4, 0.55, 0.6 }; + Сalculation2(b); + } + } +} \ No newline at end of file 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..98806c8 --- /dev/null +++ b/_stylecop/stylecop.ruleset @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file 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