public void Update_Should_Update_Document()
        {
            using (var ctx = new DemoDbContext())
            {
                var repo = new CourseEFRepository(ctx);

                var wpfElement = new Course
                {
                    Id         = 2,
                    CourseName = "Apprendre WPF"
                };

                repo.Update(wpfElement);
                repo.Save();
            }
            using (var ctx = new DemoDbContext())
            {
                var repo     = new CourseEFRepository(ctx);
                var elements = repo.GetAll();
                elements.Should().HaveCount(3);
                elements.Any(e => e.Id == 2).Should().BeTrue();
                elements.Any(e => e.CourseName == "Apprendre WPF").Should().BeTrue();
                elements.Any(e => e.CourseName == "Apprendre WPF avec Prism").Should().BeFalse();
            }
        }
        public void Insert_Should_Add_Element_ToDocument()
        {
            using (var ctx = new DemoDbContext())
            {
                var repo = new CourseEFRepository(ctx);

                var xamarinCourse = new Course
                {
                    Id             = 4,
                    CourseName     = "Apprendre Xamarin",
                    DurationInDays = 10,
                    Difficulty     = Difficulty.Medium
                };

                repo.Insert(xamarinCourse);
                repo.Save();
            }
            using (var ctx = new DemoDbContext())
            {
                var repo     = new CourseEFRepository(ctx);
                var elements = repo.GetAll();
                elements.Should().HaveCount(4);
                elements.Any(e => e.Id == 4).Should().BeTrue();
                elements.Any(e => e.CourseName == "Apprendre Xamarin").Should().BeTrue();
            }
        }
        public void GetAll_Should_Retrieve_All_Data()
        {
            using (var ctx = new DemoDbContext())
            {
                var repo = new CourseEFRepository(ctx);

                var allCourses = repo.GetAll();

                allCourses.Should().HaveCount(3);
            }
        }
        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();
            }
        }