public void CopyToDocument() { CustomValueType = new SampleValueType {TheValue = 1.34d}; var mapper = CreateMapper(); var doc = new Document(); mapper.CopyToDocument(this, doc); Assert.That(doc.GetFieldable("CustomValueType").TokenStreamValue.ToString(), Is.EqualTo("(numeric,valSize=64,precisionStep=4)")); Assert.That(doc.GetFieldable("CustomValueType").StringValue, Is.EqualTo(CustomValueType.TheValue.ToString())); }
public void CopyFromDocument() { CustomValueType = null; var mapper = CreateMapper(); var doc = new Document(); doc.Add(new Field("CustomValueType", "2.68", Field.Store.YES, Field.Index.NO)); mapper.CopyFromDocument(doc, 0, this); Assert.That(CustomValueType, Is.Not.Null); Assert.That(CustomValueType.TheValue, Is.EqualTo(2.68d)); }
public void CopyToDocument() { CustomValueType = new SampleValueType { TheValue = 1.34d }; var mapper = CreateMapper(); var doc = new Document(); mapper.CopyToDocument(this, doc); Assert.That(doc.GetFieldable("CustomValueType").TokenStreamValue.ToString(), Is.EqualTo("(numeric,valSize=64,precisionStep=4)")); Assert.That(doc.GetFieldable("CustomValueType").StringValue, Is.EqualTo(CustomValueType.TheValue.ToString())); }
public void CopyFromDocument() { var value = 2.68d; CustomValueType = null; var mapper = CreateMapper(); var doc = new Document(); doc.Add(new Field("CustomValueType", value.ToString(), Field.Store.YES, Field.Index.NO)); mapper.CopyFromDocument(doc, new QueryExecutionContext(), this); Assert.That(CustomValueType, Is.Not.Null); Assert.That(CustomValueType.TheValue, Is.EqualTo(value)); }