public CutmenServiceTests()
        {
            DbContextOptionsBuilder <ApplicationDbContext> options =
                new DbContextOptionsBuilder <ApplicationDbContext>()
                .UseInMemoryDatabase(Guid.NewGuid().ToString());

            AutoMapperConfig.RegisterMappings(typeof(DetailsCutmanViewModel).Assembly);

            this.applicationDbContext = new ApplicationDbContext(options.Options);
            this.skillsRepository     = new EfDeletableEntityRepository <Skill>(this.applicationDbContext);
            this.fightersRepository   = new EfDeletableEntityRepository <Fighter>(this.applicationDbContext);
            this.cutmenRepository     = new EfDeletableEntityRepository <Cutman>(this.applicationDbContext);
            this.skillsService        = new SkillsService(this.skillsRepository, this.usersRepository);
            this.cutmenService        = new CutmenService(this.cutmenRepository, this.fightersRepository, this.skillsService);

            foreach (var fighter in this.GetTestFighters())
            {
                this.fightersRepository.AddAsync(fighter);
                this.fightersRepository.SaveChangesAsync();
            }

            foreach (var cutman in this.GetTestCutmen())
            {
                this.cutmenRepository.AddAsync(cutman);
                this.cutmenRepository.SaveChangesAsync();
            }

            foreach (var skill in this.GetTestSkillPoints())
            {
                this.skillsRepository.AddAsync(skill);
                this.skillsRepository.SaveChangesAsync();
            }
        }
Example #2
0
 public CutmenController(
     ICutmenService cutmenService,
     IFightersService fightersService,
     IUsersService usersService,
     UserManager <ApplicationUser> userManager)
 {
     this.cutmenService   = cutmenService;
     this.fightersService = fightersService;
     this.usersService    = usersService;
     this.userManager     = userManager;
 }
 public UsersController(
     IUsersService usersService,
     UserManager <ApplicationUser> userManager,
     IFightersService fightersService,
     ISkillsService skillsService,
     IBiographiesService biographiesService,
     IManagersService managersService,
     ICoachesService coachesService,
     ICutmenService cutmenService)
 {
     this.usersService       = usersService;
     this.userManager        = userManager;
     this.fightersService    = fightersService;
     this.skillsService      = skillsService;
     this.biographiesService = biographiesService;
     this.managersService    = managersService;
     this.coachesService     = coachesService;
     this.cutmenService      = cutmenService;
 }