public void RoundTrip(DateTime dt) { var value = DateTimeFieldParser.ParseDate(DateTimeFieldSerializer.SerializeDate(dt)); Assert.AreEqual(dt, value); Assert.AreEqual(dt.Kind, value.Kind); }
public void RoundTripUtcDateTime(int year, int month, int day, int hour, int minute, int second, int milliseconds = 0) { var date = new DateTime(year, month, day, hour, minute, second, milliseconds, DateTimeKind.Utc); var value = DateTimeFieldParser.ParseDate(DateTimeFieldSerializer.SerializeDate(date)); Assert.AreEqual(date, value); Assert.AreEqual(date.Kind, value.Kind); }
public void RoundTrip(DateTime dt) { var parser = new DateTimeFieldParser(); var serializer = new DateTimeFieldSerializer(); var s = serializer.SerializeDate(dt); Console.WriteLine(s); var value = parser.ParseDate(s); Console.WriteLine(value.ToString("r")); Assert.AreEqual(dt, value); }
public static IEnumerable <Test> RoundTrip() { return(dateTimes.Select(dt => { Test t = new TestCase("RoundTrip " + dt, () => { var value = DateTimeFieldParser.ParseDate(DateTimeFieldSerializer.SerializeDate(dt)); Assert.AreEqual(dt, value); }); return t; })); }
public void RoundTrip(DateTime dt) { var parser = new DateTimeFieldParser(); var serializer = new DateTimeFieldSerializer(); var s = serializer.SerializeDate(dt); Console.WriteLine(s); var value = parser.ParseDate(s); Console.WriteLine(value.ToString("r")); Assert.AreEqual(dt, value); }
public FacetIntervalSetValue(DateTime value, bool inclusive = false) : this(DateTimeFieldSerializer.SerializeDate(value), inclusive) { }
/// <summary> /// Creates a date facet query /// </summary> /// <param name="field">Field to facet</param> /// <param name="start">The start parameter specifies the lower bound of the ranges</param> /// <param name="end">The facet.range.end specifies the upper bound of the ranges.</param> /// <param name="gap"> /// The span of each range expressed as a value to be added to the lower bound. For date fields, this should be expressed using the DateMathParser syntax. /// <see href="https://lucene.apache.org/solr/6_6_0//solr-core/org/apache/solr/util/DateMathParser.html"/> /// </param> public SolrFacetRangeQuery(string field, DateTime start, DateTime end, string gap) : this(field, DateTimeFieldSerializer.SerializeDate(start), DateTimeFieldSerializer.SerializeDate(end), gap) { }