Imported Upstream version 5.8.0.22

Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-10-19 20:04:20 +00:00
parent 5f4a27cc8a
commit 7d05485754
5020 changed files with 114082 additions and 186061 deletions

View File

@@ -2,8 +2,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Composition.AttributeModel.Tests", "tests\System.Composition.AttributeModel.Tests.csproj", "{853BB14F-8A5B-42B4-A053-21DE1AEBB335}"
ProjectSection(ProjectDependencies) = postProject
{C6257381-C624-494A-A9D9-5586E60856EA} = {C6257381-C624-494A-A9D9-5586E60856EA}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Composition.AttributedModel", "src\System.Composition.AttributedModel.csproj", "{C6257381-C624-494A-A9D9-5586E60856EA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1A2F9F4A-A032-433E-B914-ADD5992BB178}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E107E9C1-E893-4E87-987E-04EF0DCEAEFD}"
EndProject
Global
@@ -12,6 +19,10 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{853BB14F-8A5B-42B4-A053-21DE1AEBB335}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU
{853BB14F-8A5B-42B4-A053-21DE1AEBB335}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU
{853BB14F-8A5B-42B4-A053-21DE1AEBB335}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU
{853BB14F-8A5B-42B4-A053-21DE1AEBB335}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU
{C6257381-C624-494A-A9D9-5586E60856EA}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU
{C6257381-C624-494A-A9D9-5586E60856EA}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU
{C6257381-C624-494A-A9D9-5586E60856EA}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU
@@ -21,6 +32,7 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{853BB14F-8A5B-42B4-A053-21DE1AEBB335} = {1A2F9F4A-A032-433E-B914-ADD5992BB178}
{C6257381-C624-494A-A9D9-5586E60856EA} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD}
EndGlobalSection
EndGlobal

View File

@@ -18,8 +18,7 @@ namespace System.Composition
/// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
/// type or member marked with this attribute under the default contract name.
/// </summary>
public ExportAttribute()
: this((string)null, (Type)null)
public ExportAttribute() : this(null, null)
{
}
@@ -33,8 +32,7 @@ namespace System.Composition
/// member marked with this attribute, under; or <see langword="null"/> to use the
/// default contract name.
/// </param>
public ExportAttribute(Type contractType)
: this((string)null, contractType)
public ExportAttribute(Type contractType) : this(null, contractType)
{
}
@@ -43,12 +41,11 @@ namespace System.Composition
/// type or member marked with this attribute under the specified contract name.
/// </summary>
/// <param name="contractName">
/// A <see cref="String"/> containing the contract name to export the type or member
/// A <see cref="string"/> containing the contract name to export the type or member
/// marked with this attribute, under; or <see langword="null"/> or an empty string
/// ("") to use the default contract name.
/// </param>
public ExportAttribute(string contractName)
: this(contractName, (Type)null)
public ExportAttribute(string contractName) : this(contractName, null)
{
}
@@ -57,7 +54,7 @@ namespace System.Composition
/// type or member marked with this attribute under the specified contract name.
/// </summary>
/// <param name="contractName">
/// A <see cref="String"/> containing the contract name to export the type or member
/// A <see cref="string"/> containing the contract name to export the type or member
/// marked with this attribute, under; or <see langword="null"/> or an empty string
/// ("") to use the default contract name.
/// </param>
@@ -76,10 +73,10 @@ namespace System.Composition
/// Gets the contract name to export the type or member under.
/// </summary>
/// <value>
/// A <see cref="String"/> containing the contract name to export the type or member
/// A <see cref="string"/> containing the contract name to export the type or member
/// marked with this attribute, under. The default value is an empty string ("").
/// </value>
public string ContractName { get; private set; }
public string ContractName { get; }
/// <summary>
/// Get the contract type that is exported by the member that this attribute is attached to.
@@ -89,6 +86,6 @@ namespace System.Composition
/// <see langword="null"/> which means that the type will be obtained by looking at the type on
/// the member that this export is attached to.
/// </value>
public Type ContractType { get; private set; }
public Type ContractType { get; }
}
}

View File

