Files
Giants/Tests/Giants.Application.Tests/ApplicationTests.cs

41 lines
1.1 KiB
C#

namespace Giants.Core.Tests;
using Giants.Application;
using Giants.Core.Commands;
using Giants.Core.Interfaces;
using Giants.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
public class ApplicationTests
{
private readonly IMatchRepository _repo;
public ApplicationTests()
{
IHexagonalGrid _grid = new HexagonalGridImpl();
BoardLayout layout = new BoardLayout(_grid);
_repo = new MatchRepositoryMock(layout);
}
[Fact]
public void ApplicationCreationExample()
{
GiantApplication app = new GiantApplication();
}
[Fact]
public void TryingServiceInjection()
{
// creation des instances
var serviceCollection = new ServiceCollection();
serviceCollection.AddScoped(repo => _repo);
// Ajout des commandes disponibles
serviceCollection.AddScoped<NewMatchCommand>();
//Test d'injection
var serviceProvider = serviceCollection.BuildServiceProvider();
NewMatchCommand? command = serviceProvider.GetService<NewMatchCommand>();
}
}