Skip to content

Commit 28f4eb1

Browse files
committed
broke dotnet5.1 build
1 parent 2529f4b commit 28f4eb1

File tree

3 files changed

+14
-31
lines changed

3 files changed

+14
-31
lines changed

src/Elasticsearch.Net/CrossPlatform/TypeExtensions.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ internal static bool IsGeneric(this Type type)
1717
#endif
1818
}
1919

20+
internal static bool AssignableFrom(this Type type, Type from)
21+
{
22+
#if DOTNETCORE
23+
return type.GetTypeInfo().IsAssignableFrom(from.GetTypeInfo());
24+
#else
25+
return type.IsAssignableFrom(from);
26+
#endif
27+
}
28+
2029
internal static bool IsValue(this Type type)
2130
{
2231
#if DOTNETCORE

src/Elasticsearch.Net/Transport/PostData.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Collections.Generic;
22
using Purify;
33
using System.IO;
4+
using System.Reflection;
45
using System.Threading;
56
using System.Threading.Tasks;
67

@@ -38,19 +39,19 @@ public class PostData<T> : IPostData<T>
3839
public PostData(T item)
3940
{
4041
var boxedType = item.GetType();
41-
if (typeof(byte[]).IsAssignableFrom(boxedType))
42+
if (typeof(byte[]).AssignableFrom(boxedType))
4243
{
4344
WrittenBytes = item as byte[]; Type = PostType.ByteArray;
4445
}
45-
else if (typeof(string).IsAssignableFrom(boxedType))
46+
else if (typeof(string).AssignableFrom(boxedType))
4647
{
4748
_literalString = item as string; Type = PostType.LiteralString;
4849
}
49-
else if (typeof(IEnumerable<string>).IsAssignableFrom(boxedType))
50+
else if (typeof(IEnumerable<string>).AssignableFrom(boxedType))
5051
{
5152
_enumurabeOfStrings = (IEnumerable<string>)item; Type = PostType.EnumerableOfString;
5253
}
53-
else if (typeof(IEnumerable<object>).IsAssignableFrom(boxedType))
54+
else if (typeof(IEnumerable<object>).AssignableFrom(boxedType))
5455
{
5556
_enumerableOfObject = (IEnumerable<object>)item; Type = PostType.EnumerableOfObject;
5657
}

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

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -43,33 +43,6 @@ protected override void ExpectResponse(IGetResponse<Project> response)
4343
}
4444
}
4545

46-
[Collection(IntegrationContext.ReadOnly)]
47-
public class GetApiLowLevelTests : GetApiTests
48-
{
49-
public GetApiLowLevelTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cluster, usage) { }
50-
51-
protected override string UrlPath => $"/project/project/{ProjectIdForUrl}?fields=name%2CnumberOfCommits";
52-
53-
protected override LazyResponses ClientUsage() => Calls(
54-
fluent: (client, f) => client.Raw.Get<GetResponse<Project>>("project", "project", this.ProjectId, RequestParameter).Body,
55-
fluentAsync: (client, f) => client.Raw.GetAsync<GetResponse<Project>>("project", "project", this.ProjectId, RequestParameter)
56-
.ContinueWith<IGetResponse<Project>>(t=>t.Result.Body),
57-
request: (client, f) => client.Raw.Get<GetResponse<Project>>("project", "project", this.ProjectId, RequestParameter).Body,
58-
requestAsync: (client, f) => client.Raw.GetAsync<GetResponse<Project>>("project", "project", this.ProjectId, RequestParameter)
59-
.ContinueWith<IGetResponse<Project>>(t=>t.Result.Body)
60-
);
61-
62-
private GetRequestParameters RequestParameter(GetRequestParameters r) => r
63-
.Fields("name", "numberOfCommits");
64-
65-
protected override void ExpectResponse(IGetResponse<Project> response)
66-
{
67-
response.Fields.Should().NotBeNull();
68-
response.Fields.ValueOf<Project, string>(p => p.Name).Should().Be(ProjectId);
69-
response.Fields.ValueOf<Project, int?>(p => p.NumberOfCommits).Should().BeGreaterThan(0);
70-
}
71-
}
72-
7346
[Collection(IntegrationContext.ReadOnly)]
7447
public class GetApiFieldsTests : GetApiTests
7548
{

0 commit comments

Comments
 (0)