public void GivenWithTheFixedIncomeIntradayMarketData(Table intradayMarketDataTable) { if (this._universeSelectionState.SelectedUniverse == null || intradayMarketDataTable == null) { this._scenarioContext.Pending(); return; } var eventList = new List <IUniverseEvent>(); var intradayMarketDataParams = intradayMarketDataTable.CreateSet <IntradayMarketDataParameters>(); foreach (var row in intradayMarketDataParams) { var proRow = this.MapRowToFixedIncomeIntradayMarketDataEvent(row); if (proRow == null) { continue; } eventList.Add(proRow); } var otherEvents = this._universeSelectionState.SelectedUniverse.UniverseEvents.ToList(); otherEvents.AddRange(eventList); var comparer = new UniverseEventComparer(); var orderedUniverse = otherEvents.OrderBy(x => x, comparer).ToList(); this._universeSelectionState.SelectedUniverse = new Universe(orderedUniverse); }
public void Do_TwoNullEvents_ReturnEqual() { IUniverseEvent x = null; IUniverseEvent y = null; var comparer = new UniverseEventComparer(); var result = comparer.Compare(x, y); Assert.AreEqual(result, 0); }
public void Do_XNullEvent_ReturnLess() { IUniverseEvent x = null; IUniverseEvent y = new UniverseEvent(UniverseStateEvent.Genesis, DateTime.UtcNow, new object()); var comparer = new UniverseEventComparer(); var result = comparer.Compare(x, y); Assert.AreEqual(result, -1); }
public void Do_X_ReturnExpected_ToY_OnSameDate(UniverseStateEvent xe, UniverseStateEvent ye, int expected) { var eventDate = DateTime.UtcNow; var x = new UniverseEvent(xe, eventDate, new object()); var y = new UniverseEvent(ye, eventDate, new object()); var comparer = new UniverseEventComparer(); var result = comparer.Compare(x, y); Assert.AreEqual(result, expected); }
public void Do_XDateSucceedY_ReturnMore() { IUniverseEvent x = new UniverseEvent( UniverseStateEvent.Genesis, DateTime.UtcNow.AddMinutes(5), new object()); IUniverseEvent y = new UniverseEvent(UniverseStateEvent.Genesis, DateTime.UtcNow, new object()); var comparer = new UniverseEventComparer(); var result = comparer.Compare(x, y); Assert.AreEqual(result, 1); }