diff --git a/src/Tests/Tests/Indices/MappingManagement/GetMapping/GetMappingApiTest.cs b/src/Tests/Tests/Indices/MappingManagement/GetMapping/GetMappingApiTest.cs index cdd2a051dc0..21981a8b70f 100644 --- a/src/Tests/Tests/Indices/MappingManagement/GetMapping/GetMappingApiTest.cs +++ b/src/Tests/Tests/Indices/MappingManagement/GetMapping/GetMappingApiTest.cs @@ -22,7 +22,7 @@ public class GetMappingApiTests : ApiIntegrationTestBase Calls( + protected override LazyResponses ClientUsage() => this.Calls( fluent: (client, f) => client.GetMapping(f), fluentAsync: (client, f) => client.GetMappingAsync(f), request: (client, r) => client.GetMapping(r), @@ -114,7 +114,7 @@ public class GetMappingNonExistentIndexApiTests : ApiIntegrationTestBase Calls( + protected override LazyResponses ClientUsage() => this.Calls( fluent: (client, f) => client.GetMapping(f), fluentAsync: (client, f) => client.GetMappingAsync(f), request: (client, r) => client.GetMapping(r), @@ -124,17 +124,13 @@ protected override LazyResponses ClientUsage() => Calls( protected override bool ExpectIsValid => false; protected override int ExpectStatusCode => 404; protected override HttpMethod HttpMethod => HttpMethod.GET; - protected override string UrlPath => $"/{_nonExistentIndex}/_mapping?ignore_unavailable=true"; + protected override string UrlPath => $"/{_nonExistentIndex}/_mapping"; protected override Func, IGetMappingRequest> Fluent => d => d .Index(_nonExistentIndex) - .AllTypes() - .IgnoreUnavailable(); + .AllTypes(); - protected override GetMappingRequest Initializer => new GetMappingRequest(_nonExistentIndex, AllTypes) - { - IgnoreUnavailable = true - }; + protected override GetMappingRequest Initializer => new GetMappingRequest(_nonExistentIndex, AllTypes); protected override void ExpectResponse(IGetMappingResponse response) { @@ -145,10 +141,7 @@ protected override void ExpectResponse(IGetMappingResponse response) internal class TestVisitor : IMappingVisitor { - public TestVisitor() - { - Counts = new Dictionary(); - } + public TestVisitor() => this.Counts = new Dictionary(); public int Depth { get; set; } @@ -156,11 +149,12 @@ public TestVisitor() private void Increment(string key) { - if (!Counts.ContainsKey(key)) + if (!this.Counts.ContainsKey(key)) { - Counts.Add(key, 0); + this.Counts.Add(key, 0); } - Counts[key] += 1; + + this.Counts[key] += 1; } public void CountsShouldContainKeyAndCountBe(string key, int count) @@ -172,119 +166,50 @@ public void CountsShouldContainKeyAndCountBe(string key, int count) this.Counts[key].Should().Be(count, because); } - public void Visit(IDateProperty mapping) - { - Increment("date"); - } + public void Visit(IDateProperty mapping) => this.Increment("date"); - public void Visit(IBinaryProperty mapping) - { - Increment("binary"); - } + public void Visit(IBinaryProperty mapping) => this.Increment("binary"); - public void Visit(INestedProperty mapping) - { - Increment("nested"); - } + public void Visit(INestedProperty mapping) => this.Increment("nested"); - public void Visit(IGeoPointProperty mapping) - { - Increment("geo_point"); - } + public void Visit(IGeoPointProperty mapping) => this.Increment("geo_point"); - public void Visit(ICompletionProperty mapping) - { - Increment("completion"); - } + public void Visit(ICompletionProperty mapping) => this.Increment("completion"); - public void Visit(ITokenCountProperty mapping) - { - Increment("token_count"); - } + public void Visit(ITokenCountProperty mapping) => this.Increment("token_count"); - public void Visit(IPercolatorProperty property) - { - Increment("percolator"); - } + public void Visit(IPercolatorProperty property) => this.Increment("percolator"); - public void Visit(IIntegerRangeProperty property) - { - Increment("integer_range"); - } + public void Visit(IIntegerRangeProperty property) => this.Increment("integer_range"); - public void Visit(IFloatRangeProperty property) - { - Increment("float_range"); - } + public void Visit(IFloatRangeProperty property) => this.Increment("float_range"); - public void Visit(ILongRangeProperty property) - { - Increment("long_range"); - } + public void Visit(ILongRangeProperty property) => this.Increment("long_range"); - public void Visit(IDoubleRangeProperty property) - { - Increment("double_range"); - } + public void Visit(IDoubleRangeProperty property) => this.Increment("double_range"); - public void Visit(IDateRangeProperty property) - { - Increment("date_range"); - } + public void Visit(IDateRangeProperty property) => this.Increment("date_range"); - public void Visit(IIpRangeProperty property) - { - Increment("ip_range"); - } + public void Visit(IIpRangeProperty property) => this.Increment("ip_range"); - public void Visit(IJoinProperty property) - { - Increment("join"); - } + public void Visit(IJoinProperty property) => this.Increment("join"); - public void Visit(IMurmur3HashProperty mapping) - { - Increment("murmur3"); - } + public void Visit(IMurmur3HashProperty mapping) => this.Increment("murmur3"); - public void Visit(INumberProperty mapping) - { - Increment("number"); - } + public void Visit(INumberProperty mapping) => this.Increment("number"); - public void Visit(IGeoShapeProperty mapping) - { - Increment("geo_shape"); - } + public void Visit(IGeoShapeProperty mapping) => this.Increment("geo_shape"); - public void Visit(IIpProperty mapping) - { - Increment("ip"); - } + public void Visit(IIpProperty mapping) => this.Increment("ip"); - public void Visit(IObjectProperty mapping) - { - Increment("object"); - } + public void Visit(IObjectProperty mapping) => this.Increment("object"); - public void Visit(IBooleanProperty mapping) - { - Increment("boolean"); - } + public void Visit(IBooleanProperty mapping) => this.Increment("boolean"); - public void Visit(ITextProperty mapping) - { - Increment("text"); - } + public void Visit(ITextProperty mapping) => this.Increment("text"); - public void Visit(IKeywordProperty mapping) - { - Increment("keyword"); - } + public void Visit(IKeywordProperty mapping) => this.Increment("keyword"); - public void Visit(ITypeMapping mapping) - { - Increment("type"); - } + public void Visit(ITypeMapping mapping) => this.Increment("type"); } }