Merged interfaces to classes

This commit is contained in:
Martin Berg Alstad
2023-07-13 14:00:42 +02:00
parent 00d777d985
commit 0de20200f5
16 changed files with 41 additions and 58 deletions

View File

@ -1,6 +1,4 @@
namespace BackendTests.Controllers;
public class GameControllerTests
{
}
public class GameControllerTests // TODO
{ }

View File

@ -3,7 +3,6 @@ using BackendTests.TestUtils;
using Microsoft.Extensions.Logging;
using NSubstitute;
using pacMan.Game;
using pacMan.Game.Interfaces;
using pacMan.Game.Items;
using pacMan.Interfaces;
using pacMan.Services;

View File

@ -1,7 +1,7 @@
using BackendTests.TestUtils;
using pacMan.Exceptions;
using pacMan.Game;
using pacMan.Game.Interfaces;
using pacMan.Game.Items;
using pacMan.Services;
using pacMan.Utils;

View File

@ -9,7 +9,7 @@ using pacMan.Utils;
namespace BackendTests.Services;
public class WebSocketServiceTests // TODO: Implement
public class WebSocketServiceTests
{
private IWebSocketService _service = null!;
@ -136,7 +136,7 @@ public class WebSocketServiceTests // TODO: Implement
{
var player = Players.Create("white");
var group = _service.AddPlayer(player);
Assert.Multiple(() =>
{
Assert.That(group.Players, Has.Count.EqualTo(1));
@ -148,11 +148,12 @@ public class WebSocketServiceTests // TODO: Implement
[Test]
public void AddPlayer_ToFullGroup()
{
for (int i = 0; i < 4; i++)
for (var i = 0; i < 4; i++)
{
var player = Players.Create(i.ToString());
_service.AddPlayer(player);
}
var player5 = Players.Create("white");
var group = _service.AddPlayer(player5);

View File

@ -1,10 +1,9 @@
using pacMan.Game;
using pacMan.Game.Interfaces;
using pacMan.Game.Items;
namespace BackendTests.TestUtils;
public class Players
internal static class Players
{
internal static IPlayer Create(string colour) =>
new Player

View File

@ -51,13 +51,19 @@ public class ExtensionsTests
[Test]
public void GetString_NegativeLength()
{
Assert.Throws(typeof(ArgumentOutOfRangeException), () => _bytes.GetString(-1));
Assert.Throws<ArgumentOutOfRangeException>(() => _bytes.GetString(-1));
}
[Test]
public void GetString_LengthGreaterThanByteArrayLength()
{
Assert.Throws(typeof(ArgumentOutOfRangeException), () => _bytes.GetString(_bytes.Length + 1));
Assert.Throws<ArgumentOutOfRangeException>(() => _bytes.GetString(_bytes.Length + 1));
}
[Test]
public void GetString_LengthShorterThanByteArrayLength()
{
Assert.That(_bytes.GetString(_bytes.Length / 2), Is.EqualTo("Hello "));
}
#endregion