public void ensureToDTOWithNullUnitStringDefaultsToMilimetres()
        {
            var values = new List <double>()
            {
                12.5, 13, 13.5, 14, 14.5, 15, 16, 17
            };

            DiscreteDimensionInterval    instance = new DiscreteDimensionInterval(values);
            DiscreteDimensionIntervalDTO dto      = (DiscreteDimensionIntervalDTO)instance.toDTO(null);

            Assert.Equal("mm", dto.unit);
        }
Esempio n. 2
0
        public void testToEntity()
        {
            long id   = 5;
            var  list = new List <double>();

            list.Add(30.5);
            DiscreteDimensionIntervalDTO instance = new DiscreteDimensionIntervalDTO();
            DiscreteDimensionIntervalDTO other    = new DiscreteDimensionIntervalDTO();

            instance.id     = id;
            instance.values = list;
            other.id        = id;
            other.values    = list;

            Assert.Equal(instance.toEntity(), other.toEntity());
        }
        public void ensureToDTOConvertsValuesToGivenUnit()
        {
            var values = new List <double>()
            {
                12.5, 13, 13.5, 14, 14.5, 15, 16, 17
            };

            DiscreteDimensionInterval    instance = new DiscreteDimensionInterval(values);
            DiscreteDimensionIntervalDTO dto      = (DiscreteDimensionIntervalDTO)instance.toDTO("cm");

            var expectedValues = new List <double>()
            {
                1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.6, 1.7
            };

            Assert.Equal(expectedValues, dto.values);
        }
        public void ensureToDTOWithNullStringDoesNotConvertValues()
        {
            var values = new List <double>()
            {
                12.5, 13, 13.5, 14, 14.5, 15, 16, 17
            };

            DiscreteDimensionInterval    instance = new DiscreteDimensionInterval(values);
            DiscreteDimensionIntervalDTO dto      = (DiscreteDimensionIntervalDTO)instance.toDTO(null);

            var expectedValues = new List <double>()
            {
                12.5, 13, 13.5, 14, 14.5, 15, 16, 17
            };

            Assert.Equal(expectedValues, dto.values);
        }