Beispiel #1
0
 internal void AddFieldValue(object value)
 {
     if (value is int || value is long || value is double)
     {
         if (NumericValues == null)
         {
             NumericValues = new List <double>();
         }
         NumericValues.Add(Convert.ToDouble(value));
         FieldType = FieldType.Number;
     }
     else if (value is DateTime)
     {
         if (DateTimeValues == null)
         {
             DateTimeValues = new List <DateTime>();
         }
         DateTimeValues.Add((DateTime)value);
         FieldType = FieldType.Date;
     }
     else
     {
         if (Values == null)
         {
             Values = new List <string>();
         }
         Values.Add(value.ToString());
         FieldType = FieldType.Text;
     }
 }
Beispiel #2
0
        public void Write_NumericValues_NaN()
        {
            var obj = new NumericValues
            {
                DoubleValue = double.NaN,
                FloatValue  = float.NaN
            };

            Assert.AreEqual(ReadXml("NumericValues_NaN.xml").Trim(), XamlServices.Save(obj), "#1");
        }
Beispiel #3
0
        public void Write_NumericValues_NegativeInfinity()
        {
            var obj = new NumericValues
            {
                DoubleValue = double.NegativeInfinity,
                FloatValue  = float.NegativeInfinity
            };

            Assert.AreEqual(ReadXml("NumericValues_NegativeInfinity.xml").Trim(), XamlServices.Save(obj), "#1");
        }
        public void Subtract_GivenTwoIntValues_Returns_Int()
        {
            //Arrange
            var myNumbers = new NumericValues();

            //Act
            var result = myNumbers.Subtract(6, 4);

            //Assert
            Assert.Equal(2, result);
        }
        public void Multiply_GivenTwoIntValues_Returns_Int()
        {
            //Arrange
            var myNumbers = new NumericValues();

            //Act
            var result = myNumbers.Multiply(2, 3);

            //Assert
            Assert.Equal(6, result);
        }
        public void Add_GivenTwoDoubleValues_Returns_Double()
        {
            //Arrange
            var myNumbers = new NumericValues();

            //Act
            var result = myNumbers.AddDouble(1.2, 4.5);

            //Assert
            Assert.Equal(5.7, result);
        }
        public void Add_GivenTwoIntValues_Returns_Int()
        {
            //Arrange
            var myNumbers = new NumericValues();

            //Act
            var result = myNumbers.Add(1, 2);

            //Assert
            Assert.Equal(3, result);
        }
        public void Add5_Age_Property_Returns_5_More_From_original_Value()
        {
            //Arrange
            var myNumbers = new NumericValues();

            //Act
            var startingAge  = myNumbers.Age;
            var incrementAge = myNumbers.Add5ToAge();

            //Assert
            Assert.Equal(startingAge + 5, incrementAge);
        }
        public void Decrement_Age_Property_Returns_One_Less_From_original_Value()
        {
            //Arrange
            var myNumbers = new NumericValues();

            //Act
            var startingAge  = myNumbers.Age;
            var decramentAge = myNumbers.DecrementAge();

            //Assert
            Assert.Equal(startingAge - 1, decramentAge);
        }
Beispiel #10
0
        public void Write_NumericValues_Max()
        {
            var obj = new NumericValues
            {
                DoubleValue  = double.MaxValue,
                DecimalValue = decimal.MaxValue,
                FloatValue   = float.MaxValue,
                ByteValue    = byte.MaxValue,
                IntValue     = int.MaxValue,
                LongValue    = long.MaxValue
            };

            Assert.AreEqual(ReadXml("NumericValues_Max.xml").Trim(), XamlServices.Save(obj), "#1");
        }
Beispiel #11
0
        public void Write_NumericValues()
        {
            var obj = new NumericValues
            {
                DoubleValue  = 123.456,
                DecimalValue = 234.567M,
                FloatValue   = 345.678f,
                ByteValue    = 123,
                IntValue     = 123456,
                LongValue    = 234567
            };

            Assert.AreEqual(ReadXml("NumericValues.xml").Trim(), XamlServices.Save(obj), "#1");
        }
Beispiel #12
0
 public Card(string input)
 {
     _suite        = Suites.FromString(input[1].ToString());
     _numericValue = NumericValues.FromString(input[0].ToString());
 }