Skip to content

Commit

Permalink
Upgraded deprecated sync test method.
Browse files Browse the repository at this point in the history
  • Loading branch information
niemyjski committed Sep 13, 2024
1 parent af1f553 commit 001bce4
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public AggregationParserTests(ITestOutputHelper output, ElasticsearchFixture fix
[Fact]
public async Task ProcessSingleAggregationAsync()
{
string index = CreateRandomIndex<MyType>(d => d.Dynamic(DynamicMapping.True).Properties(p => p.GeoPoint(g => g.Field3)));
string index = await CreateRandomIndexAsync<MyType>(d => d.Dynamic(DynamicMapping.True).Properties(p => p.GeoPoint(g => g.Field3)));
await Client.IndexManyAsync([
new MyType { Field1 = "value1", Field4 = 1, Field3 = "51.5032520,-0.1278990", Field5 = DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(5)), Field2 = "field2" },
new MyType { Field1 = "value2", Field4 = 2, Field3 = "51.5032520,-0.1278990", Field5 = DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(4)) },
Expand Down Expand Up @@ -53,7 +53,7 @@ await Client.IndexManyAsync([
[Fact]
public async Task ProcessSingleAggregationWithAliasAsync()
{
string index = CreateRandomIndex<MyType>(d => d.Dynamic(DynamicMapping.True).Properties(p => p.GeoPoint(g => g.Field3)));
string index = await CreateRandomIndexAsync<MyType>(d => d.Dynamic(DynamicMapping.True).Properties(p => p.GeoPoint(g => g.Field3)));
await Client.IndexManyAsync([
new MyType { Field1 = "value1", Field4 = 1, Field3 = "51.5032520,-0.1278990", Field5 = DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(5)), Field2 = "field2" },
new MyType { Field1 = "value2", Field4 = 2, Field3 = "51.5032520,-0.1278990", Field5 = DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(4)) },
Expand Down Expand Up @@ -85,7 +85,7 @@ await Client.IndexManyAsync([
[Fact]
public async Task ProcessAnalyzedAggregationWithAliasAsync()
{
string index = CreateRandomIndex<MyType>(d => d.Dynamic(DynamicMapping.True).Properties(p => p
string index = await CreateRandomIndexAsync<MyType>(d => d.Dynamic(DynamicMapping.True).Properties(p => p
.Text(f => f.Field1, o => o
.Fields(k => k.Keyword("keyword")))
.FieldAlias(f => f.Name("heynow").Path(k => k.Field1))
Expand Down Expand Up @@ -121,7 +121,7 @@ await Client.IndexManyAsync([
[Fact]
public async Task ProcessAggregationsAsync()
{
string index = CreateRandomIndex<MyType>(d => d.Dynamic(DynamicMapping.True).Properties(p => p.GeoPoint(g => g.Field3)));
string index = await CreateRandomIndexAsync<MyType>(d => d.Dynamic(DynamicMapping.True).Properties(p => p.GeoPoint(g => g.Field3)));
await Client.IndexManyAsync([
new MyType { Field1 = "value1", Field4 = 1, Field3 = "51.5032520,-0.1278990", Field5 = DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(5)), Field2 = "field2" },
new MyType { Field1 = "value2", Field4 = 2, Field3 = "51.5032520,-0.1278990", Field5 = DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(4)) },
Expand Down Expand Up @@ -163,7 +163,7 @@ await Client.IndexManyAsync([
[Fact]
public async Task ProcessNestedAggregationsWithAliasesAsync()
{
string index = CreateRandomIndex<MyType>(d => d.Dynamic(DynamicMapping.True).Properties(p => p
string index = await CreateRandomIndexAsync<MyType>(d => d.Dynamic(DynamicMapping.True).Properties(p => p
.GeoPoint(g => g.Field3)
.Object<Dictionary<string, object>>(o1 => o1.Name(f1 => f1.Data).Properties(p1 => p1
.Object<object>(o2 => o2.Name("@user").Properties(p2 => p2
Expand Down Expand Up @@ -196,7 +196,7 @@ public async Task ProcessNestedAggregationsWithAliasesAsync()
[Fact]
public async Task ProcessSingleAggregationWithAlias()
{
string index = CreateRandomIndex<MyType>();
string index = await CreateRandomIndexAsync<MyType>();

await Client.IndexManyAsync([
new MyType { Field2 = "field2" }
Expand Down Expand Up @@ -226,7 +226,7 @@ await Client.IndexManyAsync([
[Fact]
public async Task ProcessAggregationsWithAliasesAsync()
{
string index = CreateRandomIndex<MyType>(d => d.Dynamic(DynamicMapping.True).Properties(p => p
string index = await CreateRandomIndexAsync<MyType>(d => d.Dynamic(DynamicMapping.True).Properties(p => p
.GeoPoint(g => g.Field3)
.Object<Dictionary<string, object>>(o1 => o1.Name(f1 => f1.Data).Properties(p1 => p1
.Object<object>(o2 => o2.Name("@user").Properties(p2 => p2
Expand Down Expand Up @@ -270,7 +270,7 @@ await Client.IndexManyAsync([
[Fact]
public async Task ProcessTermAggregations()
{
string index = CreateRandomIndex<MyType>();
string index = await CreateRandomIndexAsync<MyType>();
await Client.IndexManyAsync([new MyType { Field1 = "value1" }], index);
await Client.Indices.RefreshAsync(index);

Expand Down Expand Up @@ -299,7 +299,7 @@ public async Task ProcessTermAggregations()
[Fact]
public async Task ProcessHistogramIntervalAggregations()
{
string index = CreateRandomIndex<MyType>();
string index = await CreateRandomIndexAsync<MyType>();
await Client.IndexManyAsync([new MyType { Field1 = "value1" }], index);
await Client.Indices.RefreshAsync(index);

Expand All @@ -326,7 +326,7 @@ public async Task ProcessHistogramIntervalAggregations()
[Fact]
public async Task ProcessTermTopHitsAggregations()
{
string index = CreateRandomIndex<MyType>();
string index = await CreateRandomIndexAsync<MyType>();
await Client.IndexManyAsync([new MyType { Field1 = "value1" }], index);
await Client.Indices.RefreshAsync(index);

Expand Down Expand Up @@ -354,7 +354,7 @@ public async Task ProcessTermTopHitsAggregations()
[Fact]
public async Task ProcessSortedTermAggregations()
{
string index = CreateRandomIndex<MyType>();
string index = await CreateRandomIndexAsync<MyType>();
await Client.IndexManyAsync([new MyType { Field1 = "value1" }], index);
await Client.Indices.RefreshAsync(index);

Expand Down Expand Up @@ -384,7 +384,7 @@ public async Task ProcessSortedTermAggregations()
[Fact]
public async Task ProcessDateHistogramAggregations()
{
string index = CreateRandomIndex<MyType>();
string index = await CreateRandomIndexAsync<MyType>();
await Client.IndexManyAsync([new MyType { Field5 = DateTime.UtcNow }], index);
await Client.Indices.RefreshAsync(index);

Expand Down Expand Up @@ -418,7 +418,7 @@ public async Task ProcessDateHistogramAggregations()
[Fact]
public async Task CanSpecifyDefaultValuesAggregations()
{
string index = CreateRandomIndex<MyType>();
string index = await CreateRandomIndexAsync<MyType>();
await Client.IndexManyAsync([new MyType { Field1 = "test" }, new MyType { Field4 = 1 }], index);
await Client.Indices.RefreshAsync(index);

Expand All @@ -445,17 +445,17 @@ public async Task CanSpecifyDefaultValuesAggregations()
}

[Fact]
public Task GeoGridDoesNotResolveLocationForAggregation()
public async Task GeoGridDoesNotResolveLocationForAggregation()
{
string index = CreateRandomIndex<MyType>(d => d.Properties(p => p
string index = await CreateRandomIndexAsync<MyType>(d => d.Properties(p => p
.GeoPoint(g => g.Field1)
.FieldAlias(a => a.Name("geo").Path(f => f.Field1))));

var processor = new ElasticQueryParser(c => c
.UseGeo(_ => "someinvalidvaluehere")
.UseMappings(Client, index));

return processor.BuildAggregationsAsync("geogrid:geo~3");
await processor.BuildAggregationsAsync("geogrid:geo~3");
}

[Theory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public CustomVisitorTests(ITestOutputHelper output, ElasticsearchFixture fixture
[Fact]
public async Task CanResolveSimpleCustomFilter()
{
string index = CreateRandomIndex<MyType>();
string index = await CreateRandomIndexAsync<MyType>();
await Client.IndexAsync(new MyType { Id = "1" }, i => i.Index(index));

var processor = new ElasticQueryParser(c => c
Expand All @@ -49,7 +49,7 @@ public async Task CanResolveSimpleCustomFilter()
[Fact]
public async Task CanResolveCustomFilterContainingIncludes()
{
string index = CreateRandomIndex<MyType>();
string index = await CreateRandomIndexAsync<MyType>();
await Client.IndexAsync(new MyType { Id = "1" }, i => i.Index(index));

var processor = new ElasticQueryParser(c => c
Expand All @@ -74,7 +74,7 @@ public async Task CanResolveCustomFilterContainingIncludes()
[Fact]
public async Task CanResolveIncludeToCustomFilterContainingIgnoredInclude()
{
string index = CreateRandomIndex<MyType>();
string index = await CreateRandomIndexAsync<MyType>();
await Client.IndexAsync(new MyType { Id = "1" }, i => i.Index(index));

var processor = new ElasticQueryParser(c => c
Expand Down Expand Up @@ -121,7 +121,7 @@ private static Task<string> ResolveIncludeAsync(string expected, string actual,
[Fact]
public async Task CanResolveMultipleCustomFilters()
{
string index = CreateRandomIndex<MyType>();
string index = await CreateRandomIndexAsync<MyType>();
await Client.IndexAsync(new MyType { Id = "1" }, i => i.Index(index));

var processor = new ElasticQueryParser(c => c
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private TypeMappingDescriptor<MyNestedType> MapMyNestedType(TypeMappingDescripto
[Fact]
public async Task CanResolveCodedProperty()
{
string index = CreateRandomIndex<MyNestedType>(MapMyNestedType);
string index = await CreateRandomIndexAsync<MyNestedType>(MapMyNestedType);

await Client.IndexManyAsync([
new MyNestedType
Expand Down Expand Up @@ -69,7 +69,7 @@ await Client.IndexManyAsync([
[Fact]
public async Task CanResolveProperties()
{
string index = CreateRandomIndex<MyNestedType>(MapMyNestedType);
string index = await CreateRandomIndexAsync<MyNestedType>(MapMyNestedType);

await Client.IndexManyAsync([
new MyNestedType
Expand Down
Loading

0 comments on commit 001bce4

Please sign in to comment.