public void RepositorytestGetByIdMethod()
        {
            List <LearningThing> learningThings     = new List <LearningThing>();
            ILearningRepository  learningRepository = new LearningThingRepository(learningThings);
            LearningThing        learningThing1     = new LearningThing("l2", "none1");

            learningRepository.CreateLearningThing(learningThing1);

            Assert.AreEqual(learningThing1, learningRepository.GetLearningThingById(1));
        }
        public void UpdateLearningThing(LearningThing newLearningThing, int idToUpdate)
        {
            var obj = context.FirstOrDefault(x => x.Id.Equals(idToUpdate));

            if (obj != null)
            {
                obj.Advanced    = newLearningThing.Advanced;
                obj.Category    = newLearningThing.Category;
                obj.Subject     = newLearningThing.Subject;
                obj.Description = newLearningThing.Description;
            }
        }
        public void RepositoryTestGetByDescriptionMethod()
        {
            Category             category       = new Category("myCategory");
            List <LearningThing> learningThings = new List <LearningThing>();
            LearningThing        learningThing  = new LearningThing("l1", "none1");

            learningThing.Category = category;
            ILearningRepository learningRepository = new LearningThingRepository(learningThings);

            learningRepository.CreateLearningThing(learningThing);

            Assert.AreEqual("myCategory", learningRepository.GetLearningThingByCategoryDescription("myCategory").FirstOrDefault().Category.Description);
        }
        public void RepositoryTestUpdateMethod()
        {
            List <LearningThing> learningThings = new List <LearningThing>()
            {
                new LearningThing("l1", "none1"),
            };
            ILearningRepository learningRepository = new LearningThingRepository(learningThings);
            LearningThing       learningThing      = new LearningThing("l2", "updated");

            learningRepository.UpdateLearningThing(learningThing, 1);


            Assert.AreEqual("updated", learningRepository.GetLearningThingById(1).Description);
        }
        public void DeleteLearningThing(int id)
        {
            LearningThing learningThing = context.Find(x => x.Id.Equals(id));

            context.Remove(learningThing);
        }
 public void CreateLearningThing(LearningThing learningThing)
 {
     context.Add(learningThing);
 }