private void LoadEntityFromFile(bool load = false) { if (_entity == null || load) { var stream = FileHelper.OpenFile(TestData.FeedXmlPath, "bet_settlement.xml"); _record = Deserializer.Deserialize <bet_settlement>(stream); TestData.FillMessageTimestamp(_record); _record.SportId = URN.Parse("sr:sport:1000"); _entity = _mapper.MapBetSettlement <ICompetition>(_record, new[] { TestData.Culture }, null); } }
private void TestEntityValues(IBetSettlement <ICompetition> entity, bet_settlement record, AssertHelper assertHelper) { assertHelper.AreEqual(() => entity.Event.Id.ToString(), record.event_id); var rProduct = TestProducerManager.Create().Get(record.product); assertHelper.AreEqual(() => entity.Producer, rProduct); assertHelper.AreEqual(() => entity.RequestId, record.request_idSpecified ? (long?)record.request_id : null); assertHelper.AreEqual(() => entity.Timestamps.Created, record.timestamp); TestMarketOutcomes(entity.Markets.ToList(), record.outcomes, assertHelper); }
/// <summary> /// Initializes a new instance of the <see cref="OddsChangeEventArgs{T}"/> class /// </summary> /// <param name="messageMapper">A <see cref="IFeedMessageMapper"/> used to map feed message to the one dispatched to the user</param> /// <param name="feedMessage">A <see cref="bet_settlement"/> message received from the feed</param> /// <param name="cultures">A <see cref="IEnumerable{CultureInfo}"/> specifying the default languages to which the received message is translated</param> /// <param name="rawMessage">A raw message received from the feed</param> internal BetSettlementEventArgs(IFeedMessageMapper messageMapper, bet_settlement feedMessage, IEnumerable <CultureInfo> cultures, byte[] rawMessage) { Guard.Argument(messageMapper, nameof(messageMapper)).NotNull(); Guard.Argument(feedMessage, nameof(feedMessage)).NotNull(); Guard.Argument(cultures, nameof(cultures)).NotNull().NotEmpty(); _messageMapper = messageMapper; _feedMessage = feedMessage; _defaultCultures = cultures as IReadOnlyCollection <CultureInfo>; _rawMessage = rawMessage; _betSettlement = GetBetSettlement(); }
/// <summary> /// Initializes a new instance of the <see cref="OddsChangeEventArgs{T}"/> class /// </summary> /// <param name="messageMapper">A <see cref="IFeedMessageMapper"/> used to map feed message to the one dispatched to the user</param> /// <param name="feedMessage">A <see cref="bet_settlement"/> message received from the feed</param> /// <param name="cultures">A <see cref="IEnumerable{CultureInfo}"/> specifying the default languages to which the received message is translated</param> /// <param name="rawMessage">A raw message received from the feed</param> internal BetSettlementEventArgs(IFeedMessageMapper messageMapper, bet_settlement feedMessage, IEnumerable <CultureInfo> cultures, byte[] rawMessage) { Guard.Argument(messageMapper, nameof(messageMapper)).NotNull(); Guard.Argument(feedMessage, nameof(feedMessage)).NotNull(); if (!cultures.Any()) { throw new ArgumentOutOfRangeException(nameof(cultures)); } _messageMapper = messageMapper; _feedMessage = feedMessage; _defaultCultures = cultures as IReadOnlyCollection <CultureInfo>; _rawMessage = rawMessage; _betSettlement = GetBetSettlement(); }