public StudyCesiContext GetFakeContext()
        {
            var options = new DbContextOptionsBuilder <StudyCesiContext>()
                          .UseInMemoryDatabase("FakeDatabase")
                          .Options;

            var context = new StudyCesiContext(options);

            var fixture = new Fixture();

            fixture.Behaviors.OfType <ThrowingRecursionBehavior>().ToList()
            .ForEach(b => fixture.Behaviors.Remove(b));
            fixture.Behaviors.Add(new OmitOnRecursionBehavior());


            var exam = fixture.Create <Exam>();

            context.Exams.Add(exam);

            context.SaveChanges();
            return(context);
        }
Пример #2
0
 public SubjectsController(StudyCesiContext context)
 {
     _context = context;
 }
 public ExamsController(StudyCesiContext context, UserManager <User> userManager)
 {
     _context     = context;
     _userManager = userManager;
 }
 public TypeQuestionsController(StudyCesiContext context)
 {
     _context = context;
 }
 public AnswersController(StudyCesiContext context)
 {
     _context = context;
 }