@@ -17,7 +17,7 @@ namespace System.Composition
/// specified name and metadata value.
/// </summary>
/// <param name="name">
/// A <see cref="String"/> containing the name of the metadata value; or
/// A <see cref="string"/> containing the name of the metadata value; or
/// <see langword="null"/> to set the <see cref="Name"/> property to an empty
/// string ("").
/// </param>
@@ -35,9 +35,9 @@ namespace System.Composition
/// Gets the name of the metadata value.
/// </summary>
/// <value>
/// A <see cref="String"/> containing the name of the metadata value.
/// A <see cref="string"/> containing the name of the metadata value.
/// </value>
public string Name { get; private set; }
public string Name { get; }
/// <summary>
/// Gets the metadata value.
@@ -45,6 +45,6 @@ namespace System.Composition
/// <value>
/// An <see cref="object"/> containing the metadata value.
/// </value>
public object Value { get; private set; }
public object Value { get; }
}
}

View File

@@ -18,8 +18,7 @@ namespace System.Composition
/// Initializes a new instance of the <see cref="ImportAttribute"/> class, importing the
/// export without a contract name.
/// </summary>
public ImportAttribute()
: this((string)null)
public ImportAttribute() : this(null)
{
}
@@ -28,7 +27,7 @@ namespace System.Composition
/// export with the specified contract name.
/// </summary>
/// <param name="contractName">
/// A <see cref="String"/> containing the contract name of the export to import, or
/// A <see cref="string"/> containing the contract name of the export to import, or
/// <see langword="null"/> or an empty string ("") to use the default contract name.
/// </param>
public ImportAttribute(string contractName)
@@ -40,10 +39,10 @@ namespace System.Composition
/// Gets the contract name of the export to import.
/// </summary>
/// <value>
/// A <see cref="String"/> containing the contract name of the export to import. The
/// A <see cref="string"/> containing the contract name of the export to import. The
/// default value is null.
/// </value>
public string ContractName { get; private set; }
public string ContractName { get; }
/// <summary>
/// Gets or sets a value indicating whether the property, field or parameter will be left

View File

@@ -18,8 +18,7 @@ namespace System.Composition
/// Initializes a new instance of the <see cref="ImportManyAttribute"/> class, importing the
/// set of exports without a contract name.
/// </summary>
public ImportManyAttribute()
: this((string)null)
public ImportManyAttribute() : this(null)
{
}
@@ -28,7 +27,7 @@ namespace System.Composition
/// set of exports with the specified contract name.
/// </summary>
/// <param name="contractName">
/// A <see cref="String"/> containing the contract name of the exports to import, or
/// A <see cref="string"/> containing the contract name of the exports to import, or
/// <see langword="null"/>.
/// </param>
public ImportManyAttribute(string contractName)
@@ -40,9 +39,9 @@ namespace System.Composition
/// Gets the contract name of the exports to import.
/// </summary>
/// <value>
/// A <see cref="String"/> containing the contract name of the exports to import. The
/// A <see cref="string"/> containing the contract name of the exports to import. The
/// default value is null.
/// </value>
public string ContractName { get; private set; }
public string ContractName { get; }
}
}

View File

@@ -10,9 +10,6 @@ namespace System.Composition
[AttributeUsage(AttributeTargets.Property, Inherited = false)]
public sealed class ImportMetadataConstraintAttribute : Attribute
{
private readonly string _name;
private readonly object _value;
/// <summary>
/// Require a specific metadata value on the exporter.
/// </summary>
@@ -20,18 +17,18 @@ namespace System.Composition
/// <param name="value">The value to match.</param>
public ImportMetadataConstraintAttribute(string name, object value)
{
_name = name;
_value = value;
Name = name;
Value = value;
}
/// <summary>
/// The metadata key to match.
/// </summary>
public string Name { get { return _name; } }
public string Name { get; }
/// <summary>
/// The value to match.
/// </summary>
public object Value { get { return _value; } }
public object Value { get; }
}
}

View File

