public static desc_market GetDescMarket(desc_market baseMsg) { var newMsg = new desc_market { id = baseMsg.id, name = "Market " + SR.S1000, description = "Description " + SR.S1000, variant = baseMsg.variant, mappings = new mappingsMapping[baseMsg.mappings.Length], outcomes = new desc_outcomesOutcome[baseMsg.outcomes.Length], specifiers = new desc_specifiersSpecifier[baseMsg.specifiers.Length] }; baseMsg.mappings.CopyTo(newMsg.mappings, 0); baseMsg.outcomes.CopyTo(newMsg.outcomes, 0); baseMsg.specifiers.CopyTo(newMsg.specifiers, 0); foreach (var m in newMsg.outcomes) { m.name = "Outcome " + SR.S(); m.description = "Desc " + SR.S(); } foreach (var m in newMsg.specifiers) { m.name = "Specifier name " + SR.S(); m.description = "Desc " + SR.S(); } return(newMsg); }
public static desc_market GetDescMarket(int id = 0, int subItemCount = 0) { if (subItemCount == 0) { subItemCount = SR.I(20); } var mappings = new List <mappingsMapping>(); var outcomes = new List <desc_outcomesOutcome>(); var specifiers = new List <desc_specifiersSpecifier>(); for (var i = 0; i < subItemCount; i++) { mappings.Add(GetMappingsMapping()); outcomes.Add(GetDescOutcomesOutcome()); specifiers.Add(GetDescSpecifiersSpecifier()); } var msg = new desc_market { id = id == 0 ? SR.I1000 : id, name = "Market " + SR.S1000, description = "Description " + SR.S1000, variant = "Variant " + SR.S1000, mappings = mappings.ToArray(), outcomes = outcomes.ToArray(), specifiers = specifiers.ToArray() }; return(msg); }
internal MarketDescriptionDTO(desc_market description) { Guard.Argument(description, nameof(description)).NotNull(); Guard.Argument(description.name, nameof(description.name)).NotNull().NotEmpty(); Id = description.id; Name = description.name; Description = description.description; Outcomes = description.outcomes?.Select(o => new OutcomeDescriptionDTO(o)).ToList(); Specifiers = description.specifiers?.Select(s => new MarketSpecifierDTO(s)).ToList(); Mappings = description.mappings?.Select(m => new MarketMappingDTO(m)).ToList(); Attributes = description.attributes?.Select(a => new MarketAttributeDTO(a)).ToList(); Variant = description.variant; }
internal MarketDescriptionDTO(desc_market description) { Guard.Argument(description, nameof(description)).NotNull(); Guard.Argument(description.name, nameof(description.name)).NotNull().NotEmpty(); Id = description.id; Name = description.name; Description = description.description; Outcomes = description.outcomes?.Select(o => new OutcomeDescriptionDTO(o)).ToList(); Specifiers = description.specifiers?.Select(s => new SpecifierDTO(s)).ToList(); Mappings = description.mappings?.Select(m => new MarketMappingDTO(m)).ToList(); Attributes = description.attributes?.Select(a => new MarketAttributeDTO(a)).ToList(); Variant = description.variant; OutcomeType = mapOutcomeType(description.outcome_type, description.includes_outcomes_of_type); Groups = description.groups?.Split(new[] { SdkInfo.MarketGroupsDelimiter }, StringSplitOptions.RemoveEmptyEntries); }
internal MarketDescriptionDTO(desc_market description) { Contract.Requires(description != null); Contract.Requires(!string.IsNullOrEmpty(description.name)); Id = description.id; Name = description.name; Description = description.description; Outcomes = description.outcomes?.Select(o => new OutcomeDescriptionDTO(o)).ToList(); Specifiers = description.specifiers?.Select(s => new SpecifierDTO(s)).ToList(); Mappings = description.mappings?.Select(m => new MarketMappingDTO(m)).ToList(); Attributes = description.attributes?.Select(a => new MarketAttributeDTO(a)).ToList(); Variant = description.variant; OutcomeType = mapOutcomeType(description.outcome_type, description.includes_outcomes_of_type); Groups = description.groups?.Split(new[] { SdkInfo.MarketGroupsDelimiter }, StringSplitOptions.RemoveEmptyEntries); }