Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3790,6 +3790,10 @@ public KeyNotFoundException(string message) { }
public KeyNotFoundException(string message, System.Exception innerException) { }
protected KeyNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
}
public static class KeyValuePair
{
public static KeyValuePair<TKey, TValue> Create<TKey, TValue>(TKey key, TValue value) { throw null; }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct KeyValuePair<TKey, TValue>
{
Expand Down
3 changes: 2 additions & 1 deletion src/System.Runtime/src/ApiCompatBaseline.uapaot.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ MembersMustExist : Member 'System.WeakReference..ctor(System.Runtime.Serializati
MembersMustExist : Member 'System.WeakReference.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)' does not exist in the implementation but it does exist in the contract.
CannotRemoveBaseTypeOrInterface : Type 'System.WeakReference<T>' does not implement interface 'System.Runtime.Serialization.ISerializable' in the implementation but it does in the contract.
MembersMustExist : Member 'System.WeakReference<T>.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Collections.Generic.KeyValuePair' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.ComponentModel.DefaultValueAttribute..ctor(System.SByte)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.ComponentModel.DefaultValueAttribute..ctor(System.UInt16)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.ComponentModel.DefaultValueAttribute..ctor(System.UInt32)' does not exist in the implementation but it does exist in the contract.
Expand Down Expand Up @@ -240,4 +241,4 @@ CannotRemoveBaseTypeOrInterface : Type 'System.Threading.Tasks.Task' does not im
MembersMustExist : Member 'System.Threading.Tasks.Task.Dispose()' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Threading.Tasks.Task.Dispose(System.Boolean)' does not exist in the implementation but it does exist in the contract.
CannotRemoveBaseTypeOrInterface : Type 'System.Threading.Tasks.Task<TResult>' does not implement interface 'System.IDisposable' in the implementation but it does in the contract.
Total Issues: 241
Total Issues: 242
8 changes: 5 additions & 3 deletions src/System.Runtime/tests/System.Runtime.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
<!-- Remove this when TypeBuilder extends TypeInfo. See https://github.com/dotnet/corefx/issues/14334 -->
<!-- EnumBuilder type is defined in netcoreapp and not in netstandard -->
<Compile Include="$(CommonTestPath)\System\TypeBuilderExtensions.cs"/>
<!-- EnumBuilder type is defined in netcoreapp and not in netstandard -->
<Compile Include="$(CommonTestPath)\System\TypeBuilderExtensions.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(CommonTestPath)\System\AssertExtensions.cs">
Expand Down Expand Up @@ -51,6 +51,7 @@
<Compile Include="System\BufferTests.cs" />
<Compile Include="System\ByteTests.cs" />
<Compile Include="System\CharTests.cs" />
<Compile Include="System\Collections\Generic\KeyValuePairTests.cs" />
<Compile Include="System\Collections\ObjectModel\CollectionTests.cs" />
<Compile Include="System\Collections\ObjectModel\CollectionTestBase.cs" />
<Compile Include="System\Collections\ObjectModel\ReadOnlyCollectionTests.cs" />
Expand Down Expand Up @@ -127,6 +128,7 @@
<Compile Include="System\EnumTests.netcoreapp.cs" />
<Compile Include="System\GCTests.netcoreapp.cs" />
<Compile Include="System\IntPtrTests.netcoreapp.cs" />
<Compile Include="System\Collections\Generic\KeyValuePairTests.netcoreapp.cs" />
<Compile Include="System\LazyTests.netcoreapp.cs" />
<Compile Include="System\Runtime\CompilerServices\RuntimeHelpersTests.netcoreapp.cs" />
<Compile Include="System\Runtime\CompilerServices\ConditionalWeakTableTests.netcoreapp.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Xunit;

namespace System.Collections.Generic.Tests
{
public partial class KeyValuePairTests
{
[Fact]
public void Ctor_KeyValue_ReturnsExpected()
{
var keyValuePair = new KeyValuePair<int, string>(1, "2");
Assert.Equal(1, keyValuePair.Key);
Assert.Equal("2", keyValuePair.Value);
}

[Fact]
public void ToString_NonNullKeyNonNullValue_ReturnsExpected()
{
var keyValuePair = new KeyValuePair<string, string>("1", "2");
Assert.Equal("[1, 2]", keyValuePair.ToString());
}

[Fact]
public void ToString_NonNullKeyNullValue_ReturnsExpected()
{
var keyValuePair = new KeyValuePair<string, string>("1", null);
Assert.Equal("[1, ]", keyValuePair.ToString());
}

[Fact]
public void ToString_NullKeyNonNullValue_ReturnsExpected()
{
var keyValuePair = new KeyValuePair<string, string>(null, "1");
Assert.Equal("[, 1]", keyValuePair.ToString());
}

[Fact]
public void ToString_NullKeyNullValue_ReturnsExpected()
{
var keyValuePair = new KeyValuePair<string, string>(null, null);
Assert.Equal("[, ]", keyValuePair.ToString());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Xunit;

namespace System.Collections.Generic.Tests
{
public partial class KeyValuePairTests
{
[Fact]
public void Create_ReturnsExpected()
{
KeyValuePair<int, string> keyValuePair = KeyValuePair.Create(1, "2");
Assert.Equal(1, keyValuePair.Key);
Assert.Equal("2", keyValuePair.Value);
}
}
}