public void EscapesStrings() { var mapper = new AttributesMappingManager(); var ser = new SolrDocumentSerializer<SampleDoc>(mapper, new DefaultFieldSerializer()); var doc = new SampleDoc {Id = "<quote\""}; string fs = ser.Serialize(doc, null).ToString(SaveOptions.DisableFormatting); Assert.AreEqual("<doc><field name=\"Id\"><quote\"</field><field name=\"Flower\">0</field></doc>", fs); }
public void AcceptsNullObjects() { var mapper = new AttributesMappingManager(); var ser = new SolrDocumentSerializer<SampleDoc>(mapper, new DefaultFieldSerializer()); var doc = new SampleDoc {Id = null}; ser.Serialize(doc, null).ToString(); }
public static async Task <(ICouchbaseCollection collection, string docId, SampleDoc sampleDoc)> PrepSampleDoc(ClusterFixture fixture, ITestOutputHelper outputHelper, [CallerMemberName] string testName = nameof(PrepSampleDoc)) { var defaultCollection = await fixture.OpenDefaultCollection(outputHelper); var docId = Guid.NewGuid().ToString(); var sampleDoc = new SampleDoc(docId, testName, "bar", 100); return(defaultCollection, docId, sampleDoc); }
public void AcceptsNullObjects() { var mapper = new AttributesMappingManager(); var ser = new SolrDocumentSerializer <SampleDoc>(mapper, new DefaultFieldSerializer()); var doc = new SampleDoc { Id = null }; ser.Serialize(doc, null).ToString(); }
public void Serializes() { var mapper = new AttributesMappingManager(); var ser = new SolrDocumentSerializer<SampleDoc>(mapper, new DefaultFieldSerializer()); var doc = new SampleDoc {Id = "id", Dd = 23.5m}; string fs = ser.Serialize(doc, null).OuterXml; var xml = new XmlDocument(); xml.LoadXml(fs); Assert.AreEqual("<doc><field name=\"Id\">id</field><field name=\"Flower\">23.5</field></doc>", fs); }
public void AcceptsNullObjects() { var mapper = new AttributesMappingManager(); var ser = new SolrDocumentSerializer<SampleDoc>(mapper, new DefaultFieldSerializer()); var doc = new SampleDoc {Id = null}; string fs = ser.Serialize(doc, null).OuterXml; Console.WriteLine(fs); var xml = new XmlDocument(); xml.LoadXml(fs); }
public void EscapesStrings() { var mapper = new AttributesMappingManager(); var ser = new SolrDocumentSerializer <SampleDoc>(mapper, new DefaultFieldSerializer()); var doc = new SampleDoc { Id = "<quote\"" }; string fs = ser.Serialize(doc, null).ToString(SaveOptions.DisableFormatting); Assert.Equal("<doc><field name=\"Id\"><quote\"</field><field name=\"Flower\">0</field></doc>", fs); }
public void Serializes() { var mapper = new AttributesMappingManager(); var ser = new SolrDocumentSerializer <SampleDoc>(mapper, new DefaultFieldSerializer()); var doc = new SampleDoc { Id = "id", Dd = 23.5m }; string fs = ser.Serialize(doc, null).ToString(SaveOptions.DisableFormatting); Assert.Equal("<doc><field name=\"Id\">id</field><field name=\"Flower\">23.5</field></doc>", fs); }
public void EscapesStrings() { var mapper = new AttributesMappingManager(); var ser = new SolrDocumentSerializer<SampleDoc>(mapper, new DefaultFieldSerializer()); var doc = new SampleDoc {Id = "<quote\""}; string fs = ser.Serialize(doc, null).OuterXml; Console.WriteLine(fs); var xml = new XmlDocument(); xml.LoadXml(fs); Assert.AreEqual("<doc><field name=\"Id\"><quote\"</field><field name=\"Flower\">0</field></doc>", fs); }
public void Serializes() { var mapper = new AttributesMappingManager(); var ser = new SolrDocumentSerializer <SampleDoc>(mapper, new DefaultFieldSerializer()); var doc = new SampleDoc { Id = "id", Dd = 23.5m }; string fs = ser.Serialize(doc, null).OuterXml; var xml = new XmlDocument(); xml.LoadXml(fs); Assert.AreEqual("<doc><field name=\"Id\">id</field><field name=\"Flower\">23.5</field></doc>", fs); }
public void AcceptsNullObjects() { var mapper = new AttributesMappingManager(); var ser = new SolrDocumentSerializer <SampleDoc>(mapper, new DefaultFieldSerializer()); var doc = new SampleDoc { Id = null }; string fs = ser.Serialize(doc, null).OuterXml; Console.WriteLine(fs); var xml = new XmlDocument(); xml.LoadXml(fs); }
public void EscapesStrings() { var mapper = new AttributesMappingManager(); var ser = new SolrDocumentSerializer <SampleDoc>(mapper, new DefaultFieldSerializer()); var doc = new SampleDoc { Id = "<quote\"" }; string fs = ser.Serialize(doc, null).OuterXml; Console.WriteLine(fs); var xml = new XmlDocument(); xml.LoadXml(fs); Assert.AreEqual("<doc><field name=\"Id\"><quote\"</field><field name=\"Flower\">0</field></doc>", fs); }
public void TestLazyQuery() { var doc = new SampleDoc { Number = DateTime.Now.Ticks, Name = "Test1" }; using (GetNewServer()) using (var store = new DocumentStore { Url = "http://localhost:8079" }.Initialize()) { using (var session = store.OpenSession()) { session.Store(doc); session.SaveChanges(); } using (var session = store.OpenSession()) { RavenQueryStatistics stat1; var q = session.Query <SampleDoc>() .Customize(x => x.WaitForNonStaleResults()) .Statistics(out stat1) .Where(x => x.Number == doc.Number); var query1 = q .Lazily(); Assert.Equal(query1.Value.Count(), 1); Assert.Equal(stat1.TotalResults, 1); RavenQueryStatistics stat2; var query2 = session.Query <SampleDoc>() .Customize(x => x.WaitForNonStaleResults()) .Statistics(out stat2).Where(x => x.Number == doc.Number) .Select(x => new { x.Name }) .Lazily(); Assert.Equal(query2.Value.ToList().Count, 1); Assert.Equal(stat2.TotalResults, 1); } } }