Ejemplo n.º 1
0
        public void TestAddSingleField_Stored()
        {
            SingleField field  = null;
            float       value  = 123.456f;
            var         stored = Field.Store.YES;

            AssertDocumentExtensionAddsToDocument(document => field = document.AddSingleField("theName", value, stored));
            Assert.AreEqual("theName", field.Name);
            Assert.AreEqual(value, field.GetSingleValueOrDefault(), 0.0000001f); // We don't really care about precision, just checking to see if the value got passed through
            Assert.AreSame(SingleField.TYPE_STORED, field.FieldType);
        }
Ejemplo n.º 2
0
        public void TestAddSingleField_FieldType()
        {
            SingleField field     = null;
            float       value     = 123.456f;
            var         fieldType = new FieldType
            {
                IsIndexed    = true,
                IsTokenized  = true,
                OmitNorms    = false,
                IndexOptions = IndexOptions.DOCS_ONLY,
                NumericType  = NumericType.SINGLE,
                IsStored     = true
            }.Freeze();

            AssertDocumentExtensionAddsToDocument(document => field = document.AddSingleField("theName", value, fieldType));
            Assert.AreEqual("theName", field.Name);
            Assert.AreEqual(value, field.GetSingleValueOrDefault(), 0.0000001f); // We don't really care about precision, just checking to see if the value got passed through
            Assert.AreSame(fieldType, field.FieldType);
        }