Ejemplo n.º 1
0
        public void Initialize()
        {
            factory     = new EncounterFactory();
            sport       = new Sport("Soccer", true);
            teamA       = new Mock <Team>(1, "teamA", "photo", sport).Object;
            teamB       = new Mock <Team>(2, "teamB", "photo", sport).Object;
            teamC       = new Mock <Team>(3, "teamC", "photo", sport).Object;
            teamD       = new Mock <Team>(4, "teamD", "photo", sport).Object;
            testFixture = new FixtureDto()
            {
                fixtureName   = "ObligatorioDA2.BusinessLogic.FixtureAlgorithms.OneMatchFixture"
                , initialDate = DateTime.Today, daysBetweenRounds = 5, roundLength = 2
            };
            teamsCollection = GetTeamsList();
            teamsNames      = teamsCollection.Select(tn => tn.Name).ToList();
            SetUpRepository();
            mapper = new EncounterDtoMapper(teamStorage, matchStorage, sportStorage);
            context.Database.EnsureDeleted();
            Mock <IAuthenticationService> auth = new Mock <IAuthenticationService>();

            auth.Setup(a => a.GetConnectedUser()).Returns(GetFakeUser());
            EncounterService service = new EncounterService(matchStorage, teamStorage, sportStorage, auth.Object);

            algorithmPaths = @".\";
            Mock <ILoggerService> logService = new Mock <ILoggerService>();

            fixtureService = new FixtureService(teamStorage, service, auth.Object, logService.Object);
        }
Ejemplo n.º 2
0
 public FixtureService(ITeamRepository teamRepository, IInnerEncounterService matchAddition,
                       IAuthenticationService authService, ILoggerService loggerService)
 {
     matchService  = matchAddition;
     teamStorage   = teamRepository;
     authenticator = authService;
     logger        = loggerService;
     mapper        = new EncounterDtoMapper();
 }
Ejemplo n.º 3
0
 public EncounterService(IEncounterRepository encountersRepository, ITeamRepository teamsRepository,
                         ISportRepository sportsRepository, IAuthenticationService authService)
 {
     factory            = new EncounterFactory();
     encountersStorage  = encountersRepository;
     teamsStorage       = teamsRepository;
     sportsStorage      = sportsRepository;
     authenticator      = authService;
     encounterConverter = new EncounterDtoMapper(teamsStorage, encountersStorage, sportsStorage);
 }
Ejemplo n.º 4
0
        private ICollection <EncounterDto> GetEncounterDtos(ICollection <Encounter> encounters)
        {
            EncounterDtoMapper mapper = new EncounterDtoMapper();

            return(encounters.Select(e => mapper.ToDto(e)).ToList());
        }