public void TestAddDoubleField_Stored() { DoubleField field = null; double value = 123.456d; var stored = Field.Store.YES; AssertDocumentExtensionAddsToDocument(document => field = document.AddDoubleField("theName", value, stored)); Assert.AreEqual("theName", field.Name); Assert.AreEqual(value, field.GetDoubleValueOrDefault(), 0.0000001d); // We don't really care about precision, just checking to see if the value got passed through Assert.AreSame(DoubleField.TYPE_STORED, field.FieldType); }
public void TestAddDoubleField_FieldType() { DoubleField field = null; double value = 123.456d; var fieldType = new FieldType { IsIndexed = true, IsTokenized = true, OmitNorms = false, IndexOptions = IndexOptions.DOCS_ONLY, NumericType = NumericType.DOUBLE, IsStored = true }.Freeze(); AssertDocumentExtensionAddsToDocument(document => field = document.AddDoubleField("theName", value, fieldType)); Assert.AreEqual("theName", field.Name); Assert.AreEqual(value, field.GetDoubleValueOrDefault(), 0.0000001d); // We don't really care about precision, just checking to see if the value got passed through Assert.AreSame(fieldType, field.FieldType); }