From 774bc81e6c695772f3159771539d9f20e9f91241 Mon Sep 17 00:00:00 2001 From: MinyazevR Date: Thu, 14 Apr 2022 00:23:12 +0300 Subject: [PATCH 1/6] Writing 2 classes for writing a game. --- Game/Game/Game.sln | 31 ++++++++++++ Game/Game/Game/EventLoop.cs | 46 ++++++++++++++++++ Game/Game/Game/Game.cs | 78 ++++++++++++++++++++++++++++++ Game/Game/Game/Game.csproj | 10 ++++ Game/Game/Game/Game.txt | 11 +++++ Game/Game/Game/Program.cs | 17 +++++++ Game/Game/GameTest/GameTest.cs | 26 ++++++++++ Game/Game/GameTest/GameTest.csproj | 21 ++++++++ 8 files changed, 240 insertions(+) create mode 100644 Game/Game/Game.sln create mode 100644 Game/Game/Game/EventLoop.cs create mode 100644 Game/Game/Game/Game.cs create mode 100644 Game/Game/Game/Game.csproj create mode 100644 Game/Game/Game/Game.txt create mode 100644 Game/Game/Game/Program.cs create mode 100644 Game/Game/GameTest/GameTest.cs create mode 100644 Game/Game/GameTest/GameTest.csproj diff --git a/Game/Game/Game.sln b/Game/Game/Game.sln new file mode 100644 index 0000000..1b1480d --- /dev/null +++ b/Game/Game/Game.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32228.430 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Game", "Game\Game.csproj", "{5C94A5A6-4A89-4028-87EB-872F3053657A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GameTest", "GameTest\GameTest.csproj", "{194D762F-14D0-4A7D-993D-FB324AAC0E1D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5C94A5A6-4A89-4028-87EB-872F3053657A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5C94A5A6-4A89-4028-87EB-872F3053657A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5C94A5A6-4A89-4028-87EB-872F3053657A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5C94A5A6-4A89-4028-87EB-872F3053657A}.Release|Any CPU.Build.0 = Release|Any CPU + {194D762F-14D0-4A7D-993D-FB324AAC0E1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {194D762F-14D0-4A7D-993D-FB324AAC0E1D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {194D762F-14D0-4A7D-993D-FB324AAC0E1D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {194D762F-14D0-4A7D-993D-FB324AAC0E1D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C9167AF3-096A-436F-9070-46CD6A12D020} + EndGlobalSection +EndGlobal diff --git a/Game/Game/Game/EventLoop.cs b/Game/Game/Game/EventLoop.cs new file mode 100644 index 0000000..1eef0a4 --- /dev/null +++ b/Game/Game/Game/EventLoop.cs @@ -0,0 +1,46 @@ +namespace Game; +using System; + +public class EventLoop +{ + public event EventHandler LeftHandler = (sender, args) => { }; + public event EventHandler RightHandler = (sender, args) => { }; + public event EventHandler UpHandler = (sender, args) => { }; + public event EventHandler DownHandler = (sender, args) => { }; + + public void Run() + { + while (Console.GetCursorPosition() != (68, 4)) + { + var key = Console.ReadKey(true); + switch (key.Key) + { + case ConsoleKey.LeftArrow: + { + LeftHandler(this, EventArgs.Empty); + break; + } + case ConsoleKey.RightArrow: + { + RightHandler(this, EventArgs.Empty); + break; + } + case ConsoleKey.UpArrow: + { + UpHandler(this, EventArgs.Empty); + break; + } + case ConsoleKey.DownArrow: + { + DownHandler(this, EventArgs.Empty); + break; + } + case ConsoleKey.Escape: + { + return; + } + } + } + } +} + diff --git a/Game/Game/Game/Game.cs b/Game/Game/Game/Game.cs new file mode 100644 index 0000000..819d5b6 --- /dev/null +++ b/Game/Game/Game/Game.cs @@ -0,0 +1,78 @@ +namespace Game; + +public class Game +{ + private readonly Action action; + private int currentPositionOnX { get; set; } + private int currentPositionOnY { get; set; } + private string[] map { get; set; } + + public Game(int initialPositionOnX, int initialPositionOnY, string pathToFile, Action action) + { + currentPositionOnX = initialPositionOnX; + currentPositionOnY = initialPositionOnY; + map = File.ReadAllLines(pathToFile); + this.action = action; + PrintMap(this.map); + action(currentPositionOnX, currentPositionOnY); + DrawCharacter(); + } + + + private void DrawCharacter() + { + Console.WriteLine("@"); + } + + private void PrintMap(string[] map) + { + for (int i = 0; i < map.Length; i++) + { + for (int j = 0; j < map[i].Length; j++) + { + Console.Write(map[i][j]); + } + Console.WriteLine(); + } + } + + private static bool IsWall(char x) => x == '|' || x == '+' || x == '-' || x == '_'; + + public void Move(Func func) + { + var (newPositionOnX, newPositionOnY) = func(currentPositionOnX, currentPositionOnY); + action(newPositionOnX, newPositionOnY); + if (IsWall(map[newPositionOnY][newPositionOnX])) + { + action(currentPositionOnX, currentPositionOnY); + return; + } + Console.Write("@"); + action(currentPositionOnX, currentPositionOnY); + Console.WriteLine(" "); + action(newPositionOnX, newPositionOnY); + (currentPositionOnX, currentPositionOnY) = (newPositionOnX, newPositionOnY); + } + + public void OnLeft(object? sender, EventArgs args) + { + Move((x, y) => (x - 1, y)); + } + + public void OnRight(object? sender, EventArgs args) + { + Move((x, y) => (x + 1, y)); + } + + public void Up(object? sender, EventArgs args) + { + Move((x, y) => (x, y - 1)); + } + + public void Down(object? sender, EventArgs args) + { + Move((x, y) => (x, y + 1)); + } + + public (int, int) PlayerPosition() => (currentPositionOnX, currentPositionOnY); +} \ No newline at end of file diff --git a/Game/Game/Game/Game.csproj b/Game/Game/Game/Game.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/Game/Game/Game/Game.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/Game/Game/Game/Game.txt b/Game/Game/Game/Game.txt new file mode 100644 index 0000000..4dc5e68 --- /dev/null +++ b/Game/Game/Game/Game.txt @@ -0,0 +1,11 @@ ++------------------------------------------------------------------+ +| | | +| +-------------------+ +--------------------+ +---+ +----+ +| | | | | | | |____| ++---+ +--+ | | +| | | | | | +--------+ +| +-------------------+----+-----------+ +---------+ | +| | | | ++----------- +-------------------------------------+ +--------| +| | ++------------------------------------------------------------------+ diff --git a/Game/Game/Game/Program.cs b/Game/Game/Game/Program.cs new file mode 100644 index 0000000..935c96d --- /dev/null +++ b/Game/Game/Game/Program.cs @@ -0,0 +1,17 @@ +namespace Game; + +public class Program +{ + static void Main(string[] args) + { + var eventLoop = new EventLoop(); + + var game = new Game(2, 9, "..//..//..//Game.txt", Console.SetCursorPosition); + eventLoop.LeftHandler += game.OnLeft; + eventLoop.RightHandler += game.OnRight; + eventLoop.UpHandler += game.Up; + eventLoop.DownHandler += game.Down; + eventLoop.Run(); + } +} + diff --git a/Game/Game/GameTest/GameTest.cs b/Game/Game/GameTest/GameTest.cs new file mode 100644 index 0000000..a563d21 --- /dev/null +++ b/Game/Game/GameTest/GameTest.cs @@ -0,0 +1,26 @@ +namespace GameTest; + +using NUnit.Framework; +using System.IO; +using System; + +public class Tests +{ + private Game.Game game = new(0 ,0, "..//..//..//..//Game//Game.txt", (x, y) => { } ); + + [SetUp] + public void Setup() + { + game = new Game.Game(2, 9, "..//..//..//..//Game//Game.txt", (x, y) => { }); + } + + [Test] + public void Test1() + { + var (x, y) = game.PlayerPosition(); + game.OnLeft(this, EventArgs.Empty); + var (z, t) = game.PlayerPosition(); + Assert.AreEqual(z, x - 1); + } + +} diff --git a/Game/Game/GameTest/GameTest.csproj b/Game/Game/GameTest/GameTest.csproj new file mode 100644 index 0000000..73d4fc3 --- /dev/null +++ b/Game/Game/GameTest/GameTest.csproj @@ -0,0 +1,21 @@ + + + + net6.0 + enable + + false + + + + + + + + + + + + + + From 78313b819271d35161c359d6fec4294150921806 Mon Sep 17 00:00:00 2001 From: Roman Date: Wed, 25 May 2022 01:43:38 +0300 Subject: [PATCH 2/6] add tests --- Game/Game/Game/EventLoop.cs | 1 + Game/Game/Game/Game.cs | 11 ++-- Game/Game/GameTest/GameTest.cs | 102 ++++++++++++++++++++++++++++++++- 3 files changed, 108 insertions(+), 6 deletions(-) diff --git a/Game/Game/Game/EventLoop.cs b/Game/Game/Game/EventLoop.cs index 1eef0a4..0287db6 100644 --- a/Game/Game/Game/EventLoop.cs +++ b/Game/Game/Game/EventLoop.cs @@ -10,6 +10,7 @@ public class EventLoop public void Run() { + // Magic 68 and 4 are the coordinates of the point you need to reach in order to win while (Console.GetCursorPosition() != (68, 4)) { var key = Console.ReadKey(true); diff --git a/Game/Game/Game/Game.cs b/Game/Game/Game/Game.cs index 819d5b6..a91df60 100644 --- a/Game/Game/Game/Game.cs +++ b/Game/Game/Game/Game.cs @@ -3,9 +3,9 @@ public class Game { private readonly Action action; - private int currentPositionOnX { get; set; } - private int currentPositionOnY { get; set; } - private string[] map { get; set; } + private int currentPositionOnX; + private int currentPositionOnY; + private readonly string[] map; public Game(int initialPositionOnX, int initialPositionOnY, string pathToFile, Action action) { @@ -19,12 +19,12 @@ public Game(int initialPositionOnX, int initialPositionOnY, string pathToFile, A } - private void DrawCharacter() + private static void DrawCharacter() { Console.WriteLine("@"); } - private void PrintMap(string[] map) + private static void PrintMap(string[] map) { for (int i = 0; i < map.Length; i++) { @@ -47,6 +47,7 @@ public void Move(Func func) action(currentPositionOnX, currentPositionOnY); return; } + Console.Write("@"); action(currentPositionOnX, currentPositionOnY); Console.WriteLine(" "); diff --git a/Game/Game/GameTest/GameTest.cs b/Game/Game/GameTest/GameTest.cs index a563d21..28c7d2e 100644 --- a/Game/Game/GameTest/GameTest.cs +++ b/Game/Game/GameTest/GameTest.cs @@ -14,13 +14,113 @@ public void Setup() game = new Game.Game(2, 9, "..//..//..//..//Game//Game.txt", (x, y) => { }); } + // It is known in advance that there is no wall on the left in the position [Test] - public void Test1() + public void ShouldPlayerPositionOnXEqualPreviousPositionOnXMinus1WhenOnLeft() { var (x, y) = game.PlayerPosition(); game.OnLeft(this, EventArgs.Empty); var (z, t) = game.PlayerPosition(); Assert.AreEqual(z, x - 1); + Assert.AreEqual(t, y); } + // It is known in advance that there is no wall on the right in the position + [Test] + public void ShouldPlayerPositionOnXEqualPreviousPositionOnXPlus1WhenOnRight() + { + var (x, y) = game.PlayerPosition(); + game.OnRight(this, EventArgs.Empty); + var (z, t) = game.PlayerPosition(); + Assert.AreEqual(z, x + 1); + Assert.AreEqual(t, y); + } + + // It is known in advance that there is no wall on the up in the position + [Test] + public void ShouldPlayerPositionOnYEqualPreviousPositionOnYMinus1WhenUp() + { + for (int i = 0; i < 11; i++) + { + game.OnRight(this, EventArgs.Empty); + } + + var (x, y) = game.PlayerPosition(); + game.Up(this, EventArgs.Empty); + var (z, t) = game.PlayerPosition(); + Assert.AreEqual(z, x); + Assert.AreEqual(t, y - 1); + } + + // It is known in advance that there is no wall on the down in the position + [Test] + public void ShouldPlayerPositionOnYEqualPreviousPositionOnYPlus1WhenDown() + { + for (int i = 0; i < 11; i++) + { + game.OnRight(this, EventArgs.Empty); + } + + game.Up(this, EventArgs.Empty); + var (x, y) = game.PlayerPosition(); + game.Down(this, EventArgs.Empty); + var (z, t) = game.PlayerPosition(); + Assert.AreEqual(z, x); + Assert.AreEqual(t, y + 1); + } + + + // It is known in advance that in the current position there will be a wall on the left + [Test] + public void ShouldPlayerPositionOnXEqualPreviousPositionOnXWhenOnLeft() + { + game.OnLeft(this, EventArgs.Empty); + var (x, y) = game.PlayerPosition(); + game.OnLeft(this, EventArgs.Empty); + var (z, t) = game.PlayerPosition(); + Assert.AreEqual(z, x); + Assert.AreEqual(t, y); + } + + // It is known in advance that in the current position there will be a wall on the right + [Test] + public void ShouldPlayerPositionOnXEqualPreviousPositionOnXWhenOnRight() + { + for (int i = 0; i < 65; i ++) + { + game.OnRight(this, EventArgs.Empty); + } + + var (x, y) = game.PlayerPosition(); + game.OnRight(this, EventArgs.Empty); + var (z, t) = game.PlayerPosition(); + Assert.AreEqual(z, x); + Assert.AreEqual(t, y); + } + + // It is known in advance that in the current position there will be a wall on the up + [Test] + public void ShouldPlayerPositionOnXEqualPreviousPositionOnXWhenUp() + { + var (x, y) = game.PlayerPosition(); + game.Up(this, EventArgs.Empty); + var (z, t) = game.PlayerPosition(); + Assert.AreEqual(z, x); + Assert.AreEqual(t, y); + } + + // It is known in advance that in the current position there will be a wall on the down + [Test] + public void ShouldPlayerPositionOnXEqualPreviousPositionOnXWhenDown() + { + var (x, y) = game.PlayerPosition(); + game.Down(this, EventArgs.Empty); + var (z, t) = game.PlayerPosition(); + Assert.AreEqual(z, x); + Assert.AreEqual(t, y); + } + + + + } From 69bace82217bc6d30023d8e265a5d8dd3459dce4 Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 2 Jun 2022 00:29:45 +0300 Subject: [PATCH 3/6] rename yml --- .github/workflows/{dotnet.yml => Game.yml} | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) rename .github/workflows/{dotnet.yml => Game.yml} (56%) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/Game.yml similarity index 56% rename from .github/workflows/dotnet.yml rename to .github/workflows/Game.yml index a6a59da..340cd7a 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/Game.yml @@ -1,9 +1,9 @@ name: Build -on: [push, pull_request] +on: [push] jobs: - build: + build-Windows: runs-on: windows-latest @@ -20,4 +20,21 @@ jobs: - name: Test run: $slnList = Get-ChildItem $foo.FullName -Recurse -Filter '*.sln'; foreach ($file in $slnList) {dotnet test $file.FullName} + build-Ubuntu: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Build + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '6.x' + - name: Restore + run: for f in $(find . -name "*.sln"); do dotnet restore $f; done + - name: Build + run: for f in $(find . -name "*.sln"); do dotnet build $f; done + - name: Test + run: for f in $(find . -name "*.sln"); do dotnet test $f; done + From 3b5708fa6e9e8a68f786ee8ef7ab23822559ab58 Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 2 Jun 2022 01:20:09 +0300 Subject: [PATCH 4/6] rename yml --- .github/workflows/{Game.yml => dotnet.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{Game.yml => dotnet.yml} (100%) diff --git a/.github/workflows/Game.yml b/.github/workflows/dotnet.yml similarity index 100% rename from .github/workflows/Game.yml rename to .github/workflows/dotnet.yml From fa9a1876838608322e7d1117f68899f940e32ae9 Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 2 Jun 2022 04:05:56 +0300 Subject: [PATCH 5/6] formatted --- Game/Game/Game/EventLoop.cs | 28 +++++++++++++-- Game/Game/Game/Game.cs | 72 ++++++++++++++++++++++--------------- Game/Game/Game/Program.cs | 24 +++++-------- 3 files changed, 77 insertions(+), 47 deletions(-) diff --git a/Game/Game/Game/EventLoop.cs b/Game/Game/Game/EventLoop.cs index 0287db6..77e06e0 100644 --- a/Game/Game/Game/EventLoop.cs +++ b/Game/Game/Game/EventLoop.cs @@ -1,17 +1,39 @@ namespace Game; + using System; +/// +/// A class representing an event handler loop +/// public class EventLoop { + /// + /// Handler for the left move event + /// public event EventHandler LeftHandler = (sender, args) => { }; + + /// + /// Handler for the right move event + /// public event EventHandler RightHandler = (sender, args) => { }; + + /// + /// Handler for the up move event + /// public event EventHandler UpHandler = (sender, args) => { }; + + /// + /// Handler for the down move event + /// public event EventHandler DownHandler = (sender, args) => { }; - public void Run() + /// + /// Event handler loop + /// + /// Delegate loop exit condition + public void Run(Func EndOfСycleСondition) { - // Magic 68 and 4 are the coordinates of the point you need to reach in order to win - while (Console.GetCursorPosition() != (68, 4)) + while (!EndOfСycleСondition()) { var key = Console.ReadKey(true); switch (key.Key) diff --git a/Game/Game/Game/Game.cs b/Game/Game/Game/Game.cs index a91df60..abb3109 100644 --- a/Game/Game/Game/Game.cs +++ b/Game/Game/Game/Game.cs @@ -1,28 +1,34 @@ namespace Game; +/// +/// The class responsible for the logic of the game +/// public class Game { - private readonly Action action; + private readonly Action controlFunction; private int currentPositionOnX; private int currentPositionOnY; private readonly string[] map; + /// + /// Сonstructor of Game class + /// + /// Initial position on x + /// Initial position on y + /// Path to file + /// Control function public Game(int initialPositionOnX, int initialPositionOnY, string pathToFile, Action action) { currentPositionOnX = initialPositionOnX; currentPositionOnY = initialPositionOnY; map = File.ReadAllLines(pathToFile); - this.action = action; + this.controlFunction = action; PrintMap(this.map); action(currentPositionOnX, currentPositionOnY); DrawCharacter(); } - - private static void DrawCharacter() - { - Console.WriteLine("@"); - } + private static void DrawCharacter() => Console.WriteLine("@"); private static void PrintMap(string[] map) { @@ -38,42 +44,52 @@ private static void PrintMap(string[] map) private static bool IsWall(char x) => x == '|' || x == '+' || x == '-' || x == '_'; - public void Move(Func func) + private void ChangePlayerPosition(Func func) { var (newPositionOnX, newPositionOnY) = func(currentPositionOnX, currentPositionOnY); - action(newPositionOnX, newPositionOnY); + controlFunction(newPositionOnX, newPositionOnY); if (IsWall(map[newPositionOnY][newPositionOnX])) { - action(currentPositionOnX, currentPositionOnY); + controlFunction(currentPositionOnX, currentPositionOnY); return; } Console.Write("@"); - action(currentPositionOnX, currentPositionOnY); + controlFunction(currentPositionOnX, currentPositionOnY); Console.WriteLine(" "); - action(newPositionOnX, newPositionOnY); + controlFunction(newPositionOnX, newPositionOnY); (currentPositionOnX, currentPositionOnY) = (newPositionOnX, newPositionOnY); } - public void OnLeft(object? sender, EventArgs args) - { - Move((x, y) => (x - 1, y)); - } + /// + /// Function for changing the player's position one step to the left + /// + public void OnLeft(object? sender, EventArgs args) => ChangePlayerPosition((x, y) => (x - 1, y)); - public void OnRight(object? sender, EventArgs args) - { - Move((x, y) => (x + 1, y)); - } + /// + /// Function for changing the player's position one step to the right + /// + public void OnRight(object? sender, EventArgs args) => ChangePlayerPosition((x, y) => (x + 1, y)); - public void Up(object? sender, EventArgs args) - { - Move((x, y) => (x, y - 1)); - } + /// + /// Function for changing the player's position one step up + /// + public void Up(object? sender, EventArgs args) => ChangePlayerPosition((x, y) => (x, y - 1)); - public void Down(object? sender, EventArgs args) - { - Move((x, y) => (x, y + 1)); - } + /// + /// Function for changing the player's position one step down + /// + public void Down(object? sender, EventArgs args) => ChangePlayerPosition((x, y) => (x, y + 1)); + /// + /// Function for getting the player's position + /// + /// Player position public (int, int) PlayerPosition() => (currentPositionOnX, currentPositionOnY); + + /// + /// A function that determines whether the game is completed or not + /// + /// True if passed + public bool IsTheEndOfTheGame() => (currentPositionOnX, currentPositionOnY) == (68, 4); // Magic 68 and 4 are the coordinates of the point you need to reach in order to win } \ No newline at end of file diff --git a/Game/Game/Game/Program.cs b/Game/Game/Game/Program.cs index 935c96d..6cabf8c 100644 --- a/Game/Game/Game/Program.cs +++ b/Game/Game/Game/Program.cs @@ -1,17 +1,9 @@ -namespace Game; - -public class Program -{ - static void Main(string[] args) - { - var eventLoop = new EventLoop(); - - var game = new Game(2, 9, "..//..//..//Game.txt", Console.SetCursorPosition); - eventLoop.LeftHandler += game.OnLeft; - eventLoop.RightHandler += game.OnRight; - eventLoop.UpHandler += game.Up; - eventLoop.DownHandler += game.Down; - eventLoop.Run(); - } -} +using Game; +var eventLoop = new EventLoop(); +var game = new Game.Game(2, 9, "..//..//..//Game.txt", Console.SetCursorPosition); +eventLoop.LeftHandler += game.OnLeft; +eventLoop.RightHandler += game.OnRight; +eventLoop.UpHandler += game.Up; +eventLoop.DownHandler += game.Down; +eventLoop.Run(game.IsTheEndOfTheGame); \ No newline at end of file From d8b02d6280429adc7e2ab86dfcda477bd2935360 Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 2 Jun 2022 04:10:08 +0300 Subject: [PATCH 6/6] formatted --- Game/Game/GameTest/GameTest.cs | 36 ++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/Game/Game/GameTest/GameTest.cs b/Game/Game/GameTest/GameTest.cs index 28c7d2e..a45fece 100644 --- a/Game/Game/GameTest/GameTest.cs +++ b/Game/Game/GameTest/GameTest.cs @@ -14,7 +14,9 @@ public void Setup() game = new Game.Game(2, 9, "..//..//..//..//Game//Game.txt", (x, y) => { }); } - // It is known in advance that there is no wall on the left in the position + /// + /// It is known in advance that there is no wall on the left in the position + /// [Test] public void ShouldPlayerPositionOnXEqualPreviousPositionOnXMinus1WhenOnLeft() { @@ -25,7 +27,9 @@ public void ShouldPlayerPositionOnXEqualPreviousPositionOnXMinus1WhenOnLeft() Assert.AreEqual(t, y); } - // It is known in advance that there is no wall on the right in the position + /// + /// It is known in advance that there is no wall on the right in the position + /// [Test] public void ShouldPlayerPositionOnXEqualPreviousPositionOnXPlus1WhenOnRight() { @@ -36,7 +40,9 @@ public void ShouldPlayerPositionOnXEqualPreviousPositionOnXPlus1WhenOnRight() Assert.AreEqual(t, y); } - // It is known in advance that there is no wall on the up in the position + /// + /// It is known in advance that there is no wall on the up in the position + /// [Test] public void ShouldPlayerPositionOnYEqualPreviousPositionOnYMinus1WhenUp() { @@ -52,7 +58,9 @@ public void ShouldPlayerPositionOnYEqualPreviousPositionOnYMinus1WhenUp() Assert.AreEqual(t, y - 1); } - // It is known in advance that there is no wall on the down in the position + /// + /// It is known in advance that there is no wall on the down in the position + /// [Test] public void ShouldPlayerPositionOnYEqualPreviousPositionOnYPlus1WhenDown() { @@ -70,7 +78,9 @@ public void ShouldPlayerPositionOnYEqualPreviousPositionOnYPlus1WhenDown() } - // It is known in advance that in the current position there will be a wall on the left + /// + /// It is known in advance that in the current position there will be a wall on the left + /// [Test] public void ShouldPlayerPositionOnXEqualPreviousPositionOnXWhenOnLeft() { @@ -82,7 +92,9 @@ public void ShouldPlayerPositionOnXEqualPreviousPositionOnXWhenOnLeft() Assert.AreEqual(t, y); } - // It is known in advance that in the current position there will be a wall on the right + /// + /// It is known in advance that in the current position there will be a wall on the right + /// [Test] public void ShouldPlayerPositionOnXEqualPreviousPositionOnXWhenOnRight() { @@ -98,7 +110,9 @@ public void ShouldPlayerPositionOnXEqualPreviousPositionOnXWhenOnRight() Assert.AreEqual(t, y); } - // It is known in advance that in the current position there will be a wall on the up + /// + /// It is known in advance that in the current position there will be a wall on the up + /// [Test] public void ShouldPlayerPositionOnXEqualPreviousPositionOnXWhenUp() { @@ -109,7 +123,9 @@ public void ShouldPlayerPositionOnXEqualPreviousPositionOnXWhenUp() Assert.AreEqual(t, y); } - // It is known in advance that in the current position there will be a wall on the down + /// + /// It is known in advance that in the current position there will be a wall on the down + /// [Test] public void ShouldPlayerPositionOnXEqualPreviousPositionOnXWhenDown() { @@ -119,8 +135,4 @@ public void ShouldPlayerPositionOnXEqualPreviousPositionOnXWhenDown() Assert.AreEqual(z, x); Assert.AreEqual(t, y); } - - - - }