Skip to content

Commit 6453999

Browse files
committed
Remove parameterless ctor, renamed Value => ValueOf
1 parent 90714c2 commit 6453999

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

src/Nest/CommonAbstractions/Fields/FieldValues.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,24 @@ public class FieldValues : IsADictionary<string, object>
1515
{
1616
private ElasticInferrer _inferrer;
1717

18-
public FieldValues() : base() { }
19-
2018
public FieldValues(ElasticInferrer inferrer, IDictionary<string, object> container)
2119
: base(container)
2220
{
2321
_inferrer = inferrer;
2422
}
2523

26-
public K Value<K>(Field field) => Values<K>(field).FirstOrDefault();
24+
public K ValueOf<K>(Field field) => ValuesOf<K>(field).FirstOrDefault();
2725

28-
public K Value<T, K>(Expression<Func<T, object>> objectPath)
29-
where T : class => Values<T, K>(objectPath).FirstOrDefault();
26+
public K ValueOf<T, K>(Expression<Func<T, object>> objectPath)
27+
where T : class => ValuesOf<T, K>(objectPath).FirstOrDefault();
3028

31-
public K[] Values<K>(Field field)
29+
public K[] ValuesOf<K>(Field field)
3230
{
3331
var path = this._inferrer.Field(field);
3432
return this.FieldArray<K[]>(path);
3533
}
3634

37-
public K[] Values<T, K>(Expression<Func<T, object>> objectPath)
35+
public K[] ValuesOf<T, K>(Expression<Func<T, object>> objectPath)
3836
where T : class
3937
{
4038
var field = this._inferrer.Field(objectPath);

src/Tests/Aggregations/Metric/TopHits/TopHitsAggregationUsageTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ protected override void ExpectResponse(ISearchResponse<Project> response)
167167
hits.All(h => h.Explanation != null).Should().BeTrue();
168168
hits.All(h => h.Version.HasValue).Should().BeTrue();
169169
//hits.All(h => h.Highlights.Count() > 0).Should().BeTrue();
170-
hits.All(h => h.Fields.Values<StateOfBeing>("state").Any()).Should().BeTrue();
171-
hits.All(h => h.Fields.Values<int>("numberOfCommits").Any()).Should().BeTrue();
172-
hits.All(h => h.Fields.Values<int>("commit_factor").Any()).Should().BeTrue();
170+
hits.All(h => h.Fields.ValuesOf<StateOfBeing>("state").Any()).Should().BeTrue();
171+
hits.All(h => h.Fields.ValuesOf<int>("numberOfCommits").Any()).Should().BeTrue();
172+
hits.All(h => h.Fields.ValuesOf<int>("commit_factor").Any()).Should().BeTrue();
173173
topStateHits.Documents<Project>().Should().NotBeEmpty();
174174
}
175175
}

src/Tests/Document/Single/Get/GetApiTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ public GetApiFieldsTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cl
6060
protected override void ExpectResponse(IGetResponse<Project> response)
6161
{
6262
response.Fields.Should().NotBeNull();
63-
response.Fields.Value<Project, string>(p => p.Name).Should().Be(ProjectId);
64-
response.Fields.Value<Project, int>(p => p.NumberOfCommits).Should().BeGreaterThan(0);
63+
response.Fields.ValueOf<Project, string>(p => p.Name).Should().Be(ProjectId);
64+
response.Fields.ValueOf<Project, int>(p => p.NumberOfCommits).Should().BeGreaterThan(0);
6565
}
6666
}
6767
}

src/Tests/Search/Request/InnerHitsUsageTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ [I] public Task AssertResponse() => this.AssertOnAllResponses(r =>
214214
earlHits.Total.Should().BeGreaterThan(0);
215215
earlHits.Hits.Should().NotBeEmpty().And.HaveCount(5);
216216
foreach (var earlHit in earlHits.Hits)
217-
earlHit.Fields.Values<string>("name").Should().NotBeEmpty();
217+
earlHit.Fields.ValuesOf<string>("name").Should().NotBeEmpty();
218218
var earls = earlHits.Documents<Earl>();
219219
earls.Should().NotBeEmpty().And.OnlyContain(earl => !string.IsNullOrWhiteSpace(earl.Name));
220220
foreach (var earlHit in earlHits.Hits)

0 commit comments

Comments
 (0)