@@ -15,7 +15,7 @@ namespace System.Composition
/// specified name and metadata value.
/// </summary>
/// <param name="name">
/// A <see cref="String"/> containing the name of the metadata value; or
/// A <see cref="string"/> containing the name of the metadata value; or
/// <see langword="null"/> to use an empty string ("").
/// </param>
/// <param name="value">
@@ -24,9 +24,7 @@ namespace System.Composition
/// </param>
public PartMetadataAttribute(string name, object value)
{
if (name == null) throw new ArgumentNullException(nameof(name));
Name = name;
Name = name ?? throw new ArgumentNullException(nameof(name));
Value = value;
}
@@ -34,9 +32,9 @@ namespace System.Composition
/// Gets the name of the metadata value.
/// </summary>
/// <value>
/// A <see cref="String"/> containing the name of the metadata value.
/// A <see cref="string"/> containing the name of the metadata value.
/// </value>
public string Name { get; private set; }
public string Name { get; }
/// <summary>
/// Gets the metadata value.
@@ -44,6 +42,6 @@ namespace System.Composition
/// <value>
/// An <see cref="object"/> containing the metadata value.
/// </value>
public object Value { get; private set; }
public object Value { get; }
}
}

View File

@@ -21,8 +21,7 @@ namespace System.Composition
/// <summary>
/// Mark a part as globally shared.
/// </summary>
public SharedAttribute()
: base(SharingBoundaryPartMetadataName, null)
public SharedAttribute() : base(SharingBoundaryPartMetadataName, null)
{
}
@@ -31,14 +30,13 @@ namespace System.Composition
/// boundary name.
/// </summary>
/// <param name="sharingBoundaryName">The boundary outside of which this part is inaccessible.</param>
public SharedAttribute(string sharingBoundaryName)
: base(SharingBoundaryPartMetadataName, sharingBoundaryName)
public SharedAttribute(string sharingBoundaryName) : base(SharingBoundaryPartMetadataName, sharingBoundaryName)
{
}
/// <summary>
/// he boundary outside of which this part is inaccessible.
/// </summary>
public string SharingBoundary { get { return (string)base.Value; } }
public string SharingBoundary => (string)base.Value;
}
}

View File

@@ -30,14 +30,12 @@ namespace System.Composition
/// <param name="sharingBoundaryNames">Boundaries implemented by the created ExportLifetimeContext{T}s.</param>
public SharingBoundaryAttribute(params string[] sharingBoundaryNames)
{
if (sharingBoundaryNames == null) throw new ArgumentNullException(nameof(sharingBoundaryNames));
_sharingBoundaryNames = sharingBoundaryNames;
_sharingBoundaryNames = sharingBoundaryNames ?? throw new ArgumentNullException(nameof(sharingBoundaryNames));
}
/// <summary>
/// Boundaries implemented by the created ExportLifetimeContext{T}s.
/// </summary>
public ReadOnlyCollection<string> SharingBoundaryNames { get { return new ReadOnlyCollection<string>(_sharingBoundaryNames); } }
public ReadOnlyCollection<string> SharingBoundaryNames => new ReadOnlyCollection<string>(_sharingBoundaryNames);
}
}

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netstandard;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,49 @@
// 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.Composition.Tests
{
public class ExportAttributeTests
{
[Fact]
public void Ctor_Default()
{
var attribute = new ExportAttribute();
Assert.Null(attribute.ContractName);
Assert.Null(attribute.ContractType);
}
[Theory]
[InlineData(null)]
[InlineData("ContractName")]
public void Ctor_ContractName(string contractName)
{
var attribute = new ExportAttribute(contractName);
Assert.Equal(contractName, attribute.ContractName);
Assert.Null(attribute.ContractType);
}
[Theory]
[InlineData(null)]
[InlineData(typeof(string))]
public void Ctor_ContractName(Type contractType)
{
var attribute = new ExportAttribute(contractType);
Assert.Null(attribute.ContractName);
Assert.Equal(contractType, attribute.ContractType);
}
[Theory]
[InlineData(null, null)]
[InlineData("ContractName", typeof(string))]
public void Ctor_ContractName_ContractType(string contractName, Type contractType)
{
var attribute = new ExportAttribute(contractName, contractType);
Assert.Equal(contractName, attribute.ContractName);
Assert.Equal(contractType, attribute.ContractType);
}
}
}

View File

