You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.6 KiB
49 lines
1.6 KiB
|
|
using Microsoft.Extensions.Logging.Abstractions;
|
|
using Microsoft.Extensions.Logging;
|
|
using Model;
|
|
using StubLib;
|
|
using API.Controllers.version2;
|
|
using API.Dto;
|
|
using EFManager;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Moq;
|
|
using FluentAssertions;
|
|
using EFlib;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using static EFManager.ManagerData;
|
|
|
|
namespace TestAPI
|
|
{
|
|
|
|
public class UnitTestChampionController
|
|
{
|
|
/*[Fact]
|
|
public async Task GetChamps_ReturnsOkResultWithChampionDtoList()
|
|
{
|
|
// Arrange
|
|
var options = new DbContextOptionsBuilder<SQLiteContext>()
|
|
.UseSqlite("DataSource=:memory:")
|
|
.Options;
|
|
using (var context = new SQLiteContext(options))
|
|
{
|
|
context.Database.EnsureCreated();
|
|
context.Champions.Add(new EFChampion { Name = "Champion 1" });
|
|
context.Champions.Add(new EFChampion { Name = "Champion 2" });
|
|
context.SaveChanges();
|
|
|
|
var controller = new ChampionController(new ManagerData(context), NullLogger<ChampionController>.Instance);
|
|
|
|
// Act
|
|
var result = await controller.GetChamps();
|
|
|
|
// Assert
|
|
var okResult = Assert.IsType<OkObjectResult>(result.Result);
|
|
var dtoChamps = Assert.IsAssignableFrom<IEnumerable<ChampionDto>>(okResult.Value);
|
|
Assert.Equal(2, dtoChamps.Count());
|
|
Assert.Equal("Champion 1", dtoChamps.ElementAt(0).Name);
|
|
Assert.Equal("Champion 2", dtoChamps.ElementAt(1).Name);
|
|
}
|
|
}*/
|
|
}
|
|
} |