-
Notifications
You must be signed in to change notification settings - Fork 23
Julija elesina #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: Julija_Elesina
Are you sure you want to change the base?
Julija elesina #56
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <PropertyGroup> | ||
| <TargetFramework>netcoreapp2.0</TargetFramework> | ||
| <TreatWarningsAsErrors>True</TreatWarningsAsErrors> | ||
| <NoWarn>1573,1591,1701;1702;1705</NoWarn> | ||
| <IsPackable>false</IsPackable> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" /> | ||
| <PackageReference Include="xunit" Version="2.4.0" /> | ||
| <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" /> | ||
| <PackageReference Include="StyleCop.Analyzers" Version="1.0.2" PrivateAssets="all" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\CourseApp\CourseApp.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| <PropertyGroup> | ||
| <CodeAnalysisRuleSet>../stylecop/stylecop.ruleset</CodeAnalysisRuleSet> | ||
| <GenerateFullPaths>true</GenerateFullPaths> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <AdditionalFiles Include="../stylecop/stylecop.json" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| using System; | ||
| using Xunit; | ||
| using Matan; | ||
|
|
||
| namespace CourseApp.Test | ||
| { | ||
| public class UnitTest1 | ||
| { | ||
| [Fact] | ||
| public void Test1() | ||
| { | ||
| var res = Program.Y(0, 0, 0); | ||
| Assert.Equal(0, res); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Test2() | ||
| { | ||
| var res = Program.Y(1, 0, 0); | ||
| Assert.Equal(double.NaN, res); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Test3() | ||
| { | ||
| var res = Program.Y(1, 1, 0); | ||
| Assert.Equal(double.PositiveInfinity, res); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Test4() | ||
| { | ||
| var res = Program.Y(5, 1, -8); | ||
| Assert.Equal(10.96, res, 2); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Test5() | ||
| { | ||
| var res = Program.Y(2, 3, 0); | ||
| Assert.Equal(10.49, res, 2); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Test6() | ||
| { | ||
| var res = Program.Y(0, 4, -9); | ||
| Assert.Equal(0, res); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Test7() | ||
| { | ||
| var res = Program.Y(8, 2, 4); | ||
| Assert.Equal(6.38, res, 2); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Test9() | ||
| { | ||
| var res = Program.Y(0, 3, 2); | ||
| Assert.Equal(0, res); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Test10() | ||
| { | ||
| var res = Program.Y(0, 3, 3); | ||
| Assert.Equal(0, res); | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| using System; | ||
| using Xunit; | ||
| using Menu; | ||
|
|
||
| namespace CourseApp.Tests | ||
| { | ||
| public class UnitTest2 | ||
| { | ||
| [Fact] | ||
| public void Test1() | ||
| { | ||
| Dish salad = new Dish("Cesar", 500, "Salad", 250); | ||
| Assert.Equal("Cesar", salad.Name); | ||
| Assert.Equal(500, salad.Price); | ||
| Assert.Equal("Salad", salad.Type); | ||
| Assert.Equal(250, salad.Weight); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Test2() | ||
| { | ||
| Dish soup = new Dish("chees", 250); | ||
| Assert.Equal("chees", soup.Name); | ||
| Assert.Equal(250, soup.Price); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Test3() | ||
| { | ||
| Dish soup = new Dish("chees", -3); | ||
| Assert.Equal("chees", soup.Name); | ||
| Assert.Equal(0, soup.Price); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Test4() | ||
| { | ||
| Dish soup = new Dish("Cesar", 20); | ||
| Assert.Equal("Cesar", soup.Name); | ||
| Assert.Equal(20, soup.Price); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Test5() | ||
| { | ||
| Dish salad = new Dish("Paprica", 500, "Salad", -3); | ||
| Assert.Equal("Paprica", salad.Name); | ||
| Assert.Equal(500, salad.Price); | ||
| Assert.Equal("Salad", salad.Type); | ||
| Assert.Equal(0, salad.Weight); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Test6() | ||
| { | ||
| Dish salad = new Dish("Cesar", -100, "rrrrrrrrr", 1000); | ||
| Assert.Equal("Cesar", salad.Name); | ||
| Assert.Equal(0, salad.Price); | ||
| Assert.Equal("NoType", salad.Type); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. А почему будет noType? |
||
| Assert.Equal(1000, salad.Weight); | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| | ||
| Microsoft Visual Studio Solution File, Format Version 12.00 | ||
| # Visual Studio 15 | ||
| VisualStudioVersion = 15.0.27428.2002 | ||
| MinimumVisualStudioVersion = 10.0.40219.1 | ||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CourseApp", "CourseApp.csproj", "{270747D2-1BE6-4FB6-AB36-C427275A74F3}" | ||
| EndProject | ||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CourseApp.Tests", "..\CourseApp.Tests\CourseApp.Tests.csproj", "{A8BE50E0-7D41-4C54-8B0E-1AA0AEE23645}" | ||
| EndProject | ||
| Global | ||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
| Debug|Any CPU = Debug|Any CPU | ||
| Release|Any CPU = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
| {270747D2-1BE6-4FB6-AB36-C427275A74F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {270747D2-1BE6-4FB6-AB36-C427275A74F3}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {270747D2-1BE6-4FB6-AB36-C427275A74F3}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {270747D2-1BE6-4FB6-AB36-C427275A74F3}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {A8BE50E0-7D41-4C54-8B0E-1AA0AEE23645}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {A8BE50E0-7D41-4C54-8B0E-1AA0AEE23645}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {A8BE50E0-7D41-4C54-8B0E-1AA0AEE23645}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {A8BE50E0-7D41-4C54-8B0E-1AA0AEE23645}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(SolutionProperties) = preSolution | ||
| HideSolutionNode = FALSE | ||
| EndGlobalSection | ||
| GlobalSection(ExtensibilityGlobals) = postSolution | ||
| SolutionGuid = {E01AD994-55CD-4736-AD2F-24B07F270089} | ||
| EndGlobalSection | ||
| EndGlobal |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| using System; | ||
|
|
||
| namespace Menu | ||
| { | ||
| public class Dish | ||
| { | ||
| private int price; | ||
| private string type; | ||
| private int weight; | ||
|
|
||
| public Dish(string name, int price, string type, int weight) | ||
| { | ||
| Name = name == string.Empty ? $"NoName" : name; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Боюсь что вся лаба плагиат с лабы 147 группы, код, который совместно написан я вижу, но ок, есть что здесь улучшить |
||
| this.Price = price; | ||
| this.Type = type; | ||
| this.Weight = weight; | ||
| } | ||
|
|
||
| public Dish(string name, int price) | ||
| : this(name, price, string.Empty, 0) | ||
| { | ||
| } | ||
|
|
||
| public string Name { get; set; } | ||
|
|
||
| public int Price | ||
| { | ||
| get => price; | ||
| set | ||
| { | ||
| price = value > 0 ? value : 0; | ||
| } | ||
| } | ||
|
|
||
| public string Type | ||
| { | ||
| get => type; | ||
| set | ||
| { | ||
| type = value == $"Salad" ? value : $"NoType"; | ||
| } | ||
| } | ||
|
|
||
| public int Weight | ||
| { | ||
| get => weight; | ||
| set | ||
| { | ||
| weight = value > 0 ? value : 0; | ||
| } | ||
| } | ||
|
|
||
| public void GetInfo() => Console.WriteLine($"��������: {Name} ����: {price} ���: {type} ���: {weight}"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Поправьте кодировку |
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,45 @@ | ||
| using System; | ||
| using Menu; | ||
|
|
||
| namespace CourseApp | ||
| namespace Matan | ||
| { | ||
| class Program | ||
| public class Program | ||
| { | ||
| static void Main(string[] args) | ||
| public static double Y(double x, double a, double b) | ||
| { | ||
| Console.WriteLine("Hello World!"); | ||
| return Math.Sqrt(Math.Abs(a - (b * x)) / Math.Pow(Math.Log10(x), 3)); | ||
| } | ||
|
|
||
| public static void Main(string[] args) | ||
| { | ||
| double a = 7.2; | ||
| double b = 4.2; | ||
| double xn = 1.81; | ||
| double xk = 5.31; | ||
| double dx = 0.7; | ||
|
|
||
| double[] x = new double[5] { 2.4, 2.8, 3.9, 4.7, 3.16 }; | ||
|
|
||
| Console.WriteLine("Задача A:"); | ||
|
|
||
| for (double xl = xn; xl < xk; xl += dx) | ||
| { | ||
| Console.WriteLine($"Для x = {xl}\t y = {Y(xl, a, b):f3}"); | ||
| } | ||
|
|
||
| Console.WriteLine("Задача B:"); | ||
|
|
||
| foreach (double i in x) | ||
| { | ||
| Console.WriteLine($"Для x = {i}\t y = {Y(i, a, b):f3}"); | ||
| } | ||
|
|
||
| Dish salad = new Dish("Cesar", 500, "Salad", 250); | ||
| Dish soup = new Dish("chees", 250); | ||
| salad.GetInfo(); | ||
| soup.GetInfo(); | ||
|
|
||
| Console.ReadKey(); | ||
| } | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1 @@ | ||
| # Course of c# | ||
|
|
||
| Please write your name and surname here | ||
| ���� ������� |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "$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 | ||
| } | ||
| }, | ||
| "additionalArguments": ["./stylecop.ruleset", "./stylecop.json"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <RuleSet Name="StyleCopeRules" Description="StyleCopeRules custom ruleset" ToolsVersion="14.0"> | ||
| <IncludeAll Action="None" /> | ||
| <Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers"> | ||
| <Rule Id="SA1101" Action="None" /> | ||
| <Rule Id="SA0001" Action="None" /> | ||
| <Rule Id="SA1210" Action="None" /> | ||
| <Rule Id="SA1633" Action="None" /> | ||
| <Rule Id="SA1600" Action="None" /> | ||
| <Rule Id="AD0001" Action="None" /> | ||
| <Rule Id="CA2234" Action="None" /> | ||
| <Rule Id="SA1200" Action="None" /> | ||
| <Rule Id="SA1000" Action="None" /> | ||
| <Rule Id="SA1012" Action="None" /> | ||
| <Rule Id="SA1012" Action="None" /> | ||
| <Rule Id="SA1009" Action="None" /> | ||
| <Rule Id="SA1012" Action="None" /> | ||
| <Rule Id="SA1652" Action="None" /> | ||
| <Rule Id="CA1305" Action="None" /> | ||
| <Rule Id="CA1056" Action="None" /> | ||
| </Rules> | ||
| </RuleSet> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Измените имя файла - чтобы показать какие классы вы тут тестируете?