@@ -0,0 +1,21 @@
// 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.Composition.Tests
{
public class ExportMetadataAttributeTests
{
[Theory]
[InlineData(null, null)]
[InlineData("Name", "Value")]
public void Ctor_Name_Value(string name, string value)
{
var attribute = new ExportMetadataAttribute(name, value);
Assert.Equal(name ?? string.Empty, attribute.Name);
Assert.Equal(value, attribute.Value);
}
}
}

View File

@@ -0,0 +1,27 @@
// 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.Composition.Tests
{
public class ImportAttributeTests
{
[Fact]
public void Ctor_Default()
{
var attribute = new ImportAttribute();
Assert.Null(attribute.ContractName);
}
[Theory]
[InlineData(null)]
[InlineData("ContractName")]
public void Ctor_ContractName(string contractName)
{
var attribute = new ImportAttribute(contractName);
Assert.Equal(contractName, attribute.ContractName);
}
}
}

View File

@@ -0,0 +1,27 @@
// 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.Composition.Tests
{
public class ImportManyAttributeTests
{
[Fact]
public void Ctor_Default()
{
var attribute = new ImportManyAttribute();
Assert.Null(attribute.ContractName);
}
[Theory]
[InlineData(null)]
[InlineData("ContractName")]
public void Ctor_ContractName(string contractName)
{
var attribute = new ImportManyAttribute(contractName);
Assert.Equal(contractName, attribute.ContractName);
}
}
}

View File

@@ -0,0 +1,21 @@
// 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.Composition.Tests
{
public class ImportMetadataConstraintAttributeTests
{
[Theory]
[InlineData(null, null)]
[InlineData("Name", "Value")]
public void Ctor_Name_Value(string name, string value)
{
var attribute = new ImportMetadataConstraintAttribute(name, value);
Assert.Equal(name, attribute.Name);
Assert.Equal(value, attribute.Value);
}
}
}

View File

@@ -0,0 +1,18 @@
// 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.Composition.Tests
{
public class ImportingConstructorAttributeTests
{
[Fact]
public void Ctor_Default()
{
var attribute = new ImportingConstructorAttribute();
Assert.Equal(typeof(ImportingConstructorAttribute), attribute.TypeId);
}
}
}

View File

@@ -0,0 +1,18 @@
// 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.Composition.Tests
{
public class MetadataAttributeAttributeTests
{
[Fact]
public void Ctor_Default()
{
var attribute = new MetadataAttributeAttribute();
Assert.Equal(typeof(MetadataAttributeAttribute), attribute.TypeId);
}
}
}

View File

@@ -0,0 +1,27 @@
// 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.Composition.Tests
{
public class PartMetadataAttributeTests
{
[Theory]
[InlineData("", null)]
[InlineData("Name", "Value")]
public void Ctor_Name_Value(string name, string value)
{
var attribute = new PartMetadataAttribute(name, value);
Assert.Equal(name, attribute.Name);
Assert.Equal(value, attribute.Value);
}
[Fact]
public void Ctor_NullName_ThrowsArgumentNullException()
{
AssertExtensions.Throws<ArgumentNullException>("name", () => new PartMetadataAttribute(null, "value"));
}
}
}

View File

@@ -0,0 +1,18 @@
// 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.Composition.Tests
{
public class PartNotDiscoverableAttributeTests
{
[Fact]
public void Ctor_Default()
{
var attribute = new PartNotDiscoverableAttribute();
Assert.Equal(typeof(PartNotDiscoverableAttribute), attribute.TypeId);
}
}
}

View File

@@ -0,0 +1,31 @@
// 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.Composition.Tests
{
public class SharedAttributeTests
{
[Fact]
public void Ctor_Default()
{
var attribute = new SharedAttribute();
Assert.Null(attribute.SharingBoundary);
Assert.Equal("SharingBoundary", attribute.Name);
Assert.Null(attribute.Value);
}
[Theory]
[InlineData(null)]
[InlineData("Name")]
public void Ctor_SharingBoundaryName(string sharingBoundaryName)
{
var attribute = new SharedAttribute(sharingBoundaryName);
Assert.Equal(sharingBoundaryName, attribute.SharingBoundary);
Assert.Equal("SharingBoundary", attribute.Name);
Assert.Equal(sharingBoundaryName, attribute.Value);
}
}
}

Some files were not shown because too many files have changed in this diff Show More