public void TournamentDTOMappingTest() { var msg = RMF.GetTournament(); var dto = new TournamentDTO(msg); ValidateTournament(msg, dto); }
public void SpecifierDTOMappingTest() { var msg = RMF.GetDescSpecifiersSpecifier(); var dto = new SpecifierDTO(msg); ValidateSpecifier(msg, dto); }
public void PlayerProfileDTOTest() { var msg = RMF.GetPlayerExtended(); var dto = new PlayerProfileDTO(msg, null); ValidatePlayerExtended(msg, dto); }
public void SeasonCoverageInfoDTOTest() { var msg = RMF.GetSeasonCoverageInfo(); var dto = new SeasonCoverageDTO(msg); ValidateSeasonCoverageInfo(msg, dto); }
public void MarketMappingDTOMappingTest() { var msg = RMF.GetMappingsMapping(); var dto = new MarketMappingDTO(msg); ValidateMapping(msg, dto); }
public void OutcomeDescriptionDTOMappingTest() { var msg = RMF.GetDescOutcomesOutcome(); var dto = new OutcomeDescriptionDTO(msg); ValidateOutcome(msg, dto); }
public void MarketDescriptionDTOMappingTest() { var msg = RMF.GetDescMarket(); var dto = new MarketDescriptionDTO(msg); Assert.AreEqual(msg.id, dto.Id); Assert.AreEqual(msg.name, dto.Name); Assert.AreEqual(msg.description, dto.Description); //Assert.AreEqual(msg.variant, dto.Variant); //TODO: check if variant is missing in dto? Assert.AreEqual(msg.mappings.Length, dto.Mappings.Count()); Assert.AreEqual(msg.outcomes.Length, dto.Outcomes.Count()); Assert.AreEqual(msg.specifiers.Length, dto.Specifiers.Count()); for (var i = 0; i < msg.mappings.Length; i++) { ValidateMapping(msg.mappings[i], dto.Mappings.ToArray()[i]); } for (var i = 0; i < msg.outcomes.Length; i++) { ValidateOutcome(msg.outcomes[i], dto.Outcomes.ToArray()[i]); } for (var i = 0; i < msg.specifiers.Length; i++) { ValidateSpecifier(msg.specifiers[i], dto.Specifiers.ToArray()[i]); } }
public void GroupDTOMappingTest() { var msg = RMF.GetTournamentGroup(); var dto = new GroupDTO(msg); ValidateTournamentGroup(msg, dto); }
public void FixtureDTOMappingTest() { var msg = RMF.GetFixture(); var dto = new FixtureDTO(msg, null); Assert.AreEqual(msg.id, dto.Id.ToString()); Assert.AreEqual(msg.name, dto.Name); Assert.AreEqual(msg.liveodds, dto.LiveOdds); Assert.AreEqual(SdkInfo.ParseDate(msg.next_live_time), dto.NextLiveTime); Assert.AreEqual(msg.start_time, dto.StartTime); Assert.AreEqual(msg.scheduled, dto.Scheduled); Assert.AreEqual(msg.scheduled_end, dto.ScheduledEnd); Assert.AreEqual(!string.IsNullOrEmpty(msg.replaced_by) ? URN.Parse(msg.replaced_by) : null, dto.ReplacedBy); Assert.AreEqual(msg.start_time_tbdSpecified ? (bool?)msg.start_time_tbd : null, dto.StartTimeTbd); Assert.AreEqual(msg.competitors.Length, dto.Competitors.Count()); for (var i = 0; i < msg.competitors.Length; i++) { ValidateTeamCompetitor(msg.competitors[i], dto.Competitors.ToList()[i]); } ValidateCoverageInfo(msg.coverage_info, dto.Coverage); Assert.AreEqual(msg.delayed_info.id, dto.DelayedInfo.Id); Assert.AreEqual(msg.extra_info.Length, dto.ExtraInfo.ToList().Count); for (var i = 0; i < msg.extra_info.Length; i++) { Assert.IsTrue(dto.ExtraInfo.ContainsKey(msg.extra_info[i].key)); dto.ExtraInfo.TryGetValue(msg.extra_info[i].key, out var eiValue); Assert.AreEqual(msg.extra_info[i].value, eiValue); } }
private async Task GetCompetitorProfileAsync(URN id, CultureInfo culture, ISportEventCI requester) { Debug.Print($"DRM-GetCompetitorProfileAsync for {id} and culture {culture.TwoLetterISOLanguageName} - START"); var filePath = GetFile($"{culture.TwoLetterISOLanguageName}.competitor.{id?.Id ?? 1}.xml", culture); CompetitorProfileDTO dto = null; await ExecuteDelayAsync(id, culture).ConfigureAwait(false); if (string.IsNullOrEmpty(filePath) || !File.Exists(filePath)) { //filePath = GetFile(CompetitorProfileXml, culture); dto = new CompetitorProfileDTO(MessageFactoryRest.GetCompetitorProfileEndpoint(id == null ? 1 : (int)id.Id, StaticRandom.I(15))); } else { var restDeserializer = new Deserializer <competitorProfileEndpoint>(); var mapper = new CompetitorProfileMapperFactory(); var stream = FileHelper.OpenFile(filePath); dto = mapper.CreateMapper(restDeserializer.Deserialize(stream)).Map(); } if (dto != null) { await LogSaveDtoAsync(id, dto, culture, DtoType.CompetitorProfile, requester).ConfigureAwait(false); } Debug.Print($"DRM-GetCompetitorProfileAsync for {id} and culture {culture.TwoLetterISOLanguageName} - END"); }
public void TeamCompetitorDTOMappingTest() { var msg = RMF.GetTeamCompetitor(); var dto = new TeamCompetitorDTO(msg); var ci = new TeamCompetitorCI(dto, new CultureInfo("en"), new TestDataRouterManager(new CacheManager())); ValidateTeamCompetitor(msg, dto); ValidateTeamCompetitor(msg, ci, new CultureInfo("en")); }
public void CoverageInfoDTOMappingTest() { var coverageInfoFeed = RMF.GetCoverageInfo(10); var coverageInfo = new CoverageInfo(new CoverageInfoCI(new CoverageInfoDTO(coverageInfoFeed))); Assert.IsNotNull(coverageInfo); Assert.AreEqual(coverageInfoFeed.level, coverageInfo.Level); Assert.AreEqual(coverageInfoFeed.live_coverage, coverageInfo.IsLive); Assert.AreEqual(CoveredFrom.Tv, coverageInfo.CoveredFrom); Assert.AreEqual(coverageInfoFeed.coverage.Length, coverageInfo.Includes.Count()); Assert.AreNotEqual(coverageInfo.Includes.ToList()[0], coverageInfo.Includes.ToList()[2]); }
public void CompetitorProfileDTOMappingTest() { var msg = RMF.GetCompetitorProfileEndpoint(0, 10); var dto = new CompetitorProfileDTO(msg); ValidateTeamExtended(msg.competitor, dto.Competitor); //TODO: missing extended properties Assert.AreEqual(msg.players.Length, dto.Players.Count()); for (var i = 0; i < msg.players.Length; i++) { ValidatePlayerExtended(msg.players[i], dto.Players.ToArray()[i]); } }
public void CategoryDTOMappingTest() { var tours = RMF.GetTournamentExtendedList(100); var dto = new CategoryDTO("sr:category:1", "category name", "en", tours); Assert.AreEqual("sr:category:1", dto.Id.ToString()); Assert.AreEqual("category name", dto.Name); Assert.AreEqual(tours.Count, dto.Tournaments.Count()); for (var i = 0; i < tours.Count; i++) { ValidateTournamentExtended(tours[i], dto.Tournaments.ToArray()[i]); } }
public void TvChannelDTOMappingTest() { var msg = RMF.GetTvChannel(); var dto = new TvChannelDTO(msg); Assert.AreEqual(msg.name, dto.Name); Assert.AreEqual(msg.start_time, dto.StartTime); msg = RMF.GetTvChannel(false); dto = new TvChannelDTO(msg); Assert.AreEqual(msg.name, dto.Name); Assert.IsNull(dto.StartTime); }
public void SportDTOMappingTest() { var tours = RMF.GetTournamentExtendedList(100); var dto = new SportDTO("sr:sport:1", "name", tours); Assert.AreEqual(tours.Count, dto.Categories.Select(c => c.Tournaments).Count()); foreach (var t in tours) { var cat = dto.Categories.ToList().Find(c => c.Id.ToString() == t.category.id); Assert.IsNotNull(cat, "Category missing."); Assert.AreEqual(t.category.id, cat.Id.ToString(), "Category id wrong."); Assert.AreEqual(t.category.name, cat.Name, "Category name wrong."); ValidateTournamentExtended(t, cat.Tournaments.First(c => c.Id.ToString() == t.id)); } }
public void BookmakerDetailsDTOMappingTest() { var msg1 = RMF.GetBookmakerDetails(10); var msg2 = RMF.GetBookmakerDetails(0, false, false, false); var details1 = new BookmakerDetails(new BookmakerDetailsDTO(msg1, TimeSpan.Zero)); var details2 = new BookmakerDetails(new BookmakerDetailsDTO(msg2, TimeSpan.Zero)); Assert.AreEqual(msg1.bookmaker_id, details1.BookmakerId); Assert.AreEqual(msg1.message, details1.Message); Assert.AreEqual(msg1.expire_at, details1.ExpireAt); Assert.AreEqual(msg1.response_code.ToString().ToLower(), details1.ResponseCode.ToString().ToLower()); Assert.AreEqual(msg1.virtual_host, details1.VirtualHost); Assert.AreEqual(msg2.bookmaker_id, details2.BookmakerId); Assert.AreNotEqual(0, details2.BookmakerId); Assert.AreEqual(msg2.message, details2.Message); Assert.AreNotEqual(msg2.expire_at, details2.ExpireAt); Assert.AreEqual(DateTime.MinValue, details2.ExpireAt); Assert.AreNotEqual(msg2.response_code.ToString(), details2.ResponseCode); Assert.IsNull(details2.ResponseCode); Assert.AreEqual(msg2.virtual_host, details2.VirtualHost); }
public void CompetitorDTOMappingTest() { var msg = RMF.GetTeam(); ValidateTeam(msg, new CompetitorDTO(msg)); }
public void MarketDescriptionMergeTest() { var msg1 = RMF.GetDescMarket(10); var msg2 = RMF.GetDescMarket(msg1); var ci = MarketDescriptionCacheItem.Build(new MarketDescriptionDTO(msg1), _mappingValidatorFactory, FirstCulture, "test"); ci.Merge(new MarketDescriptionDTO(msg2), SecondCulture); Assert.AreEqual(msg1.id, ci.Id); Assert.AreEqual(msg1.name, ci.GetName(FirstCulture)); Assert.AreEqual(msg1.description, ci.GetDescription(FirstCulture)); Assert.AreEqual(msg1.variant, ci.Variant); Assert.AreEqual(msg1.mappings.Length, ci.Mappings.Count()); Assert.AreEqual(msg1.outcomes.Length, ci.Outcomes.Count()); Assert.AreEqual(msg1.specifiers.Length, ci.Specifiers.Count()); for (var i = 0; i < msg1.mappings.Length; i++) { ValidateMapping(msg1.mappings[i], ci.Mappings.ToArray()[i]); } for (var i = 0; i < msg1.outcomes.Length; i++) { ValidateOutcome(msg1.outcomes[i], ci.Outcomes.ToArray()[i], FirstCulture); } for (var i = 0; i < msg1.specifiers.Length; i++) { ValidateSpecifier(msg1.specifiers[i], ci.Specifiers.ToArray()[i]); } Assert.AreEqual(msg2.id, ci.Id); Assert.AreEqual(msg2.name, ci.GetName(SecondCulture)); Assert.AreEqual(msg2.description, ci.GetDescription(SecondCulture)); Assert.AreEqual(msg2.variant, ci.Variant); // TODO: variant is not overriding Assert.AreEqual(msg2.mappings.Length, ci.Mappings.Count()); Assert.AreEqual(msg2.outcomes.Length, ci.Outcomes.Count()); Assert.AreEqual(msg2.specifiers.Length, ci.Specifiers.Count()); for (var i = 0; i < msg2.mappings.Length; i++) { ValidateMapping(msg2.mappings[i], ci.Mappings.ToArray()[i]); } for (var i = 0; i < msg2.outcomes.Length; i++) { ValidateOutcome(msg2.outcomes[i], ci.Outcomes.ToArray()[i], SecondCulture); } for (var i = 0; i < msg2.specifiers.Length; i++) { ValidateSpecifier(msg2.specifiers[i], ci.Specifiers.ToArray()[i]); } Assert.AreNotEqual(ci.GetName(FirstCulture), ci.GetName(SecondCulture)); Assert.AreNotEqual(ci.GetDescription(FirstCulture), ci.GetDescription(SecondCulture)); Assert.IsTrue(ci.HasTranslationsFor(FirstCulture)); Assert.IsTrue(ci.HasTranslationsFor(SecondCulture)); Assert.IsFalse(ci.HasTranslationsFor(new CultureInfo("es"))); }