Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

ConsoleAmoba #16

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
9a2a7b3
Create project
noelhorvath Apr 20, 2022
460dcb4
add Board
noelhorvath Apr 20, 2022
cc4ead8
update Board class and IBoard interface
noelhorvath Apr 23, 2022
8ac3b43
Add IAction, ICell and IPlayer interfaces
noelhorvath Apr 23, 2022
882c580
Add Action and Cell classes
noelhorvath Apr 23, 2022
c556f3e
update IGameEngine interface
noelhorvath Apr 23, 2022
efd018b
Update GameEngine
noelhorvath Apr 23, 2022
df89afd
Merge branch 'CsharptutorialHungary:main' into main
noelhorvath Apr 24, 2022
e0a44d8
remove Action and Cell models
noelhorvath May 4, 2022
db6e476
update Board
noelhorvath May 4, 2022
e6d59e9
add Coordinate and BoardCell models
noelhorvath May 4, 2022
7309d11
fix game status checks
noelhorvath May 4, 2022
51b2b13
add ConsolePlayer, RandomPlayer and RecordCoordinate
noelhorvath May 4, 2022
710b50c
Update interfaces
noelhorvath May 4, 2022
b8b4816
Merge branch 'CsharptutorialHungary:main' into main
noelhorvath May 5, 2022
582bfd4
Merge branch 'main' of https://github.com/noelhorvath/egyetemikurzus-…
noelhorvath May 5, 2022
9ed2d5b
Update Board
noelhorvath May 10, 2022
13c0de5
extend ICell with ICoordinate
noelhorvath May 10, 2022
0d83355
Add Amoba.Tests project
noelhorvath May 10, 2022
fb096ea
Add Program
noelhorvath May 10, 2022
a963685
Update GameEngine and fix issues
noelhorvath May 10, 2022
9ec6a1d
remove test
noelhorvath May 10, 2022
b3581ce
improve Board
noelhorvath May 10, 2022
ab8e1cc
remove comment from GameTurnReportRecord
noelhorvath May 10, 2022
e865013
Add tests for BoardCell
noelhorvath May 10, 2022
7a8f952
Add tests for Board
noelhorvath May 10, 2022
76f6b27
Add tests for Coordinate
noelhorvath May 10, 2022
f021c5b
Add tests for GameReportRecord
noelhorvath May 10, 2022
a798fd0
Add tests for GameTurnReportRecord
noelhorvath May 10, 2022
d8d9923
Add tests for RecordCoordinate
noelhorvath May 10, 2022
46da566
Fixes and improvements
noelhorvath May 11, 2022
9c95231
Update BoardTests
noelhorvath May 11, 2022
b576675
Update GameReportTests
noelhorvath May 11, 2022
35f0506
Add test for ConsolePlayer and RandomPlayer
noelhorvath May 11, 2022
40577c3
Add tests for GameEngine
noelhorvath May 11, 2022
62d700e
Update Program
noelhorvath May 12, 2022
ff9590c
Add tests for GameReporter
noelhorvath May 12, 2022
fe15ebe
Add tests for Program
noelhorvath May 12, 2022
a959732
Add README.md
noelhorvath May 12, 2022
0e3a7a4
Update README.md
noelhorvath May 12, 2022
3497954
Update ProgramTests
noelhorvath May 12, 2022
5101f1d
Merge branch 'main' of https://github.com/noelhorvath/egyetemikurzus-…
noelhorvath May 12, 2022
862cf7c
Code cleanup and fix test in ProgramTests
noelhorvath May 12, 2022
0b58d52
Correct Test_Copy_Method test in BoardCellTests
noelhorvath May 12, 2022
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,4 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/
/JP0C9W/Amoba/Properties/launchSettings.json
21 changes: 21 additions & 0 deletions JP0C9W/Amoba.Tests/Amoba.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.7" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.7" />
<PackageReference Include="coverlet.collector" Version="3.1.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Amoba\Amoba.csproj" />
</ItemGroup>

</Project>
80 changes: 80 additions & 0 deletions JP0C9W/Amoba.Tests/BoardCellTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using Amoba.Classes;
using Amoba.Interfaces;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Amoba.Tests
{
[TestClass]
public class BoardCellTests
{
[DataRow(0, 0, BoardCellValue.EMPTY)]
[DataRow(123, 32423, BoardCellValue.BLACK)]
[DataRow(-1345, 33, BoardCellValue.WHITE)]
[DataRow(15, -3, BoardCellValue.WHITE)]
[DataRow(-35645, -345, BoardCellValue.WHITE)]
[DataTestMethod]
public void Test_X_Y_Value_Constructor(int x, int y, BoardCellValue value)
{
var cell = new BoardCell(x, y, value);
Assert.AreEqual(x < 0 ? 0 : x, cell.X);
Assert.AreEqual(y < 0 ? 0 : y, cell.Y);
Assert.AreEqual(value, cell.Value);
}

[DataRow(0)]
[DataRow(123)]
[DataRow(-1345)]
[DataTestMethod]
public void Test_X_Constructor(int x)
{
var cell = new BoardCell(x);
Assert.AreEqual(x < 0 ? 0 : x, cell.X);
Assert.AreEqual(0, cell.Y);
Assert.AreEqual(BoardCellValue.EMPTY, cell.Value);
}

[DataRow(BoardCellValue.BLACK)]
[DataRow(BoardCellValue.WHITE)]
[DataRow(BoardCellValue.EMPTY)]
[DataTestMethod]
public void Test_Value_Constructor(BoardCellValue value)
{
var cell = new BoardCell(value);
Assert.AreEqual(0, cell.X);
Assert.AreEqual(0, cell.Y);
Assert.AreEqual(value, cell.Value);
}

[TestMethod]
public void Test_Parameterless_Constructor()
{
var cell = new BoardCell();
Assert.AreEqual(0, cell.X);
Assert.AreEqual(0, cell.Y);
Assert.AreEqual(BoardCellValue.EMPTY, cell.Value);
}

[TestMethod]
public void Test_ToString_Method()
{
var cell = new BoardCell();
var str = cell.ToString();
Assert.AreEqual($"Color: {BoardCellValue.EMPTY}, Row: {1}, Column: {1}", str);
}

[DataRow(1, 2, BoardCellValue.BLACK)]
[DataRow(11, 23, BoardCellValue.WHITE)]
[DataRow(111, 233, BoardCellValue.BLACK)]
[DataRow(1233, 3, BoardCellValue.WHITE)]
[DataRow(1, 3321, BoardCellValue.EMPTY)]
[TestMethod]
public void Test_Copy_Method(int x, int y, BoardCellValue value)
{
var cell = new BoardCell(x, y, value);
var copy = cell.Copy();
Assert.AreEqual(x, copy.X);
Assert.AreEqual(y, copy.Y);
Assert.AreEqual(value, copy.Value);
}
}
}
Loading