public void FindByIdAsync_Should_Retrieve_Correct_Item() { using (var ctx = new DemoDbContext()) { var repo = new CourseEFRepository(ctx); var wpfCourse = repo.FindById(2); wpfCourse.CourseName.Should().Be("Apprendre WPF avec Prism"); wpfCourse.Id.Should().Be(2); } }
public void Remove_Should_Remove_Element_From_JSON_Document() { using (var ctx = new DemoDbContext()) { var repo = new CourseEFRepository(ctx); var wpfElement = repo.FindById(2); repo.Remove(wpfElement); repo.Save(); } using (var ctx = new DemoDbContext()) { var repo = new CourseEFRepository(ctx); var elements = repo.GetAll(); elements.Should().HaveCount(2); elements.Any(e => e.Id == 2).Should().BeFalse(); } }