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

33 lines
891 B
C#

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