public void ThrowsWhenScaleMinLowerThanDataMin()
 {
     ColonLabelHelper.Add(new DataItem {
         Value = -100
     });
     ColonLabelHelper.EnsureBestLabels();
 }
示例#2
0
        public void IsCorrectDecision(int[] input, LabelPosition[] expected)
        {
            foreach (var value in input)
            {
                var dataItem = new DataItem {
                    Value = value
                };
                dataItem.NormalizedValue = BrickDataSetHelper.GetNormalizedValue(ScaleMin, ScaleMax, Height, dataItem.Value);
                ColonLabelHelper.Add(dataItem);
            }
            ColonLabelHelper.EnsureBestLabels();
            var orderedPositions = ColonLabelHelper.GetOrderedItems().ToArray();

            Assert.AreEqual(orderedPositions.Length, expected.Length);
            for (var i = 0; i < expected.Length; i++)
            {
                Assert.AreEqual(expected[i], orderedPositions[i].LabelPosition);
            }
        }
 public void Case1()
 {
     ColonLabelHelper.Height      = 237;
     ColonLabelHelper.ScaleMin    = 800000;
     ColonLabelHelper.ScaleMax    = 1800000;
     ColonLabelHelper.LabelHeight = 36;
     ColonLabelHelper.Order       = ColonDataItemOrder.Real;
     ColonLabelHelper.Add(new DataItem {
         Value = 1600000, LabelPosition = LabelPosition.Above
     });
     ColonLabelHelper.Add(new DataItem {
         Value = 1557686, LabelPosition = LabelPosition.Above
     });
     ColonLabelHelper.Add(new DataItem {
         Value = 1387940, LabelPosition = LabelPosition.Above
     });
     ColonLabelHelper.EnsureBestLabels();
     foreach (var orderedItem in ColonLabelHelper.GetOrderedItems())
     {
         Console.WriteLine("Value: {0}, Position: {1}", orderedItem.Value, orderedItem.LabelPosition);
     }
 }