Example #1
0
        public void Setup()
        {
            cursoIdTest = new Guid("2ce24c4d-df93-4620-ba47-c8065633775f");
            var fixture      = new Fixture();
            var cursoRecords = fixture.CreateMany <Curso>().ToList();

            cursoRecords.Add(fixture.Build <Curso>().With(tr => tr.CursoId, cursoIdTest).Create());

            var options = new DbContextOptionsBuilder <EducationDbContext>()
                          .UseInMemoryDatabase(databaseName: $"EducationDbContext-{Guid.NewGuid()}")
                          .Options;

            var educationDbContextFake = new EducationDbContext(options);

            educationDbContextFake.Cursos.AddRange(cursoRecords);
            educationDbContextFake.SaveChanges();

            var mapConfig = new MapperConfiguration(cfg => {
                cfg.AddProfile(new MappingTest());
            });

            var mapper = mapConfig.CreateMapper();

            handlerByIdCurso = new GetCursoByIdQuery.GetCursoByIdQueryHandler(educationDbContextFake, mapper);
        }
        public void Setup()
        {
            var fixture      = new Fixture();
            var cursoRecords = fixture.CreateMany <Curso>().ToList();

            cursoRecords.Add(fixture.Build <Curso>().With(tr => tr.CursoId, Guid.Empty).Create());

            var options = new DbContextOptionsBuilder <EducationDbContext>()
                          .UseInMemoryDatabase(databaseName: $"EducationDbContext-{Guid.NewGuid()}")
                          .Options;

            var educationDbContextFake = new EducationDbContext(options);

            educationDbContextFake.Cursos.AddRange(cursoRecords);
            educationDbContextFake.SaveChanges();

            var mapConfig = new MapperConfiguration(cfg => {
                cfg.AddProfile(new MappingTest());
            });

            var mapper = mapConfig.CreateMapper();

            handlerCursoCreate = new CreateCursoCommand.CreatecursoCommandHandler(educationDbContextFake);
        }
Example #3
0
 public EducationService(EducationDbContext db, IUnitOfWork uow) : base(db, uow)
 {
 }
Example #4
0
 public ProjectsController(EducationDbContext context, IWebHostEnvironment hostEnvironment)
 {
     _context           = context;
     webHostEnvironment = hostEnvironment;
 }
 public BaseService(EducationDbContext context, IUnitOfWork uow)
 {
     _dbContext = context;
     _uow       = uow;
     _dbSet     = _dbContext.Set <T>();
 }
Example #6
0
 public UnitOfWork(EducationDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Example #7
0
 public ProjectsController(EducationDbContext context)
 {
     _context = context;
 }
Example #8
0
 public UserService(EducationDbContext db, IUnitOfWork uow, UserManager <User> userManager, RoleManager <Role> roleManager) : base(db, uow)
 {
     _userManager = userManager;
     _roleManager = roleManager;
 }
Example #9
0
 public GetCursoByIdQueryHandler(EducationDbContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
Example #10
0
 public MajorsController(EducationDbContext context)
 {
     _context = context;
 }
Example #11
0
 public TasksController(EducationDbContext context)
 {
     _context = context;
 }
Example #12
0
 public CreatecursoCommandHandler(EducationDbContext context)
 {
     _context = context;
 }