diff --git a/CourseApp.Tests/CourseApp.Tests.csproj b/CourseApp.Tests/CourseApp.Tests.csproj
index d1218e9..a739509 100644
--- a/CourseApp.Tests/CourseApp.Tests.csproj
+++ b/CourseApp.Tests/CourseApp.Tests.csproj
@@ -1,19 +1,30 @@
- netcoreapp2.1
-
+ netcoreapp2.2
+ 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..09e415e
--- /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.Tests/PigTests.cs b/CourseApp.Tests/PigTests.cs
new file mode 100644
index 0000000..fab1363
--- /dev/null
+++ b/CourseApp.Tests/PigTests.cs
@@ -0,0 +1,56 @@
+using System;
+using Xunit;
+using ConsoleApp2;
+
+ namespace CourseApp.Tests
+ {
+ public class UnitTest2
+ {
+ [Fact]
+ public void CheckSecondKonstruktor1()
+ {
+ Pig pig1 = new Pig(15, 150);
+ Assert.Equal(6, pig1.Weight);
+ Assert.Equal("Noname", pig1.Name);
+ Assert.Equal(15, pig1.Age);
+ Assert.Equal(150, pig1.Weight);
+ }
+ [Fact]
+
+ public void CheckSecondKonstruktor2()
+ {
+ Pig Pig2 = new pig(21, 215);
+ Assert.Equal(9, Pig2.Name.weight);
+ Assert.Equal("Toto", Pig2.Name);
+ Assert.Equal(21, Pig2.age);
+ Assert.Equal(215, Pig2.weight);
+ }
+ [Fact]
+ public void CheckSecondKonstruktor3()
+ {
+ Pig Pig3 = new pig(20, 210);
+ Assert.Equal(4, Pig3.Name.weight);
+ Assert.Equal("Okta", Pig10.Name);
+ Assert.Equal(21, Pig10.age);
+ Assert.Equal(215, Pig10.weight);
+ }
+ [Fact]
+ public void CheckSecondKonstruktor4()
+ {
+ Pig Pig4 = new pig(25, 350);
+ Assert.Equal(5, Pig4.Name.weight);
+ Assert.Equal("Fufa", Pig4.Name);
+ Assert.Equal(25, Pig4.age);
+ Assert.Equal(350, Pig4.weight);
+ }
+ [Fact]
+ public void CheckSecondKonstruktor5()
+ {
+ Pig Pig5 = new pig(25, 350);
+ Assert.Equal(8, Pig5.Name.weight);
+ Assert.Equal("Tufa", Pig5.Name);
+ Assert.Equal(25, Pig5.age);
+ Assert.Equal(350, Pig5.weight);
+ }
+ }
+ }
\ No newline at end of file
diff --git a/CourseApp.Tests/UnitTest1.cs b/CourseApp.Tests/UnitTest1.cs
index dfe1161..fec4dc2 100644
--- a/CourseApp.Tests/UnitTest1.cs
+++ b/CourseApp.Tests/UnitTest1.cs
@@ -9,37 +9,37 @@ public class UnitTest1
[Fact]
public void Test1()
{
- var res = Program.y(0, 0, 1);
+ var res = Program.Y(0, 0, 1);
Assert.Equal(Double.NaN, res);
}
[Fact]
public void Test2()
{
- var res = Program.y(2, 0, 1);
+ var res = Program.Y(2, 0, 1);
Assert.Equal(2.39014261372843, res);
}
[Fact]
public void Test3()
{
- var res = Program.y(0, 0, 0);
+ var res = Program.Y(0, 0, 0);
Assert.Equal(Double.PositiveInfinity, res);
}
[Fact]
public void Test4()
{
- var res = Program.y(1, 0, 0);
+ var res = Program.Y(1, 0, 0);
Assert.Equal(2, res);
}
[Fact]
public void Test5()
{
- var res = Program.y(1, 2, 1);
+ var res = Program.Y(1, 2, 1);
Assert.Equal(Double.NaN, res);
}
[Fact]
public void Test6()
{
- var res = Program.y(0, 1, 1);
+ var res = Program.Y(0, 1, 1);
Assert.Equal(Double.NaN, res);
}
}
diff --git a/CourseApp/CourseApp.csproj b/CourseApp/CourseApp.csproj
index 23df604..cc0df39 100644
--- a/CourseApp/CourseApp.csproj
+++ b/CourseApp/CourseApp.csproj
@@ -3,6 +3,21 @@
Exe
netcoreapp2.1
+ True
+ 1573,1591,1701;1702;1705
+
+
+
+
+
+ ../stylecop/stylecop.ruleset
+ true
+
+
+
+
+
+
diff --git a/CourseApp/Pig.cs b/CourseApp/Pig.cs
new file mode 100644
index 0000000..1fe65d5
--- /dev/null
+++ b/CourseApp/Pig.cs
@@ -0,0 +1,60 @@
+using System;
+
+namespace ConsoleApp2
+{
+ public class Pig
+ {
+ private string name;
+ private int age;
+ private int weight;
+
+ public Pig(string name, int age, int weight)
+ {
+ this.name = name;
+ this.age = age;
+ this.weight = weight;
+ }
+
+ public Pig(int age, int weight)
+ {
+ this.name = "Noname";
+ this.age = age;
+ this.weight = weight;
+ }
+
+ public string Name
+ {
+ get => name;
+ set => name = value;
+ }
+
+ public int Age
+ {
+ get => age;
+ set
+ {
+ if (value > 10)
+ {
+ age = value;
+ }
+ }
+ }
+
+ public int Weight
+ {
+ get => weight;
+ set
+ {
+ if (value > 70)
+ {
+ weight = value;
+ }
+ }
+ }
+
+ public string GetInfo()
+ {
+ return $"Имя: {Name} возраст: {age} вес: {weight}";
+ }
+ }
+}
\ No newline at end of file
diff --git a/CourseApp/Program.cs b/CourseApp/Program.cs
index 0885066..56fa577 100644
--- a/CourseApp/Program.cs
+++ b/CourseApp/Program.cs
@@ -4,31 +4,33 @@ namespace CourseApp
{
public class Program
{
- public static double y(double x, double a, double b)
- {
- return ((Math.Pow((Math.Pow((x - a), 2)), 1/3.0))) + ((((Math.Pow((Math.Abs(x + b)),1 / 5))) / ((Math.Pow(Math.Pow(x,2) - Math.Pow((a+b),2), 1/5.0)))));
+ public static double Y(double x, double a, double b)
+ {
+ return (Math.Pow(Math.Pow(x - a, 2), 1 / 3.0) + Math.Pow(Math.Abs(x + b), 1 / 5)) / Math.Pow(Math.Pow(x, 2) - Math.Pow(a + b, 2), 1 / 5.0);
}
- static void Main(string[] args)
+
+ public static void Main(string[] args)
{
double a = 0.8;
double b = 0.4;
double xn = 1.23;
double xk = 7.23;
double dx = 1.2;
-
- double[] x = new double[5] {1.88, 2.26, 3.84, 4.55, -6.21 };
-
+
+ double[] x = new double[5] { 1.88, 2.26, 3.84, 4.55, -6.21 };
+
Console.WriteLine("Задача A:");
- for (double xl = xn; xl < xk; xl+=dx)
+ for (double xl = xn; xl < xk; xl += dx)
{
- Console.WriteLine($"Для x = {xl}\t y = {y(xl, a, b)}");
+ Console.WriteLine($"Для x = {xl}\t y = {Y(xl, a, b)}");
}
- Console.WriteLine("Задача B:");
- foreach (double i in x)
+ Console.WriteLine("Задача B:");
+
+ foreach (double i in x)
{
- Console.WriteLine($"Для x = {i}\t y = {y(i, a, b)}");
+ Console.WriteLine($"Для x = {i}\t y = {Y(i, a, b)}");
}
}
}
diff --git a/README.md b/README.md
index ee1aa8c..4284b70 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1 @@
-# Course of c#
-
-Please write your name and surname here
\ No newline at end of file
+Dmitrij_Shmelev
\ No newline at end of file
diff --git a/stylecop/stylecop.json b/stylecop/stylecop.json
new file mode 100644
index 0000000..643b8c1
--- /dev/null
+++ b/stylecop/stylecop.json
@@ -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"]
+}
diff --git a/stylecop/stylecop.ruleset b/stylecop/stylecop.ruleset
new file mode 100644
index 0000000..3350d0e
--- /dev/null
+++ b/stylecop/stylecop.ruleset
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file