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..24cb440
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,205 @@
+# 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
+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/Chess.Tests/Chess.Tests.csproj b/Chess.Tests/Chess.Tests.csproj
new file mode 100644
index 0000000..24bc394
--- /dev/null
+++ b/Chess.Tests/Chess.Tests.csproj
@@ -0,0 +1,20 @@
+
+
+
+ netcoreapp2.0
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Chess.Tests/Chess.Tests.sln b/Chess.Tests/Chess.Tests.sln
new file mode 100644
index 0000000..41cd248
--- /dev/null
+++ b/Chess.Tests/Chess.Tests.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29806.167
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Chess.Tests", "Chess.Tests.csproj", "{106F6B78-DEC0-4C82-A74A-6FAC71B4B12F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {106F6B78-DEC0-4C82-A74A-6FAC71B4B12F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {106F6B78-DEC0-4C82-A74A-6FAC71B4B12F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {106F6B78-DEC0-4C82-A74A-6FAC71B4B12F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {106F6B78-DEC0-4C82-A74A-6FAC71B4B12F}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {2E4BC9A1-D3C8-4BB2-9BB2-114127E69E94}
+ EndGlobalSection
+EndGlobal
diff --git a/Chess.Tests/ChessTests.cs b/Chess.Tests/ChessTests.cs
new file mode 100644
index 0000000..776a431
--- /dev/null
+++ b/Chess.Tests/ChessTests.cs
@@ -0,0 +1,52 @@
+using System;
+using Xunit;
+using Chess;
+
+namespace Chess.Tests
+{
+ public class ChessTests
+ {
+ [Fact]
+ public void PawnEatsRookTest()
+ {
+ Figure figure = new Pawn("Белый");
+ Figure figure1 = new Rook("Черный");
+ Assert.Equal("Фигура Пешка (Белый) съедает Ладья (Черный)", figure.Eat(figure1));
+ }
+
+ [Fact]
+ public void KnightEatsRookTest()
+ {
+ Figure figure = new Knight("Черный");
+ Figure figure1 = new Rook("Белый");
+ Assert.Equal("Фигура Конь (Черный) съедает Ладья (Белый)", figure.Eat(figure1));
+ }
+
+ [Fact]
+ public void RookEatsPawnTest()
+ {
+ Figure figure = new Rook("Черный");
+ Figure figure1 = new Pawn("Белый");
+ Assert.Equal("Фигура Ладья (Черный) съедает Пешка (Белый)", figure.Eat(figure1));
+ }
+
+ [Fact]
+ public void SameColorTest()
+ {
+ Figure figure = new Rook("Черный");
+ Figure figure1 = new Pawn("Черный");
+ Assert.Equal("Нельзя съесть фигуру того же цвета", figure.Eat(figure1));
+ }
+
+ [Fact]
+ public void WalksTest()
+ {
+ Figure figure = new Pawn("Черный");
+ Figure figure1 = new Rook("Черный");
+ Figure figure2 = new Knight("Черный");
+ Assert.Equal("Пешка ходит по прямой на одну клетку, при старте может сходиться на две клетки", figure.Walk());
+ Assert.Equal("Ладья ходит прямо по вертикали и горизонтали в обе стороны", figure1.Walk());
+ Assert.Equal("Конь ходит буквой Г, передвигаясь на две клетки и затем сворачивая на одно поле налево или направо", figure2.Walk());
+ }
+ }
+}
diff --git a/Chess.sln b/Chess.sln
new file mode 100644
index 0000000..2817c05
--- /dev/null
+++ b/Chess.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29806.167
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chess", "Chess\Chess.csproj", "{B202D3CD-E29E-4A5F-892E-649096EEA557}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B202D3CD-E29E-4A5F-892E-649096EEA557}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B202D3CD-E29E-4A5F-892E-649096EEA557}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B202D3CD-E29E-4A5F-892E-649096EEA557}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B202D3CD-E29E-4A5F-892E-649096EEA557}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {CCFF4F0E-268A-4534-9F60-62624473B9D9}
+ EndGlobalSection
+EndGlobal
diff --git a/Chess/Chess.csproj b/Chess/Chess.csproj
new file mode 100644
index 0000000..ce1697a
--- /dev/null
+++ b/Chess/Chess.csproj
@@ -0,0 +1,8 @@
+
+
+
+ Exe
+ netcoreapp2.0
+
+
+
diff --git a/Chess/Figure.cs b/Chess/Figure.cs
new file mode 100644
index 0000000..5c911b5
--- /dev/null
+++ b/Chess/Figure.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Chess
+{
+ public abstract class Figure : IMove
+ {
+ public Figure(string color)
+ {
+ Color = color;
+ }
+
+ private string color;
+ private string name;
+ public virtual string Color {
+ get
+ {
+ return color;
+ }
+ set
+ {
+ if(value == "Белый" || value == "Черный")
+ {
+ color = value;
+ }
+ else
+ {
+ return;
+ }
+ }
+ }
+ public virtual string Name {
+ get
+ {
+ return name;
+ }
+ set
+ {
+ name = value;
+ }
+ }
+
+ public virtual string Walk()
+ {
+ return "Способ хода не назначен";
+ }
+
+ public string Eat(Figure figure)
+ {
+ if(figure.Color == this.Color)
+ {
+ return "Нельзя съесть фигуру того же цвета";
+ }
+ else
+ {
+ return $"Фигура {this.Name} ({this.Color}) съедает {figure.Name} ({figure.Color})";
+ }
+ }
+ }
+}
diff --git a/Chess/IMove.cs b/Chess/IMove.cs
new file mode 100644
index 0000000..294bbd9
--- /dev/null
+++ b/Chess/IMove.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Chess
+{
+ public interface IMove
+ {
+ string Walk();
+ }
+}
diff --git a/Chess/Knight.cs b/Chess/Knight.cs
new file mode 100644
index 0000000..9dfab79
--- /dev/null
+++ b/Chess/Knight.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Chess
+{
+ public class Knight : Figure
+ {
+ public Knight(string color)
+ :base(color)
+ {
+ Name = "Конь";
+ }
+ public override string Walk()
+ {
+ return $"{this.Name} ходит буквой Г, передвигаясь на две клетки и затем сворачивая на одно поле налево или направо";
+ }
+ }
+}
diff --git a/Chess/Pawn.cs b/Chess/Pawn.cs
new file mode 100644
index 0000000..37b3769
--- /dev/null
+++ b/Chess/Pawn.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Chess
+{
+ public class Pawn : Figure
+ {
+ public Pawn(string color)
+ :base(color)
+ {
+ Name = "Пешка";
+ }
+ public override string Walk()
+ {
+ return $"{this.Name} ходит по прямой на одну клетку, при старте может сходиться на две клетки";
+ }
+ }
+}
diff --git a/Chess/Program.cs b/Chess/Program.cs
new file mode 100644
index 0000000..f6c3421
--- /dev/null
+++ b/Chess/Program.cs
@@ -0,0 +1,19 @@
+using System;
+
+namespace Chess
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ Figure figure = new Pawn("Белый");
+ Figure figure1 = new Knight("Черный");
+ Figure figure2 = new Rook("Белый");
+ Console.WriteLine(figure.Eat(figure1));
+ Console.WriteLine(figure1.Eat(figure2));
+ Console.WriteLine(figure.Walk());
+ Console.WriteLine(figure1.Walk());
+ Console.WriteLine(figure2.Walk());
+ }
+ }
+}
diff --git a/Chess/Rook.cs b/Chess/Rook.cs
new file mode 100644
index 0000000..4bf7ac0
--- /dev/null
+++ b/Chess/Rook.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Chess
+{
+ public class Rook : Figure
+ {
+ public Rook(string color)
+ :base(color)
+ {
+ Name = "Ладья";
+ }
+ public override string Walk()
+ {
+ return $"{this.Name} ходит прямо по вертикали и горизонтали в обе стороны";
+ }
+ }
+}
diff --git a/README.md b/README.md
index f097ac3..cfdc379 100644
--- a/README.md
+++ b/README.md
@@ -1 +1 @@
-# exam_147_2020
\ No newline at end of file
+# exam_147_2020 Savchenko Vlad
\ 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..2875d7c
--- /dev/null
+++ b/courseworkspace.code-workspace
@@ -0,0 +1,11 @@
+{
+ "folders": [
+ {
+ "path": "Chess"
+ },
+ {
+ "path": "Chess.Tests"
+ }
+ ],
+ "settings": {}
+}
\ No newline at end of file