Skip to content

Commit

Permalink
fixed some tests for 0.90.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Mpdreamz committed Oct 10, 2013
1 parent d708e9b commit 7959e4a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Nest.Tests.Integration/Core/Bulk/BulkPercolateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void BulkIndexWithPercolate()
.Term(f => f.Country, "netherlands")
)
);

this._client.Refresh<ElasticSearchProject>();
var descriptor = new BulkDescriptor();

// match against any doc
Expand Down Expand Up @@ -54,7 +54,7 @@ public void BulkIndexWithPercolate()
indexResponses.ElementAt(1).Id.Should().BeEquivalentTo("3");
indexResponses.ElementAt(1).Index.Should().BeEquivalentTo(ElasticsearchConfiguration.DefaultIndex);
indexResponses.ElementAt(1).Type.Should().BeEquivalentTo(this._client.Infer.TypeName<ElasticSearchProject>());
indexResponses.First().Matches.Should().BeNull();
indexResponses.ElementAt(1).Matches.Should().BeNull();

// cleanup
this._client.UnregisterPercolator<ElasticSearchProject>(query1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ public void BooleanProperty()
.Boolean(s => s
.Name(p => p.BoolValue) //reminder .Name(string) exists too!
.Boost(1.4)
.IncludeInAll()
.Index()
//.IncludeInAll() //makes no sense
//.Index() //since 0.90.5 this will throw an exception on elasticsearch.
.IndexName("bool_name_in_lucene_index")
.NullValue(false)
.Store()
Expand Down
2 changes: 1 addition & 1 deletion src/Nest.Tests.Integration/Search/PercolateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void PercolateTypedDocWithQuery()
Assert.True(percolateResponse.IsValid);
Assert.True(percolateResponse.OK);
Assert.NotNull(percolateResponse.Matches);
Assert.True(percolateResponse.Matches.Contains(name));
Assert.True(percolateResponse.Matches.Contains(name), percolateResponse.Matches.Count().ToString());

//should not match since we registered with the color blue
percolateResponse = this._client.Percolate<ElasticSearchProject>(p => p
Expand Down
9 changes: 7 additions & 2 deletions src/Nest.Tests.Integration/Search/QueryDSLTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,12 @@ public void TestPartialFields()
[Test]
public void TermSuggest()
{
var country = this._client.Search<ElasticSearchProject>(s => s.Size(1)).Documents.First().Country;
var wrongCountry = country + "x";

var results = this._client.Search<ElasticSearchProject>(s => s
.Query(q => q.MatchAll())
.TermSuggest("mySuggest", m => m.SuggestMode(SuggestMode.Always).Text("Sanskrti").Size(1).OnField("country"))
.TermSuggest("mySuggest", m => m.SuggestMode(SuggestMode.Always).Text(wrongCountry).Size(1).OnField("country"))
);

Assert.NotNull(results);
Expand All @@ -163,7 +166,9 @@ public void TermSuggest()
Assert.NotNull(results.Suggest.Values.First().First().Options);
Assert.GreaterOrEqual(results.Suggest.Values.First().First().Options.Count(), 1);

Assert.AreEqual(results.Suggest.Values.First().First().Options.First().Text, "Sanskrit");
Assert.AreEqual(results.Suggest.Values.First().First().Options.First().Text, country);

Assert.AreEqual(results.Suggest["mySuggest"].First().Options.First().Text, country);
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void BogusQuery()
Assert.False(queryResults.IsValid);
var error = queryResults.ConnectionStatus.Error;
Assert.NotNull(error);
Assert.True(error.HttpStatusCode == System.Net.HttpStatusCode.InternalServerError);
Assert.True(error.HttpStatusCode == System.Net.HttpStatusCode.BadRequest, error.HttpStatusCode.ToString());
}

[Test]
Expand Down

0 comments on commit 7959e4a

Please sign in to comment.