private static SizeLegendItemDto CreateSizeLegendItem(string label, double size) { var itemDto = new SizeLegendItemDto() { Size = size, Label = label }; return(itemDto); }
protected SizeLegendItemDto CreateNullSizeLegendItem() { var itemDto = new SizeLegendItemDto() { Size = NullSize, Label = "Null" }; return(itemDto); }
private IEnumerable<SizeLegendItemDto> CreateContinuousSizeLegendItems(SizeMap map, double lowerSize, double upperSize) { var unit = (upperSize - lowerSize) / 2; for (var i = 0; i < ContinuousItems; i++) { var itemDto = new SizeLegendItemDto() { Size = lowerSize + (i * unit), Label = GetLabelName((int?) map.MapInverse(i * unit)) }; yield return itemDto; } }
private IEnumerable <SizeLegendItemDto> CreateContinuousSizeLegendItems(SizeMap map, double lowerSize, double upperSize) { var unit = (upperSize - lowerSize) / 2; for (var i = 0; i < ContinuousItems; i++) { var itemDto = new SizeLegendItemDto() { Size = lowerSize + (unit * i), Label = (string)map.MapInverse(i * 0.5d) }; yield return(itemDto); } }
private IEnumerable<SizeLegendItemDto> CreateDiscreteSizeLegendItems(SizeMap map, List<int> values) { if (map.SortOrder == SortOrder.Descending) values.Reverse(); for (var i = 0; i < values.Count(); i++) { var itemDto = new SizeLegendItemDto() { Size = map.Map(values[i]).GetValueOrDefault(), Label = GetLabelName(values[i]) }; yield return itemDto; } }
private IEnumerable <SizeLegendItemDto> CreateDiscreteSizeLegendItems(SizeMap map, List <DateTime> values) { if (map.SortOrder == SortOrder.Descending) { values.Reverse(); } for (var i = 0; i < values.Count(); i++) { var itemDto = new SizeLegendItemDto() { Size = map.Map(values[i]).GetValueOrDefault(), Label = values[i].ToShortDateString() }; yield return(itemDto); } }
public void SetUp() { _values = new List <string> { "test" }; _column = new ColumnBuilder() .WithId(1) .WithDataType(typeof(String)) .WithValue(_values) .Build(); _layout = new ScatterPlotLayoutBuilder() .WithSizeColumn(_column) .WithLowerSize(0d) .WithUpperSize(1d) .Build(); _scatterPlot = new ScatterPlotBuilder() .WithLayout(_layout) .Build(); _map = new FakeSizeMap(); _itemDto = new SizeLegendItemDto(); _mockViewRepository = new Mock <IViewRepository>(); _mockViewRepository.Setup(p => p.Get <ScatterPlot>()) .Returns(_scatterPlot); _mockMapFactory = new Mock <IMapFactory>(); _mockMapFactory.Setup(p => p.CreateSizeMap(_column, _layout.LowerSize, _layout.UpperSize, SortOrder.Ascending)) .Returns(_map); _mockItemFactory = new Mock <ISizeLegendFactory>(); _mockItemFactory.Setup(p => p.Create(_column.DataType, _map, It.IsAny <List <object> >(), _layout.LowerSize, _layout.UpperSize)) .Returns(new List <SizeLegendItemDto> { _itemDto }); _handler = new GetSizeLegendItemsQueryHandler( _mockViewRepository.Object, _mockMapFactory.Object, _mockItemFactory.Object); }
public void SetUp() { _columnDto = new ColumnDto() { Name = "test" }; _itemDto = new SizeLegendItemDto() { Size = 1, Label = "Size 1" }; _mockQueryBus = new Mock <IQueryBus>(); _mockQueryBus.Setup(p => p.Execute(It.IsAny <GetSizeColumnQuery>())) .Returns(_columnDto); _mockQueryBus.Setup(p => p.Execute(It.IsAny <GetSizeLegendItemsQuery>())) .Returns(new List <SizeLegendItemDto> { _itemDto }); _viewModel = new SizeLegendViewModel( _mockQueryBus.Object); }
private void AssertResult(SizeLegendItemDto itemDto, double size, string label) { Assert.That(itemDto.Size, Is.EqualTo(size)); Assert.That(itemDto.Label, Is.EqualTo(label)); }