public static void Main(string[] args) { var ss = new VitalbetSportsRepository(); var config = new MapperConfiguration(s => s.AddProfile <XmlMappings>()); IMapper mapper = new Mapper(config); var xml = ss.RequestSportsAsync().Result; var sports = xml.Sports.Select(mapper.Map <Sport>).ToList(); var repo = new SportsRepository(); repo.AddOrUpdate(sports); }
public async void SportsController_GetAll_NotFound_WithNoDatabaseConnection() { var logMock = new Mock <ILogger <SportsController> >(); var eventsRepo = new EventsRepository(""); var sportsRepo = new SportsRepository(""); var spControl = new SportsController(logMock.Object, eventsRepo, sportsRepo); var result = await spControl.Get(); Assert.NotNull(result); Assert.IsType <ActionResult <IEnumerable <SportInfo> > >(result); Assert.NotNull(result.Result); Assert.IsType <NotFoundResult>(result.Result); Assert.True(result.Value == null); Assert.True((result.Result as NotFoundResult).StatusCode == 404); }
public void SportsRepository_EmptyConnectionString_ExceptionWhenQuery() { var repo = new SportsRepository(""); Assert.ThrowsAsync <AggregateException>(async() => await repo.GetSportsWithEventsCount()); }
public SportsController() { sportRepo = new SportsRepository(); teamRepo = new TeamsRepository(); playerRepo = new PlayersRepository(); }