コード例 #1
0
        public void ParsingXmlDateTimeReturnsDateTime(string s, int year, int month, int day, int hour = 0, int minute = 0, int second = 0, int millisecond = 0)
        {
            // Arrange
            DateTime now = DateTime.Now;

            if (year == Undef)
            {
                year = now.Year;
            }
            if (month == Undef)
            {
                month = now.Month;
            }
            if (day == Undef)
            {
                day = now.Day;
            }

            // Act
            DateTime resultat = XConvert.To <DateTime>(s);

            // Assert
            Assert.AreEqual(year, resultat.Year);
            Assert.AreEqual(month, resultat.Month);
            Assert.AreEqual(day, resultat.Day);
            Assert.AreEqual(hour, resultat.Hour);
            Assert.AreEqual(minute, resultat.Minute);
            Assert.AreEqual(second, resultat.Second);
            Assert.AreEqual(millisecond, resultat.Millisecond);
        }
コード例 #2
0
        public void ParsingXmlBooleanReturnsBool(string s, object expected)
        {
            // Act
            bool resultat = XConvert.To <bool>(s);

            // Assert
            Assert.AreEqual(expected, resultat);
        }
コード例 #3
0
        public void ParsingDefinedEnumValueReturnsEnumValue(string s)
        {
            // Act
            Fruit value = XConvert.To <Fruit>(s);

            // Assert
            Assert.AreEqual(Fruit.Apple, value);
        }
コード例 #4
0
        public void ParsingXmlIntegerReturnsInt(string s, object expected)
        {
            // Act
            int resultat = XConvert.To <int>(s);

            // Assert
            Assert.AreEqual(expected, resultat);
        }
コード例 #5
0
 public void ParsingUndefinedEnumValueThrowsException(string s)
 {
     // Act
     XConvert.To <Fruit>(s);
 }