Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions CourseApp.Tests/Class1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using Xunit;
using ConsoleApp2;
namespace CourseApp.Tests
{
public class UnitTest2
{
[Fact]
public void CheckSecondKonstruktor1()
{
Car car2 = new Car("tesla", 230);
Assert.Equal("tesla", car2.Name);
Assert.Equal(230, car2.Speed);

}
[Fact]
public void CheckSecondKonstruktor2()
{
Car car2 = new Car("zhigul", 155);
Assert.Equal("zhigul", car2.Name);
Assert.Equal(155, car2.Speed);

}
}
}
30 changes: 30 additions & 0 deletions CourseApp.Tests/CourseApp.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<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>
25 changes: 25 additions & 0 deletions CourseApp.Tests/CourseApp.Tests.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

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.Tests", "CourseApp.Tests.csproj", "{7E619433-E12F-45F9-BC3B-B9C0162C5D5F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7E619433-E12F-45F9-BC3B-B9C0162C5D5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E619433-E12F-45F9-BC3B-B9C0162C5D5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E619433-E12F-45F9-BC3B-B9C0162C5D5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E619433-E12F-45F9-BC3B-B9C0162C5D5F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5689BE8B-26B5-4E2F-BDCD-8285FB088509}
EndGlobalSection
EndGlobal
14 changes: 14 additions & 0 deletions CourseApp.Tests/DemoTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using Xunit;

namespace CourseApp.Tests
{
public class DemoTest
{
[Fact]
public void Test1()
{
Assert.True(true);
}
}
}
41 changes: 41 additions & 0 deletions CourseApp.Tests/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using Xunit;
using Matan;


namespace CourseApp.Tests
{
public class UnitTest1
{
[Fact]
public void Test1()
{
var res = Program.y(1);
Assert.Equal(5.0625 , res);
}
[Fact]
public void Test2()
{
var res = Program.y(-1);
Assert.Equal(5.06215, res, 3);
}
[Fact]
public void Test3()
{
var res = Program.y(1.25);
Assert.Equal(0.78, res,3);
}
[Fact]
public void Test4()
{
var res = Program.y(2.89);
Assert.Equal(1173.645, res, 3);
}
[Fact]
public void Test5()
{
var res = Program.y(-3.55);
Assert.Equal(10417.68, res, 3);
}
}
}
55 changes: 55 additions & 0 deletions CourseApp/Class11.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System;

namespace ConsoleApp2
{
using System;

public class Class11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Что за класс? Дайте адекватное имя

{
private string name;
private int speed;

public Class11(string name, int speed)
{
this.name = name;
this.speed = speed;
}

public Class11(int speed)
{
name = "Noname";
this.speed = speed;
}

public string Name
{
get
{
return name;
}

set => name = value;
}

public int Speed
{
get
{
return speed;
}

set
{
if (value > 0)
{
speed = value;
}
}
}

public string GetInfo()
{
return $"Имя: {name} скорость: {speed} ";
}
}
}
18 changes: 17 additions & 1 deletion CourseApp/CourseApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,23 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<NoWarn>1573,1591,1701;1702;1705</NoWarn>

</PropertyGroup>

<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2" PrivateAssets="all" />
</ItemGroup>

<PropertyGroup>
<CodeAnalysisRuleSet>../stylecop/stylecop.ruleset</CodeAnalysisRuleSet>
<GenerateFullPaths>true</GenerateFullPaths>
</PropertyGroup>

<ItemGroup>
<AdditionalFiles Include="../stylecop/stylecop.json" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions CourseApp/CourseApp.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

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", "{3C2630FF-B548-4F7A-AD39-F42BFAE79DE2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3C2630FF-B548-4F7A-AD39-F42BFAE79DE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3C2630FF-B548-4F7A-AD39-F42BFAE79DE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3C2630FF-B548-4F7A-AD39-F42BFAE79DE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3C2630FF-B548-4F7A-AD39-F42BFAE79DE2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7CF6A1A5-9351-446B-A4AA-EFF0A9D65034}
EndGlobalSection
EndGlobal
30 changes: 26 additions & 4 deletions CourseApp/Program.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
using System;

namespace CourseApp
namespace Matan
{
class Program
public class Program
{
static void Main(string[] args)
public static double Y(double x)
{
Console.WriteLine("Hello World!");
return Math.Pow(x: Math.Abs((x * x) - 2.5), y: 4.0) + Math.Pow(Math.Log10(x * x), 3.0);
}

private static void Main(string[] args)
{
double xn = 1.25;
double xk = 3.25;
double dx = 0.4;

double[] x = new double[5] { 1.84, 2.71, 3.81, 4.56, 5.62 };

Console.WriteLine("Задача A:");
for (double xl = xn; xl < xk; xl += dx)
{
Console.WriteLine($"Для x = {xl}\t y = {Y(xl)}");
}

Console.WriteLine("Задача B:");

foreach (double i in x)
{
Console.WriteLine($"Для x = {i}\t y = {Y(i)}");
}
}
}
}
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# Course of c#

Please write your name and surname here
Jurij_Kochnev
15 changes: 15 additions & 0 deletions stylecop/stylecop.json
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"]
}
22 changes: 22 additions & 0 deletions stylecop/stylecop.ruleset
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>