Skip to content

Commit

Permalink
Merge pull request dotnet/corefx#3 from dotnet/master
Browse files Browse the repository at this point in the history
Bring in dotnet/corefx

Commit migrated from dotnet/corefx@9797bf3
  • Loading branch information
DnlHarvey committed Mar 31, 2017
2 parents a81314e + 7bdeaf5 commit 2649e41
Show file tree
Hide file tree
Showing 247 changed files with 6,884 additions and 6,490 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal static class HttpHandlerDefaults
public const int DefaultMaxAutomaticRedirections = 50;
public const int DefaultMaxConnectionsPerServer = int.MaxValue;
public const int DefaultMaxResponseHeaderLength = 64 * 1024;
public const DecompressionMethods DefaultAutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
public const DecompressionMethods DefaultAutomaticDecompression = DecompressionMethods.None;
public const bool DefaultAutomaticRedirection = true;
public const bool DefaultUseCookies = true;
public const bool DefaultPreAuthenticate = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
<ItemGroup>
<Compile Include="Win32Exception.cs" />
<Compile Include="Win32Exception.netstandard.cs" />
<Compile Include="$(CommonTestPath)\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs">
<Link>Common\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs</Link>
</Compile>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
</Project>
26 changes: 26 additions & 0 deletions src/libraries/Microsoft.Win32.Primitives/tests/Win32Exception.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Tests;
using System.Text;
using Xunit;

Expand Down Expand Up @@ -98,5 +101,28 @@ public static void InstantiateExceptionWithLongErrorString()
}
}

public static IEnumerable<object[]> SerializeDeserialize_MemberData()
{
yield return new object[] { new Win32Exception() };
yield return new object[] { new Win32Exception(42) };
yield return new object[] { new Win32Exception(-42) };
yield return new object[] { new Win32Exception("some message") };
yield return new object[] { new Win32Exception(42, "some message") };
yield return new object[] { new Win32Exception("some message", new InvalidOperationException()) };
}

[Theory]
[MemberData(nameof(SerializeDeserialize_MemberData))]
public static void SerializeDeserialize(Win32Exception exception)
{
BinaryFormatterHelpers.AssertRoundtrips(exception, e => e.NativeErrorCode, e => e.ErrorCode);
}

[Fact]
public static void GetObjectData_InvalidArgs_Throws()
{
var e = new Win32Exception();
Assert.Throws<ArgumentNullException>("info", () => e.GetObjectData(null, default(StreamingContext)));
}
}
}

This file was deleted.

4 changes: 2 additions & 2 deletions src/libraries/Packaging.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PreReleaseLabel>beta</PreReleaseLabel>
<PreReleaseLabel>preview1</PreReleaseLabel>
<PackageDescriptionFile>$(ProjectDir)pkg/descriptions.json</PackageDescriptionFile>
<PackageLicenseFile>$(ProjectDir)pkg/dotnet_library_license.txt</PackageLicenseFile>
<PackageThirdPartyNoticesFile>$(ProjectDir)pkg/ThirdPartyNotices.txt</PackageThirdPartyNoticesFile>
Expand Down Expand Up @@ -61,7 +61,7 @@
Include="$(SyncInfoFile)" >
<SkipPackageFileCheck>true</SkipPackageFileCheck>
</File>

<!-- Add a marker to help the designer optimize & share .NET Core packages -->
<File Condition="'$(IncludeDesignerMarker)' != 'false'"
Include="$(ProjectDir)pkg/useSharedDesignerContext.txt">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ public MyNameObjectCollection() : base() { }
public MyNameObjectCollection(int capacity) : base(capacity) { }
public MyNameObjectCollection(IEqualityComparer comparer) : base(comparer) { }
public MyNameObjectCollection(int capacity, IEqualityComparer comparer) : base(capacity, comparer) { }
#pragma warning disable CS0618 // Type or member is obsolete
public MyNameObjectCollection(IHashCodeProvider hashProvider, IComparer comparer) : base(hashProvider, comparer) { }
public MyNameObjectCollection(int capacity, IHashCodeProvider hashProvider, IComparer comparer) : base(capacity, hashProvider, comparer) { }
#pragma warning restore CS0618 // Type or member is obsolete

public new bool IsReadOnly
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
<Link>Common\System\Collections\IEnumerable.NonGeneric.Serialization.Tests.cs</Link>
</Compile>
<Compile Include="NameObjectCollectionBase\NameObjectCollectionBase.ConstructorTests.cs" />
<Compile Include="NameObjectCollectionBase\MyNameObjectCollection.netstandard.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
<Compile Include="System\Configuration\StringUtilTests.cs" />
<Compile Include="System\Configuration\TempConfig.cs" />
<Compile Include="System\Configuration\TestData.cs" />
<Compile Include="System\Configuration\TimeSpanValidatorAttributeTests.cs" />
<Compile Include="System\Configuration\TypeUtilTests.cs" />
<Compile Include="System\Configuration\UriSectionTests.cs" />
<Compile Include="System\Configuration\UrlPathTests.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
// 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 System.Configuration;
using Xunit;

