public void DoubleN_MinMax()
        {
            BVector d     = new BVector();
            double? max   = double.MaxValue;
            double? min   = double.MinValue;
            double? zero  = (double)0;
            double? @null = null;


            d.Add(max);
            d.Add1(false);
            d.Add(@null);
            d.Add1(true);
            d.Add(zero);
            d.Add1(false);
            d.Add(min);

            Assert.AreEqual(max, d.GetDoubleN());
            Assert.AreEqual(false, d.Get1());
            Assert.AreEqual(@null, d.GetDoubleN());
            Assert.AreEqual(true, d.Get1());
            Assert.AreEqual(zero, d.GetDoubleN());
            Assert.AreEqual(false, d.Get1());
            Assert.AreEqual(min, d.GetDoubleN());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Reads the next random value added by <see cref="WriteRandomValue(BVector)"/>
        /// </summary>
        /// <param name="d"></param>
        /// <returns></returns>
        public static object ReadNextRandomValue(BVector d)
        {
            bool nullable  = d.Get1();
            byte valueType = d.Get8();

            switch (valueType)
            {
            case 0:
                if (nullable)
                {
                    return(d.GetIntN());
                }
                return(d.GetInt());

            case 1:
                if (nullable)
                {
                    return(d.GetLongN());
                }
                return(d.GetLong());

            case 2:
                if (nullable)
                {
                    return(d.GetShortN());
                }
                return(d.GetShort());

            case 3:
                if (nullable)
                {
                    return(d.GetByteN());
                }
                return(d.GetByte());

            case 4:
                return(d.GetString());

            case 5:
                return(d.GetAscii());

            case 6:
                if (nullable)
                {
                    return(d.GetDateTimeN());
                }
                return(d.GetDateTime());

            case 7:
                if (nullable)
                {
                    return(d.GetDecimalN());
                }
                return(d.GetDecimal());

            case 8:
                if (nullable)
                {
                    return(d.GetDoubleN());
                }
                return(d.GetDouble());

            case 9:
                return(d.Get1());

            case 10:
                return(d.GetTimeSpan());

            case 11:
                return(d.GetByteArray());
            }
            return(null);
        }