public void ensureFromCollectionWithUnitThrowsExceptionIfElementIsNull()
        {
            double minValue  = 20;
            double maxValue  = 60;
            double increment = 2;

            Dimension continuousDimensionInterval = new ContinuousDimensionInterval(minValue, maxValue, increment);

            List <double> values = new List <double>()
            {
                21, 35, 42
            };

            Dimension discreteDimensionInterval = new DiscreteDimensionInterval(values);

            Dimension nullDimension = null;

            IEnumerable <Dimension> dimensions = new List <Dimension>()
            {
                continuousDimensionInterval, discreteDimensionInterval, nullDimension
            };

            string unit = "m";

            Action fromCollection = () => DimensionModelViewService.fromCollection(dimensions, unit);

            Assert.Throws <ArgumentNullException>(fromCollection);
        }
        public void ensureFromCollectionThrowsExceptionIfEnumerableIsNull()
        {
            IEnumerable <Dimension> dimensions = null;

            Action fromCollection = () => DimensionModelViewService.fromCollection(dimensions);

            Assert.Throws <ArgumentNullException>(fromCollection);
        }
        public void ensureFromCollectionWithEmptyUnitUsesMinimumUnit()
        {
            double    minValue  = 20;
            double    maxValue  = 60;
            double    increment = 2;
            Dimension continuousDimensionInterval = new ContinuousDimensionInterval(minValue, maxValue, increment);

            List <double> values = new List <double>()
            {
                21, 35, 42
            };
            Dimension discreteDimensionInterval = new DiscreteDimensionInterval(values);

            double    value = 72;
            Dimension singleValueDimension = new SingleValueDimension(value);

            IEnumerable <Dimension> dimensions = new List <Dimension>()
            {
                continuousDimensionInterval, discreteDimensionInterval, singleValueDimension
            };

            GetAllDimensionsModelView getAllDimensionsModelView = DimensionModelViewService.fromCollection(dimensions, "");

            string minimumUnit = MeasurementUnitService.getMinimumUnit();

            GetContinuousDimensionIntervalModelView continuousDimensionIntervalModelView = new GetContinuousDimensionIntervalModelView();

            continuousDimensionIntervalModelView.minValue  = minValue;
            continuousDimensionIntervalModelView.maxValue  = maxValue;
            continuousDimensionIntervalModelView.increment = increment;
            continuousDimensionIntervalModelView.unit      = minimumUnit;


            GetDiscreteDimensionIntervalModelView discreteDimensionIntervalModelView = new GetDiscreteDimensionIntervalModelView();

            discreteDimensionIntervalModelView.values = values;
            discreteDimensionIntervalModelView.unit   = minimumUnit;


            GetSingleValueDimensionModelView singleValueDimensionModelView = new GetSingleValueDimensionModelView();

            singleValueDimensionModelView.value = value;
            singleValueDimensionModelView.unit  = minimumUnit;

            GetAllDimensionsModelView expected = new GetAllDimensionsModelView()
            {
                continuousDimensionIntervalModelView, discreteDimensionIntervalModelView, singleValueDimensionModelView
            };

            for (int i = 0; i < 3; i++)
            {
                Assert.True(equalModelViews(getAllDimensionsModelView[i], expected[i]));
            }
        }