/// <summary> /// Initializes a new instance of the <see cref="RoundDTO" /> class /// </summary> /// <param name="round">The <see cref="matchRound" /> used for creating new instance</param> internal RoundDTO(matchRound round) { Contract.Requires(round != null); Type = round.type; Number = round.numberSpecified ? (int?)round.number : null; Name = round.name; Group = round.group; URN groupId; GroupId = URN.TryParse(round.group_id ?? " ", out groupId) ? groupId : null; OtherMatchId = round.other_match_id; CupRoundMatches = round.cup_round_matchesSpecified ? (int?)round.cup_round_matches : null; CupRoundMatchNumber = round.cup_round_match_numberSpecified ? (int?)round.cup_round_match_number : null; BetradarId = round.betradar_idSpecified ? (int?)round.betradar_id : null; PhaseOrGroupLongName = round.group_long_name; Phase = round.phase; }
/// <summary> /// Initializes a new instance of the <see cref="RoundDTO"/> class /// </summary> /// <param name="round">The <see cref="matchRound"/> used for creating new instance</param> internal RoundDTO(matchRound round) { Guard.Argument(round, nameof(round)).NotNull(); Type = round.type; Number = round.numberSpecified ? (int?)round.number : null; Name = !string.IsNullOrEmpty(round.name) ? round.name : null; GroupName = !string.IsNullOrEmpty(round.group_name) ? round.group_name : null; PhaseOrGroupLongName = !string.IsNullOrEmpty(round.group_long_name) ? round.group_long_name : null; Group = round.group; Phase = round.phase; GroupId = string.IsNullOrEmpty(round.group_id) ? null : URN.TryParse(round.group_id, out var groupId) ? groupId : null; OtherMatchId = round.other_match_id; CupRoundMatches = round.cup_round_matchesSpecified ? (int?)round.cup_round_matches : null; CupRoundMatchNumber = round.cup_round_match_numberSpecified ? (int?)round.cup_round_match_number : null; BetradarId = round.betradar_idSpecified ? (int?)round.betradar_id : null; BetradarName = round.betradar_name; }
private static void ValidateMatchRound(matchRound msg, RoundDTO dto) { Assert.AreEqual(msg.name, dto.Name); Assert.AreEqual(msg.name, dto.Name); Assert.AreEqual(msg.cup_round_match_number, dto.CupRoundMatchNumber); Assert.AreEqual(msg.cup_round_matches, dto.CupRoundMatches); Assert.AreEqual(msg.number, dto.Number); Assert.AreEqual(msg.type, dto.Type); }
public void RoundMergeTest() { var matchRoundTypeEn = new matchRound { name = "round name in english", cup_round_match_number = 1, cup_round_match_numberSpecified = true, cup_round_matches = 2, cup_round_matchesSpecified = true, number = 10, numberSpecified = true, type = "match type 1", }; var matchRoundTypeDe = new matchRound { name = "round name in deutsch", cup_round_match_number = 1, cup_round_match_numberSpecified = true, cup_round_matches = 2, cup_round_matchesSpecified = true, number = 10, numberSpecified = true, type = "match type 1", }; var roundDTO1 = new RoundDTO(matchRoundTypeEn); var roundDTO2 = new RoundDTO(matchRoundTypeDe); var roundCI = new RoundCI(roundDTO1, _cultureFirst); roundCI.Merge(roundDTO2, _cultureSecond); Assert.IsNotNull(roundCI); Assert.AreEqual(matchRoundTypeEn.name, roundCI.GetName(_cultureFirst)); Assert.AreEqual(matchRoundTypeDe.name, roundCI.GetName(_cultureSecond)); Assert.AreEqual(matchRoundTypeEn.cup_round_match_number, roundCI.CupRoundMatchNumber); Assert.AreEqual(matchRoundTypeEn.cup_round_matches, roundCI.CupRoundMatches); Assert.AreEqual(matchRoundTypeEn.number, roundCI.Number); Assert.AreEqual(matchRoundTypeEn.type, roundCI.Type); }