private Dictionary <int, TrendBreak> GetTrendBreaksMap(int assetId, int timeframeId) { _repository = new EFTrendlineRepository(); IEnumerable <TrendBreakDto> dtos = _repository.GetTrendBreaks(); Dictionary <int, TrendBreak> trendBreaksMap = new Dictionary <int, TrendBreak>(); foreach (var dto in dtos) { var trendBreak = TrendBreak.FromDto(dto); trendBreaksMap.Add(trendBreak.TrendBreakId, trendBreak); } return(trendBreaksMap); }
public void Constructor_fromDto_hasCorrectProperties() { //Act. var TrendBreakDto = new TrendBreakDto() { Id = DEFAULT_ID, TrendlineId = DEFAULT_TRENDLINE_ID, IndexNumber = DEFAULT_INDEX_NUMBER, Guid = DEFAULT_GUID, PreviousRangeGuid = DEFAULT_PREVIOUS_RANGE_GUID, NextRangeGuid = DEFAULT_NEXT_RANGE_GUID }; var trendRange = TrendBreak.FromDto(TrendBreakDto); //Assert. Assert.AreEqual(DEFAULT_ID, trendRange.Id); Assert.AreEqual(DEFAULT_GUID, trendRange.Guid); Assert.AreEqual(DEFAULT_TRENDLINE_ID, trendRange.TrendlineId); Assert.AreEqual(DEFAULT_INDEX_NUMBER, trendRange.IndexNumber); Assert.AreEqual(DEFAULT_PREVIOUS_RANGE_GUID, trendRange.PreviousRangeGuid); Assert.AreEqual(DEFAULT_NEXT_RANGE_GUID, trendRange.NextRangeGuid); }