Exemplo n.º 1
0
        public void RoundTrip(DateTime dt)
        {
            var value = DateTimeFieldParser.ParseDate(DateTimeFieldSerializer.SerializeDate(dt));

            Assert.AreEqual(dt, value);
            Assert.AreEqual(dt.Kind, value.Kind);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
0
 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;
     }));
 }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
 public FacetIntervalSetValue(DateTime value, bool inclusive = false) : this(DateTimeFieldSerializer.SerializeDate(value), inclusive)
 {
 }
Exemplo n.º 7
0
 /// <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)
 {
 }