Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 public EducationService(EducationDbContext db, IUnitOfWork uow) : base(db, uow)
 {
 }
Ejemplo n.º 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>();
 }
Ejemplo n.º 6
0
 public UnitOfWork(EducationDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Ejemplo n.º 7
0
 public ProjectsController(EducationDbContext context)
 {
     _context = context;
 }
Ejemplo n.º 8
0
 public UserService(EducationDbContext db, IUnitOfWork uow, UserManager <User> userManager, RoleManager <Role> roleManager) : base(db, uow)
 {
     _userManager = userManager;
     _roleManager = roleManager;
 }
Ejemplo n.º 9
0
 public GetCursoByIdQueryHandler(EducationDbContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
Ejemplo n.º 10
0
 public MajorsController(EducationDbContext context)
 {
     _context = context;
 }
Ejemplo n.º 11
0
 public TasksController(EducationDbContext context)
 {
     _context = context;
 }
Ejemplo n.º 12
0
 public CreatecursoCommandHandler(EducationDbContext context)
 {
     _context = context;
 }