public IUpdatableMarketState Clone() { MarketState clone = new MarketState { Id = this.Id, HasBeenActive = this.HasBeenActive, HasBeenProcessed = this.HasBeenProcessed, IsTradedInPlay = this.IsTradedInPlay, IsRollingMarket = this.IsRollingMarket, IsDeleted = this.IsDeleted, Line = this.Line, Index = this.Index, IsForcedSuspended = this.IsForcedSuspended }; foreach (var key in this.TagKeys) { clone._tags.Add(key, this.GetTagValue(key)); } foreach (var seln in this._selectionStates.Values) { clone._selectionStates.Add(seln.Id, seln.Clone()); } return(clone); }
public void WhenIInferTheMarketSStatus() { if (!ScenarioContext.Current.ContainsKey("Market")) return; Market market = ScenarioContext.Current["Market"] as Market; MarketState state = new MarketState(market, true); }
public void Update(Fixture fixture, bool fullSnapshot) { FixtureSequence = fixture.Sequence; FixtureName = fixture.FixtureName; FixtureStatus = (MatchStatus)Enum.Parse(typeof(MatchStatus), fixture.MatchStatus); if (fullSnapshot) { if (fixture.Tags.ContainsKey("Sport")) { Sport = fixture.Tags["Sport"].ToString(); } var marketsLookUp = fixture.Markets.ToDictionary(m => m.Id); //if market doesn't exist in the snapshot the definition must have been changed Markets.Where(marketId => !marketsLookUp.ContainsKey(marketId)).ForEach(marketId => this[marketId].IsDeleted = true); } _processed = new Dictionary <string, IUpdatableMarketState>(); foreach (var market in fixture.Markets) { IUpdatableMarketState mkt_state = null; if (HasMarket(market.Id)) { mkt_state = this[market.Id] as IUpdatableMarketState; mkt_state.Update(market, fullSnapshot); } else { mkt_state = new MarketState(market, fullSnapshot); ((MarketState)mkt_state).Index = _States.Count; this[market.Id] = mkt_state; } _processed.Add(market.Id, mkt_state); } }
public void Update(Fixture fixture, bool fullSnapshot) { FixtureSequence = fixture.Sequence; FixtureName = fixture.FixtureName; FixtureStatus = (MatchStatus) Enum.Parse(typeof (MatchStatus), fixture.MatchStatus); if (fullSnapshot) { if(fixture.Tags.ContainsKey("Sport")) Sport = fixture.Tags["Sport"].ToString(); var marketsLookUp = fixture.Markets.ToDictionary(m => m.Id); //if market doesn't exist in the snapshot the definition must have been changed Markets.Where(marketId => !marketsLookUp.ContainsKey(marketId)).ForEach(marketId => this[marketId].IsDeleted = true); } _processed = new Dictionary<string, IUpdatableMarketState>(); foreach (var market in fixture.Markets) { IUpdatableMarketState mkt_state = null; if (HasMarket(market.Id)) { mkt_state = this[market.Id] as IUpdatableMarketState; mkt_state.Update(market, fullSnapshot); } else { mkt_state = new MarketState(market, fullSnapshot); ((MarketState)mkt_state).Index = _States.Count; this[market.Id] = mkt_state; } _processed.Add(market.Id, mkt_state); } }
public IUpdatableMarketState Clone() { MarketState clone = new MarketState { Id = this.Id, HasBeenActive = this.HasBeenActive, HasBeenProcessed = this.HasBeenProcessed, IsTradedInPlay = this.IsTradedInPlay, IsRollingMarket = this.IsRollingMarket, IsDeleted = this.IsDeleted, Line = this.Line, Index = this.Index, IsForcedSuspended = this.IsForcedSuspended }; foreach(var key in this.TagKeys) clone._tags.Add(key, this.GetTagValue(key)); foreach (var seln in this._selectionStates.Values) clone._selectionStates.Add(seln.Id, seln.Clone()); return clone; }