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.
45 lines
1.1 KiB
45 lines
1.1 KiB
using DbConnectionLibrairie;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace UnitTestsEntityManagers
|
|
{
|
|
/// <summary>
|
|
/// an abstract class to init the dbContext
|
|
/// (every unit tests need to implement it)
|
|
/// </summary>
|
|
public abstract class AbstractUnitTestEM
|
|
{
|
|
protected MyDbContext dbContext;
|
|
protected HttpClient httpClient;
|
|
|
|
/// <summary>
|
|
/// constructor of the class :
|
|
/// initialise the database context
|
|
/// </summary>
|
|
public AbstractUnitTestEM()
|
|
{
|
|
var opt = new DbContextOptionsBuilder<MyDbContext>()
|
|
.UseSqlite("DataSource=:memory:")
|
|
.Options;
|
|
|
|
dbContext = new MyDbContext(opt);
|
|
|
|
httpClient = new HttpClient();
|
|
}
|
|
|
|
/// <summary>
|
|
/// destructor of the class :
|
|
/// dispose the database context
|
|
/// </summary>
|
|
~AbstractUnitTestEM()
|
|
{
|
|
dbContext.Dispose();
|
|
}
|
|
}
|
|
}
|