Skip to content

Commit

Permalink
Changes target to netstandard2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
andrueastman committed Jan 17, 2023
1 parent 89278e8 commit 8a58f9a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
9 changes: 5 additions & 4 deletions Microsoft.Kiota.Abstractions.Tests/RequestHeadersTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ public void RemovesValue() {
instance.Remove("name", "value");
Assert.Equal(new [] { "value2" }, instance["name"]);
instance.Remove("name", "value2");
Assert.Null(instance["name"]);
Assert.Throws<KeyNotFoundException>(() => instance["name"]);
}
[Fact]
public void Removes() {
var instance = new RequestHeaders();
instance.Add("name", "value");
instance.Add("name", "value2");
Assert.True(instance.Remove("name"));
Assert.Null(instance["name"]);
Assert.Throws<KeyNotFoundException>(() => instance["name"]);
Assert.False(instance.Remove("name"));
}
[Fact]
Expand All @@ -59,7 +59,7 @@ public void RemovesKVP() {
instance.Add("name", "value");
instance.Add("name", "value2");
Assert.True(instance.Remove(new KeyValuePair<string, IEnumerable<string>>("name", new [] { "value", "value2" })));
Assert.Null(instance["name"]);
Assert.Throws<KeyNotFoundException>(() => instance["name"]);
Assert.False(instance.Remove("name"));
}
[Fact]
Expand All @@ -68,7 +68,8 @@ public void Clears() {
instance.Add("name", "value");
instance.Add("name", "value2");
instance.Clear();
Assert.Null(instance["name"]);
Assert.Throws<KeyNotFoundException>(() => instance["name"]);
Assert.Empty(instance.Keys);
}
[Fact]
public void GetsEnumerator() {
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.Kiota.Abstractions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<AssemblyTitle>Kiota Abstractions Library for dotnet</AssemblyTitle>
<Authors>Microsoft</Authors>
<TargetFrameworks>netstandard2.0;net6.0;</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;</TargetFrameworks>
<LangVersion>latest</LangVersion>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<RepositoryUrl>https://github.com/microsoft/kiota-abstractions-dotnet</RepositoryUrl>
Expand Down
4 changes: 1 addition & 3 deletions src/RequestHeaders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ public void Add(string headerName, params string[] headerValues) {
/// <inheritdoc/>
public bool IsReadOnly => false;
/// <inheritdoc/>
#pragma warning disable CS8603 // Possible null reference return. //Can't change signature of overriden method implementation
public IEnumerable<string> this[string key] { get => TryGetValue(key, out var result) ? result : null; set => Add(key, value); }
#pragma warning restore CS8603 // Possible null reference return.
public IEnumerable<string> this[string key] { get => TryGetValue(key, out var result) ? result : throw new KeyNotFoundException($"Key not found : {key}"); set => Add(key, value); }

/// <summary>
/// Removes the specified value from the header with the specified name.
Expand Down

0 comments on commit 8a58f9a

Please sign in to comment.