public void Export_Omits_Field_If_Not_Provided() { var query = new TermQuery("theterm") .PrefixLength(5) .Fuzziness(1); var expected = JsonConvert.SerializeObject(new { term = "theterm", prefix_length = 5, fuzziness = 1 }, Formatting.None); Assert.AreEqual(expected, query.Export().ToString(Formatting.None)); }
public void Export_ReturnsValidJson() { var query = new TermQuery("theterm") .Field("field") .PrefixLength(5) .Fuzziness(1); var expected = JsonConvert.SerializeObject(new { term = "theterm", prefix_length = 5, fuzziness = 1, field = "field" }, Formatting.None); Assert.AreEqual(expected, query.Export().ToString(Formatting.None)); }
public void Fuzziness_WhenLessThanZero_ThrowsArgumentOutOfRangeException() { var query = new TermQuery("theterm"); Assert.Throws<ArgumentOutOfRangeException>(() => query.Fuzziness(-1)); }
public void PrefixLength_WhenLessThanZero_ThrowsArgumentOutOfRangeException() { var query = new TermQuery("theterm"); Assert.Throws<ArgumentOutOfRangeException>(() => query.PrefixLength(-1)); }
public void Boost_WhenBoostIsLessThanZero_ThrowsArgumentOutOfRangeException() { var query = new TermQuery("theterm"); Assert.Throws<ArgumentOutOfRangeException>(() => query.Boost(-.1)); }
public void Boost_ReturnsFuzzyQuery() { var query = new TermQuery("theterm").Boost(2.2); Assert.IsInstanceOf<TermQuery> (query); }