namespace System.ConfigurationTests
{
public class TimeSpanValidatorAttributeTests
{
[Fact]
public void MinValueString_GetString()
{
TimeSpanValidatorAttribute attribute = new TimeSpanValidatorAttribute();
string test = attribute.MinValueString;
Assert.Equal(test, TimeSpan.MinValue.ToString());
}

[Fact]
public void MinValueString_SetValidTimeSpan()
{
TimeSpanValidatorAttribute attribute = new TimeSpanValidatorAttribute();

attribute.MinValueString = "05:55:55";
string test = attribute.MinValueString;
Assert.Equal(test, "05:55:55");

attribute.MinValueString = "23:59:59";
test = attribute.MinValueString;
Assert.Equal(test, "23:59:59");

attribute.MinValueString = "00:00:00";
test = attribute.MinValueString;
Assert.Equal(test, "00:00:00");

attribute.MinValueString = "1:01:00:00";
test = attribute.MinValueString;
Assert.Equal(test, "1.01:00:00");

attribute.MinValueString = "2:22:50:45.2563";
test = attribute.MinValueString;
Assert.Equal(test, "2.22:50:45.2563000");
}

[Fact]
public void MaxValueString_GetAndSetCorrectly()
{
TimeSpanValidatorAttribute attribute = new TimeSpanValidatorAttribute();

attribute.MaxValueString = "05:55:55";
string test = attribute.MaxValueString;
Assert.Equal(test, "05:55:55");

attribute.MaxValueString = "23:59:59";
test = attribute.MaxValueString;
Assert.Equal(test, "23:59:59");

attribute.MaxValueString = "00:00:00";
test = attribute.MaxValueString;
Assert.Equal(test, "00:00:00");

attribute.MaxValueString = "1:01:00:00";
test = attribute.MaxValueString;
Assert.Equal(test, "1.01:00:00");

attribute.MaxValueString = "2:22:50:45.2563";
test = attribute.MaxValueString;
Assert.Equal(test, "2.22:50:45.2563000");
}

[Fact]
public void ExcludedRange_GetDefault()
{
TimeSpanValidatorAttribute attribute = new TimeSpanValidatorAttribute();
Assert.False(attribute.ExcludeRange);
}

[Fact]
public void ExcludedRange_ChangeToTrue()
{
TimeSpanValidatorAttribute attribute = new TimeSpanValidatorAttribute();
attribute.ExcludeRange = true;
Assert.True(attribute.ExcludeRange);
}

[Fact]
public void MinValue_Get()
{
TimeSpanValidatorAttribute attribute = new TimeSpanValidatorAttribute();

attribute.MinValueString = "05:55:55";
TimeSpan test = attribute.MinValue;
Assert.Equal(test, TimeSpan.Parse("05:55:55"));

attribute.MinValueString = "23:59:59";
test = attribute.MinValue;
Assert.Equal(test, TimeSpan.Parse("23:59:59"));

attribute.MinValueString = "00:00:00";
test = attribute.MinValue;
Assert.Equal(test, TimeSpan.Parse("00:00:00"));

attribute.MinValueString = "1:01:00:00";
test = attribute.MinValue;
Assert.Equal(test, TimeSpan.Parse("1:01:00:00"));

attribute.MinValueString = "2.22:50:45.2563";
test = attribute.MinValue;
Assert.Equal(test, TimeSpan.Parse("2.22:50:45.2563"));
}

[Fact]
public void MinValueString_TooSmall()
{
TimeSpanValidatorAttribute attribute = new TimeSpanValidatorAttribute();

attribute.MaxValueString = new TimeSpan(2, 2, 2, 2).ToString();
ArgumentOutOfRangeException result = Assert.Throws<ArgumentOutOfRangeException>(() => attribute.MinValueString = new TimeSpan(3, 3, 3, 3).ToString());
ArgumentOutOfRangeException expectedException = new ArgumentOutOfRangeException("value", SR.Validator_min_greater_than_max);
Assert.Equal(expectedException.Message, result.Message);
}

[Fact]
public void MaxValueString_TooBig()
{
TimeSpanValidatorAttribute attribute = new TimeSpanValidatorAttribute();

attribute.MinValueString = new TimeSpan(2, 2, 2, 2).ToString();
ArgumentOutOfRangeException result = Assert.Throws<ArgumentOutOfRangeException>(() => attribute.MaxValueString = new TimeSpan(1, 1, 1, 1).ToString());
ArgumentOutOfRangeException expectedException = new ArgumentOutOfRangeException("value", SR.Validator_min_greater_than_max);
Assert.Equal(expectedException.Message, result.Message);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

using System.Runtime.Remoting.Messaging;
using System.Security;
using System.Threading;

namespace System.Diagnostics
{
[Serializable]
public partial class Activity
{
/// <summary>
Expand All @@ -34,7 +34,13 @@ private set
}

#region private
private static readonly string FieldKey = $"{typeof(Activity).FullName}.Value.{AppDomain.CurrentDomain.Id}";

[Serializable]
private partial class KeyValueListNode
{
}

private static readonly string FieldKey = $"{typeof(Activity).FullName}";
#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,11 @@ private static unsafe long GetRandomNumber()

private const int RequestIdMaxLength = 1024;
private const char RootIdPrefix = '|';

/// <summary>
/// Having our own key-value linked list allows us to be more efficient
/// </summary>
private class KeyValueListNode
private partial class KeyValueListNode
{
public KeyValuePair<string, string> keyValue;
public KeyValueListNode Next;
Expand Down
Loading

0 comments on commit 2649e41

Please sign in to comment.