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); }
public void ParsingXmlBooleanReturnsBool(string s, object expected) { // Act bool resultat = XConvert.To <bool>(s); // Assert Assert.AreEqual(expected, resultat); }
public void ParsingDefinedEnumValueReturnsEnumValue(string s) { // Act Fruit value = XConvert.To <Fruit>(s); // Assert Assert.AreEqual(Fruit.Apple, value); }
public void ParsingXmlIntegerReturnsInt(string s, object expected) { // Act int resultat = XConvert.To <int>(s); // Assert Assert.AreEqual(expected, resultat); }
public void ParsingUndefinedEnumValueThrowsException(string s) { // Act XConvert.To <Fruit>(s); }