public async Task FindByIdTest() { using var myContext = CreateMagasinDbContext(); var repo = new ArticleEFRepository(myContext); var article = await repo.FindById(3); article.Libelle.Should().Be("PC"); article.Id.Should().Be(3); }
public async Task RemoveTest() { using (var myContext = CreateMagasinDbContext()) { var repo = new ArticleEFRepository(myContext); var article = await repo.FindById(4); repo.Remove(article); await repo.Save(); } using (var myContext = CreateMagasinDbContext()) { var repo = new ArticleEFRepository(myContext); var elements = await repo.GetAll(); elements.Should().HaveCount(3); elements.Any(e => e.Id == 4).Should().BeFalse(); } }