Merge branch 'master' into merge/release/3.1-to-master\n\nCommit migrated from 2e4add69f5
This commit is contained in:
commit
eef217e92f
|
|
@ -34,7 +34,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a <see cref="HealthStatus"/> representing the aggregate status of all the health checks. The value of <see cref="Status"/>
|
/// Gets a <see cref="HealthStatus"/> representing the aggregate status of all the health checks. The value of <see cref="Status"/>
|
||||||
/// will be the most servere status reported by a health check. If no checks were executed, the value is always <see cref="HealthStatus.Healthy"/>.
|
/// will be the most severe status reported by a health check. If no checks were executed, the value is always <see cref="HealthStatus.Healthy"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public HealthStatus Status { get; }
|
public HealthStatus Status { get; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
|
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>@dotnet/jsinterop</PackageId>
|
<PackageId>@microsoft/dotnet-js-interop</PackageId>
|
||||||
<IsPackable>true</IsPackable>
|
<IsPackable>true</IsPackable>
|
||||||
<IsTestProject>false</IsTestProject>
|
<IsTestProject>false</IsTestProject>
|
||||||
<IsShipping>true</IsShipping>
|
<IsShipping>true</IsShipping>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@dotnet/jsinterop",
|
"name": "@microsoft/dotnet-js-interop",
|
||||||
"version": "3.0.0-dev",
|
"version": "5.0.0-dev",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@dotnet/jsinterop",
|
"name": "@microsoft/dotnet-js-interop",
|
||||||
"version": "3.0.0-dev",
|
"version": "5.0.0-dev",
|
||||||
"description": "Provides abstractions and features for interop between .NET and JavaScript code.",
|
"description": "Provides abstractions and features for interop between .NET and JavaScript code.",
|
||||||
"main": "dist/Microsoft.JSInterop.js",
|
"main": "dist/Microsoft.JSInterop.js",
|
||||||
"types": "dist/Microsoft.JSInterop.d.js",
|
"types": "dist/Microsoft.JSInterop.d.js",
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ namespace Microsoft.JSInterop
|
||||||
/// Invokes the specified JavaScript function synchronously.
|
/// Invokes the specified JavaScript function synchronously.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">The JSON-serializable return type.</typeparam>
|
/// <typeparam name="T">The JSON-serializable return type.</typeparam>
|
||||||
/// <param name="identifier">An identifier for the function to invoke. For example, the value <code>"someScope.someFunction"</code> will invoke the function <code>window.someScope.someFunction</code>.</param>
|
/// <param name="identifier">An identifier for the function to invoke. For example, the value <c>"someScope.someFunction"</c> will invoke the function <c>window.someScope.someFunction</c>.</param>
|
||||||
/// <param name="args">JSON-serializable arguments.</param>
|
/// <param name="args">JSON-serializable arguments.</param>
|
||||||
/// <returns>An instance of <typeparamref name="T"/> obtained by JSON-deserializing the return value.</returns>
|
/// <returns>An instance of <typeparamref name="T"/> obtained by JSON-deserializing the return value.</returns>
|
||||||
T Invoke<T>(string identifier, params object[] args);
|
T Invoke<T>(string identifier, params object[] args);
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ namespace Microsoft.JSInterop
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TValue">The JSON-serializable return type.</typeparam>
|
/// <typeparam name="TValue">The JSON-serializable return type.</typeparam>
|
||||||
/// <param name="identifier">An identifier for the function to invoke. For example, the value <code>"someScope.someFunction"</code> will invoke the function <code>window.someScope.someFunction</code>.</param>
|
/// <param name="identifier">An identifier for the function to invoke. For example, the value <c>"someScope.someFunction"</c> will invoke the function <c>window.someScope.someFunction</c>.</param>
|
||||||
/// <param name="args">JSON-serializable arguments.</param>
|
/// <param name="args">JSON-serializable arguments.</param>
|
||||||
/// <returns>An instance of <typeparamref name="TValue"/> obtained by JSON-deserializing the return value.</returns>
|
/// <returns>An instance of <typeparamref name="TValue"/> obtained by JSON-deserializing the return value.</returns>
|
||||||
ValueTask<TValue> InvokeAsync<TValue>(string identifier, object[] args);
|
ValueTask<TValue> InvokeAsync<TValue>(string identifier, object[] args);
|
||||||
|
|
@ -28,7 +28,7 @@ namespace Microsoft.JSInterop
|
||||||
/// Invokes the specified JavaScript function asynchronously.
|
/// Invokes the specified JavaScript function asynchronously.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TValue">The JSON-serializable return type.</typeparam>
|
/// <typeparam name="TValue">The JSON-serializable return type.</typeparam>
|
||||||
/// <param name="identifier">An identifier for the function to invoke. For example, the value <code>"someScope.someFunction"</code> will invoke the function <code>window.someScope.someFunction</code>.</param>
|
/// <param name="identifier">An identifier for the function to invoke. For example, the value <c>"someScope.someFunction"</c> will invoke the function <c>window.someScope.someFunction</c>.</param>
|
||||||
/// <param name="cancellationToken">
|
/// <param name="cancellationToken">
|
||||||
/// A cancellation token to signal the cancellation of the operation. Specifying this parameter will override any default cancellations such as due to timeouts
|
/// A cancellation token to signal the cancellation of the operation. Specifying this parameter will override any default cancellations such as due to timeouts
|
||||||
/// (<see cref="JSRuntime.DefaultAsyncTimeout"/>) from being applied.
|
/// (<see cref="JSRuntime.DefaultAsyncTimeout"/>) from being applied.
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ namespace Microsoft.JSInterop
|
||||||
/// Invokes the specified JavaScript function synchronously.
|
/// Invokes the specified JavaScript function synchronously.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TValue">The JSON-serializable return type.</typeparam>
|
/// <typeparam name="TValue">The JSON-serializable return type.</typeparam>
|
||||||
/// <param name="identifier">An identifier for the function to invoke. For example, the value <code>"someScope.someFunction"</code> will invoke the function <code>window.someScope.someFunction</code>.</param>
|
/// <param name="identifier">An identifier for the function to invoke. For example, the value <c>"someScope.someFunction"</c> will invoke the function <c>window.someScope.someFunction</c>.</param>
|
||||||
/// <param name="args">JSON-serializable arguments.</param>
|
/// <param name="args">JSON-serializable arguments.</param>
|
||||||
/// <returns>An instance of <typeparamref name="TValue"/> obtained by JSON-deserializing the return value.</returns>
|
/// <returns>An instance of <typeparamref name="TValue"/> obtained by JSON-deserializing the return value.</returns>
|
||||||
public TValue Invoke<TValue>(string identifier, params object[] args)
|
public TValue Invoke<TValue>(string identifier, params object[] args)
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ namespace Microsoft.JSInterop
|
||||||
/// Invokes the specified JavaScript function synchronously.
|
/// Invokes the specified JavaScript function synchronously.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="jsRuntime">The <see cref="IJSInProcessRuntime"/>.</param>
|
/// <param name="jsRuntime">The <see cref="IJSInProcessRuntime"/>.</param>
|
||||||
/// <param name="identifier">An identifier for the function to invoke. For example, the value <code>"someScope.someFunction"</code> will invoke the function <code>window.someScope.someFunction</code>.</param>
|
/// <param name="identifier">An identifier for the function to invoke. For example, the value <c>"someScope.someFunction"</c> will invoke the function <c>window.someScope.someFunction</c>.</param>
|
||||||
/// <param name="args">JSON-serializable arguments.</param>
|
/// <param name="args">JSON-serializable arguments.</param>
|
||||||
public static void InvokeVoid(this IJSInProcessRuntime jsRuntime, string identifier, params object[] args)
|
public static void InvokeVoid(this IJSInProcessRuntime jsRuntime, string identifier, params object[] args)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ namespace Microsoft.JSInterop
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TValue">The JSON-serializable return type.</typeparam>
|
/// <typeparam name="TValue">The JSON-serializable return type.</typeparam>
|
||||||
/// <param name="identifier">An identifier for the function to invoke. For example, the value <code>"someScope.someFunction"</code> will invoke the function <code>window.someScope.someFunction</code>.</param>
|
/// <param name="identifier">An identifier for the function to invoke. For example, the value <c>"someScope.someFunction"</c> will invoke the function <c>window.someScope.someFunction</c>.</param>
|
||||||
/// <param name="args">JSON-serializable arguments.</param>
|
/// <param name="args">JSON-serializable arguments.</param>
|
||||||
/// <returns>An instance of <typeparamref name="TValue"/> obtained by JSON-deserializing the return value.</returns>
|
/// <returns>An instance of <typeparamref name="TValue"/> obtained by JSON-deserializing the return value.</returns>
|
||||||
public ValueTask<TValue> InvokeAsync<TValue>(string identifier, object[] args)
|
public ValueTask<TValue> InvokeAsync<TValue>(string identifier, object[] args)
|
||||||
|
|
@ -76,7 +76,7 @@ namespace Microsoft.JSInterop
|
||||||
/// Invokes the specified JavaScript function asynchronously.
|
/// Invokes the specified JavaScript function asynchronously.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TValue">The JSON-serializable return type.</typeparam>
|
/// <typeparam name="TValue">The JSON-serializable return type.</typeparam>
|
||||||
/// <param name="identifier">An identifier for the function to invoke. For example, the value <code>"someScope.someFunction"</code> will invoke the function <code>window.someScope.someFunction</code>.</param>
|
/// <param name="identifier">An identifier for the function to invoke. For example, the value <c>"someScope.someFunction"</c> will invoke the function <c>window.someScope.someFunction</c>.</param>
|
||||||
/// <param name="cancellationToken">
|
/// <param name="cancellationToken">
|
||||||
/// A cancellation token to signal the cancellation of the operation. Specifying this parameter will override any default cancellations such as due to timeouts
|
/// A cancellation token to signal the cancellation of the operation. Specifying this parameter will override any default cancellations such as due to timeouts
|
||||||
/// (<see cref="JSRuntime.DefaultAsyncTimeout"/>) from being applied.
|
/// (<see cref="JSRuntime.DefaultAsyncTimeout"/>) from being applied.
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ namespace Microsoft.JSInterop
|
||||||
/// Invokes the specified JavaScript function asynchronously.
|
/// Invokes the specified JavaScript function asynchronously.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="jsRuntime">The <see cref="IJSRuntime"/>.</param>
|
/// <param name="jsRuntime">The <see cref="IJSRuntime"/>.</param>
|
||||||
/// <param name="identifier">An identifier for the function to invoke. For example, the value <code>"someScope.someFunction"</code> will invoke the function <code>window.someScope.someFunction</code>.</param>
|
/// <param name="identifier">An identifier for the function to invoke. For example, the value <c>"someScope.someFunction"</c> will invoke the function <c>window.someScope.someFunction</c>.</param>
|
||||||
/// <param name="args">JSON-serializable arguments.</param>
|
/// <param name="args">JSON-serializable arguments.</param>
|
||||||
/// <returns>A <see cref="ValueTask"/> that represents the asynchronous invocation operation.</returns>
|
/// <returns>A <see cref="ValueTask"/> that represents the asynchronous invocation operation.</returns>
|
||||||
public static async ValueTask InvokeVoidAsync(this IJSRuntime jsRuntime, string identifier, params object[] args)
|
public static async ValueTask InvokeVoidAsync(this IJSRuntime jsRuntime, string identifier, params object[] args)
|
||||||
|
|
@ -38,7 +38,7 @@ namespace Microsoft.JSInterop
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="jsRuntime">The <see cref="IJSRuntime"/>.</param>
|
/// <param name="jsRuntime">The <see cref="IJSRuntime"/>.</param>
|
||||||
/// <typeparam name="TValue">The JSON-serializable return type.</typeparam>
|
/// <typeparam name="TValue">The JSON-serializable return type.</typeparam>
|
||||||
/// <param name="identifier">An identifier for the function to invoke. For example, the value <code>"someScope.someFunction"</code> will invoke the function <code>window.someScope.someFunction</code>.</param>
|
/// <param name="identifier">An identifier for the function to invoke. For example, the value <c>"someScope.someFunction"</c> will invoke the function <c>window.someScope.someFunction</c>.</param>
|
||||||
/// <param name="args">JSON-serializable arguments.</param>
|
/// <param name="args">JSON-serializable arguments.</param>
|
||||||
/// <returns>An instance of <typeparamref name="TValue"/> obtained by JSON-deserializing the return value.</returns>
|
/// <returns>An instance of <typeparamref name="TValue"/> obtained by JSON-deserializing the return value.</returns>
|
||||||
public static ValueTask<TValue> InvokeAsync<TValue>(this IJSRuntime jsRuntime, string identifier, params object[] args)
|
public static ValueTask<TValue> InvokeAsync<TValue>(this IJSRuntime jsRuntime, string identifier, params object[] args)
|
||||||
|
|
@ -56,7 +56,7 @@ namespace Microsoft.JSInterop
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TValue">The JSON-serializable return type.</typeparam>
|
/// <typeparam name="TValue">The JSON-serializable return type.</typeparam>
|
||||||
/// <param name="jsRuntime">The <see cref="IJSRuntime"/>.</param>
|
/// <param name="jsRuntime">The <see cref="IJSRuntime"/>.</param>
|
||||||
/// <param name="identifier">An identifier for the function to invoke. For example, the value <code>"someScope.someFunction"</code> will invoke the function <code>window.someScope.someFunction</code>.</param>
|
/// <param name="identifier">An identifier for the function to invoke. For example, the value <c>"someScope.someFunction"</c> will invoke the function <c>window.someScope.someFunction</c>.</param>
|
||||||
/// <param name="cancellationToken">
|
/// <param name="cancellationToken">
|
||||||
/// A cancellation token to signal the cancellation of the operation. Specifying this parameter will override any default cancellations such as due to timeouts
|
/// A cancellation token to signal the cancellation of the operation. Specifying this parameter will override any default cancellations such as due to timeouts
|
||||||
/// (<see cref="JSRuntime.DefaultAsyncTimeout"/>) from being applied.
|
/// (<see cref="JSRuntime.DefaultAsyncTimeout"/>) from being applied.
|
||||||
|
|
@ -77,7 +77,7 @@ namespace Microsoft.JSInterop
|
||||||
/// Invokes the specified JavaScript function asynchronously.
|
/// Invokes the specified JavaScript function asynchronously.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="jsRuntime">The <see cref="IJSRuntime"/>.</param>
|
/// <param name="jsRuntime">The <see cref="IJSRuntime"/>.</param>
|
||||||
/// <param name="identifier">An identifier for the function to invoke. For example, the value <code>"someScope.someFunction"</code> will invoke the function <code>window.someScope.someFunction</code>.</param>
|
/// <param name="identifier">An identifier for the function to invoke. For example, the value <c>"someScope.someFunction"</c> will invoke the function <c>window.someScope.someFunction</c>.</param>
|
||||||
/// <param name="cancellationToken">
|
/// <param name="cancellationToken">
|
||||||
/// A cancellation token to signal the cancellation of the operation. Specifying this parameter will override any default cancellations such as due to timeouts
|
/// A cancellation token to signal the cancellation of the operation. Specifying this parameter will override any default cancellations such as due to timeouts
|
||||||
/// (<see cref="JSRuntime.DefaultAsyncTimeout"/>) from being applied.
|
/// (<see cref="JSRuntime.DefaultAsyncTimeout"/>) from being applied.
|
||||||
|
|
@ -98,7 +98,7 @@ namespace Microsoft.JSInterop
|
||||||
/// Invokes the specified JavaScript function asynchronously.
|
/// Invokes the specified JavaScript function asynchronously.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="jsRuntime">The <see cref="IJSRuntime"/>.</param>
|
/// <param name="jsRuntime">The <see cref="IJSRuntime"/>.</param>
|
||||||
/// <param name="identifier">An identifier for the function to invoke. For example, the value <code>"someScope.someFunction"</code> will invoke the function <code>window.someScope.someFunction</code>.</param>
|
/// <param name="identifier">An identifier for the function to invoke. For example, the value <c>"someScope.someFunction"</c> will invoke the function <c>window.someScope.someFunction</c>.</param>
|
||||||
/// <param name="timeout">The duration after which to cancel the async operation. Overrides default timeouts (<see cref="JSRuntime.DefaultAsyncTimeout"/>).</param>
|
/// <param name="timeout">The duration after which to cancel the async operation. Overrides default timeouts (<see cref="JSRuntime.DefaultAsyncTimeout"/>).</param>
|
||||||
/// <param name="args">JSON-serializable arguments.</param>
|
/// <param name="args">JSON-serializable arguments.</param>
|
||||||
/// <returns>A <see cref="ValueTask"/> that represents the asynchronous invocation operation.</returns>
|
/// <returns>A <see cref="ValueTask"/> that represents the asynchronous invocation operation.</returns>
|
||||||
|
|
@ -120,7 +120,7 @@ namespace Microsoft.JSInterop
|
||||||
/// Invokes the specified JavaScript function asynchronously.
|
/// Invokes the specified JavaScript function asynchronously.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="jsRuntime">The <see cref="IJSRuntime"/>.</param>
|
/// <param name="jsRuntime">The <see cref="IJSRuntime"/>.</param>
|
||||||
/// <param name="identifier">An identifier for the function to invoke. For example, the value <code>"someScope.someFunction"</code> will invoke the function <code>window.someScope.someFunction</code>.</param>
|
/// <param name="identifier">An identifier for the function to invoke. For example, the value <c>"someScope.someFunction"</c> will invoke the function <c>window.someScope.someFunction</c>.</param>
|
||||||
/// <param name="timeout">The duration after which to cancel the async operation. Overrides default timeouts (<see cref="JSRuntime.DefaultAsyncTimeout"/>).</param>
|
/// <param name="timeout">The duration after which to cancel the async operation. Overrides default timeouts (<see cref="JSRuntime.DefaultAsyncTimeout"/>).</param>
|
||||||
/// <param name="args">JSON-serializable arguments.</param>
|
/// <param name="args">JSON-serializable arguments.</param>
|
||||||
/// <returns>A <see cref="ValueTask"/> that represents the asynchronous invocation operation.</returns>
|
/// <returns>A <see cref="ValueTask"/> that represents the asynchronous invocation operation.</returns>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
@ECHO OFF
|
||||||
|
|
||||||
|
%~dp0..\..\startvs.cmd %~dp0JSInterop.slnf
|
||||||
|
|
@ -101,9 +101,8 @@ namespace Microsoft.Extensions.Localization
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// This expectation is defined by dotnet's automatic resource storage.
|
// This expectation is defined by dotnet's automatic resource storage.
|
||||||
// We have to conform to "{RootNamespace}.{ResourceLocation}.{FullTypeName - AssemblyName}".
|
// We have to conform to "{RootNamespace}.{ResourceLocation}.{FullTypeName - RootNamespace}".
|
||||||
var assemblyName = new AssemblyName(typeInfo.Assembly.FullName).Name;
|
return baseNamespace + "." + resourcesRelativePath + TrimPrefix(typeInfo.FullName, baseNamespace + ".");
|
||||||
return baseNamespace + "." + resourcesRelativePath + TrimPrefix(typeInfo.FullName, assemblyName + ".");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using Microsoft.Extensions.Localization;
|
||||||
|
|
||||||
|
[assembly: ResourceLocation("Resources")]
|
||||||
|
[assembly: RootNamespace("LocalizationTest.Abc")]
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
namespace LocalizationTest.Abc.Controllers
|
||||||
|
{
|
||||||
|
public class ValuesController
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFrameworks>$(DefaultNetCoreTargetFramework);net472</TargetFrameworks>
|
||||||
|
<RootNamespace>LocalizationTest.Abc</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="NewFolder\**" />
|
||||||
|
<EmbeddedResource Remove="NewFolder\**" />
|
||||||
|
<None Remove="NewFolder\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Microsoft.Extensions.Localization.Abstractions" />
|
||||||
|
<Reference Include="Microsoft.Extensions.Localization" />
|
||||||
|
<Reference Include="Microsoft.Extensions.Logging.Abstractions" />
|
||||||
|
<Reference Include="Microsoft.Extensions.Logging.Testing" />
|
||||||
|
<Reference Include="Microsoft.Extensions.Options" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Update="ValuesController.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>ValuesController.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,123 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<data name="String1" xml:space="preserve">
|
||||||
|
<value>ValFromResource</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using LocalizationTest.Abc.Controllers;
|
||||||
|
using Microsoft.Extensions.Logging.Abstractions;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using Moq;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.Extensions.Localization.RootNamespace.Tests
|
||||||
|
{
|
||||||
|
public class StringLocalizerOfTRootNamespaceTest
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void RootNamespace()
|
||||||
|
{
|
||||||
|
var locOptions = new LocalizationOptions();
|
||||||
|
var options = new Mock<IOptions<LocalizationOptions>>();
|
||||||
|
options.Setup(o => o.Value).Returns(locOptions);
|
||||||
|
var factory = new ResourceManagerStringLocalizerFactory(options.Object, NullLoggerFactory.Instance);
|
||||||
|
|
||||||
|
var valuesLoc = factory.Create(typeof(ValuesController));
|
||||||
|
Assert.Equal("ValFromResource", valuesLoc["String1"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
// This namespace for test resources with alternative RootNamespace
|
||||||
|
namespace MyNamespace
|
||||||
|
{
|
||||||
|
public class Model
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -7,6 +7,7 @@ using System.Reflection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging.Abstractions;
|
using Microsoft.Extensions.Logging.Abstractions;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
using MyNamespace;
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
|
@ -132,7 +133,7 @@ namespace Microsoft.Extensions.Localization.Tests
|
||||||
var loggerFactory = NullLoggerFactory.Instance;
|
var loggerFactory = NullLoggerFactory.Instance;
|
||||||
|
|
||||||
var resourcePath = Path.Combine("My", "Resources");
|
var resourcePath = Path.Combine("My", "Resources");
|
||||||
var rootNamespace = "MyNamespace";
|
var rootNamespace = nameof(MyNamespace);
|
||||||
var rootNamespaceAttribute = new RootNamespaceAttribute(rootNamespace);
|
var rootNamespaceAttribute = new RootNamespaceAttribute(rootNamespace);
|
||||||
|
|
||||||
var typeFactory = new TestResourceManagerStringLocalizerFactory(
|
var typeFactory = new TestResourceManagerStringLocalizerFactory(
|
||||||
|
|
@ -141,12 +142,13 @@ namespace Microsoft.Extensions.Localization.Tests
|
||||||
rootNamespaceAttribute: rootNamespaceAttribute,
|
rootNamespaceAttribute: rootNamespaceAttribute,
|
||||||
loggerFactory: loggerFactory);
|
loggerFactory: loggerFactory);
|
||||||
|
|
||||||
var type = typeof(ResourceManagerStringLocalizerFactoryTest);
|
var type = typeof(Model);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
typeFactory.Create(type);
|
typeFactory.Create(type);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal($"Microsoft.Extensions.Localization.Tests.ResourceManagerStringLocalizerFactoryTest", typeFactory.BaseName);
|
Assert.Equal($"{rootNamespace}.{nameof(Model)}", typeFactory.BaseName);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -159,7 +161,7 @@ namespace Microsoft.Extensions.Localization.Tests
|
||||||
var loggerFactory = NullLoggerFactory.Instance;
|
var loggerFactory = NullLoggerFactory.Instance;
|
||||||
|
|
||||||
var resourcePath = Path.Combine("My", "Resources");
|
var resourcePath = Path.Combine("My", "Resources");
|
||||||
var rootNamespace = "MyNamespace";
|
var rootNamespace = nameof(MyNamespace);
|
||||||
var resourceLocationAttribute = new ResourceLocationAttribute(resourcePath);
|
var resourceLocationAttribute = new ResourceLocationAttribute(resourcePath);
|
||||||
var rootNamespaceAttribute = new RootNamespaceAttribute(rootNamespace);
|
var rootNamespaceAttribute = new RootNamespaceAttribute(rootNamespace);
|
||||||
|
|
||||||
|
|
@ -169,12 +171,13 @@ namespace Microsoft.Extensions.Localization.Tests
|
||||||
rootNamespaceAttribute,
|
rootNamespaceAttribute,
|
||||||
loggerFactory);
|
loggerFactory);
|
||||||
|
|
||||||
var type = typeof(ResourceManagerStringLocalizerFactoryTest);
|
var type = typeof(Model);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
typeFactory.Create(type);
|
typeFactory.Create(type);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal($"MyNamespace.My.Resources.ResourceManagerStringLocalizerFactoryTest", typeFactory.BaseName);
|
Assert.Equal($"{rootNamespace}.My.Resources.{nameof(Model)}", typeFactory.BaseName);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
namespace Microsoft.Extensions.ObjectPool
|
namespace Microsoft.Extensions.ObjectPool
|
||||||
|
|
@ -19,7 +19,7 @@ namespace Microsoft.Extensions.ObjectPool
|
||||||
/// Runs some processing when an object was returned to the pool. Can be used to reset the state of an object and indicate if the object should be returned to the pool.
|
/// Runs some processing when an object was returned to the pool. Can be used to reset the state of an object and indicate if the object should be returned to the pool.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="obj">The object to return to the pool.</param>
|
/// <param name="obj">The object to return to the pool.</param>
|
||||||
/// <returns><code>true</code> if the object should be returned to the pool. <code>false</code> if it's not possible/desirable for the pool to keep the object.</returns>
|
/// <returns><see langword="true" /> if the object should be returned to the pool. <see langword="false" /> if it's not possible/desirable for the pool to keep the object.</returns>
|
||||||
bool Return(T obj);
|
bool Return(T obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,8 @@ namespace BenchmarkDotNet.Attributes
|
||||||
.With(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp3.0", null, ".NET Core 3.0")))
|
.With(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp3.0", null, ".NET Core 3.0")))
|
||||||
#elif NETCOREAPP3_1
|
#elif NETCOREAPP3_1
|
||||||
.With(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp3.1", null, ".NET Core 3.1")))
|
.With(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp3.1", null, ".NET Core 3.1")))
|
||||||
|
#elif NETCOREAPP5_0
|
||||||
|
.With(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp5.0", null, ".NET Core 5.0")))
|
||||||
#else
|
#else
|
||||||
#error Target frameworks need to be updated.
|
#error Target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Microsoft.Extensions.Internal
|
namespace Microsoft.Extensions.Internal
|
||||||
{
|
{
|
||||||
internal class TypeNameHelper
|
internal static class TypeNameHelper
|
||||||
{
|
{
|
||||||
private const char DefaultNestedTypeDelimiter = '+';
|
private const char DefaultNestedTypeDelimiter = '+';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -170,6 +170,13 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
System.Threading.Tasks.Task OnTestStartAsync(Microsoft.AspNetCore.Testing.TestContext context, System.Threading.CancellationToken cancellationToken);
|
System.Threading.Tasks.Task OnTestStartAsync(Microsoft.AspNetCore.Testing.TestContext context, System.Threading.CancellationToken cancellationToken);
|
||||||
}
|
}
|
||||||
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true)]
|
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true)]
|
||||||
|
public partial class MaximumOSVersionAttribute : System.Attribute, Microsoft.AspNetCore.Testing.ITestCondition
|
||||||
|
{
|
||||||
|
public MaximumOSVersionAttribute(Microsoft.AspNetCore.Testing.OperatingSystems operatingSystem, string maxVersion) { }
|
||||||
|
public bool IsMet { get { throw null; } }
|
||||||
|
public string SkipReason { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
|
||||||
|
}
|
||||||
|
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true)]
|
||||||
public partial class MinimumOSVersionAttribute : System.Attribute, Microsoft.AspNetCore.Testing.ITestCondition
|
public partial class MinimumOSVersionAttribute : System.Attribute, Microsoft.AspNetCore.Testing.ITestCondition
|
||||||
{
|
{
|
||||||
public MinimumOSVersionAttribute(Microsoft.AspNetCore.Testing.OperatingSystems operatingSystem, string minVersion) { }
|
public MinimumOSVersionAttribute(Microsoft.AspNetCore.Testing.OperatingSystems operatingSystem, string minVersion) { }
|
||||||
|
|
@ -186,6 +193,8 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true)]
|
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true)]
|
||||||
public partial class OSSkipConditionAttribute : System.Attribute, Microsoft.AspNetCore.Testing.ITestCondition
|
public partial class OSSkipConditionAttribute : System.Attribute, Microsoft.AspNetCore.Testing.ITestCondition
|
||||||
{
|
{
|
||||||
|
public OSSkipConditionAttribute(Microsoft.AspNetCore.Testing.OperatingSystems operatingSystem) { }
|
||||||
|
[System.ObsoleteAttribute("Use the Minimum/MaximumOSVersionAttribute for version checks.", true)]
|
||||||
public OSSkipConditionAttribute(Microsoft.AspNetCore.Testing.OperatingSystems operatingSystem, params string[] versions) { }
|
public OSSkipConditionAttribute(Microsoft.AspNetCore.Testing.OperatingSystems operatingSystem, params string[] versions) { }
|
||||||
public bool IsMet { get { throw null; } }
|
public bool IsMet { get { throw null; } }
|
||||||
public string SkipReason { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
|
public string SkipReason { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
|
||||||
|
|
@ -319,9 +328,12 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
public static partial class WindowsVersions
|
public static partial class WindowsVersions
|
||||||
{
|
{
|
||||||
public const string Win10 = "10.0";
|
public const string Win10 = "10.0";
|
||||||
|
public const string Win10_19H1 = "10.0.18362";
|
||||||
public const string Win10_19H2 = "10.0.18363";
|
public const string Win10_19H2 = "10.0.18363";
|
||||||
public const string Win10_20H1 = "10.0.18990";
|
public const string Win10_20H1 = "10.0.19033";
|
||||||
public const string Win10_RS4 = "10.0.17134";
|
public const string Win10_RS4 = "10.0.17134";
|
||||||
|
public const string Win10_RS5 = "10.0.17763";
|
||||||
|
[System.ObsoleteAttribute("Use Win7 instead.", true)]
|
||||||
public const string Win2008R2 = "6.1";
|
public const string Win2008R2 = "6.1";
|
||||||
public const string Win7 = "6.1";
|
public const string Win7 = "6.1";
|
||||||
public const string Win8 = "6.2";
|
public const string Win8 = "6.2";
|
||||||
|
|
|
||||||
|
|
@ -170,6 +170,13 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
System.Threading.Tasks.Task OnTestStartAsync(Microsoft.AspNetCore.Testing.TestContext context, System.Threading.CancellationToken cancellationToken);
|
System.Threading.Tasks.Task OnTestStartAsync(Microsoft.AspNetCore.Testing.TestContext context, System.Threading.CancellationToken cancellationToken);
|
||||||
}
|
}
|
||||||
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true)]
|
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true)]
|
||||||
|
public partial class MaximumOSVersionAttribute : System.Attribute, Microsoft.AspNetCore.Testing.ITestCondition
|
||||||
|
{
|
||||||
|
public MaximumOSVersionAttribute(Microsoft.AspNetCore.Testing.OperatingSystems operatingSystem, string maxVersion) { }
|
||||||
|
public bool IsMet { get { throw null; } }
|
||||||
|
public string SkipReason { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
|
||||||
|
}
|
||||||
|
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true)]
|
||||||
public partial class MinimumOSVersionAttribute : System.Attribute, Microsoft.AspNetCore.Testing.ITestCondition
|
public partial class MinimumOSVersionAttribute : System.Attribute, Microsoft.AspNetCore.Testing.ITestCondition
|
||||||
{
|
{
|
||||||
public MinimumOSVersionAttribute(Microsoft.AspNetCore.Testing.OperatingSystems operatingSystem, string minVersion) { }
|
public MinimumOSVersionAttribute(Microsoft.AspNetCore.Testing.OperatingSystems operatingSystem, string minVersion) { }
|
||||||
|
|
@ -186,6 +193,8 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true)]
|
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true)]
|
||||||
public partial class OSSkipConditionAttribute : System.Attribute, Microsoft.AspNetCore.Testing.ITestCondition
|
public partial class OSSkipConditionAttribute : System.Attribute, Microsoft.AspNetCore.Testing.ITestCondition
|
||||||
{
|
{
|
||||||
|
public OSSkipConditionAttribute(Microsoft.AspNetCore.Testing.OperatingSystems operatingSystem) { }
|
||||||
|
[System.ObsoleteAttribute("Use the Minimum/MaximumOSVersionAttribute for version checks.", true)]
|
||||||
public OSSkipConditionAttribute(Microsoft.AspNetCore.Testing.OperatingSystems operatingSystem, params string[] versions) { }
|
public OSSkipConditionAttribute(Microsoft.AspNetCore.Testing.OperatingSystems operatingSystem, params string[] versions) { }
|
||||||
public bool IsMet { get { throw null; } }
|
public bool IsMet { get { throw null; } }
|
||||||
public string SkipReason { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
|
public string SkipReason { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
|
||||||
|
|
@ -319,9 +328,12 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
public static partial class WindowsVersions
|
public static partial class WindowsVersions
|
||||||
{
|
{
|
||||||
public const string Win10 = "10.0";
|
public const string Win10 = "10.0";
|
||||||
|
public const string Win10_19H1 = "10.0.18362";
|
||||||
public const string Win10_19H2 = "10.0.18363";
|
public const string Win10_19H2 = "10.0.18363";
|
||||||
public const string Win10_20H1 = "10.0.18990";
|
public const string Win10_20H1 = "10.0.19033";
|
||||||
public const string Win10_RS4 = "10.0.17134";
|
public const string Win10_RS4 = "10.0.17134";
|
||||||
|
public const string Win10_RS5 = "10.0.17763";
|
||||||
|
[System.ObsoleteAttribute("Use Win7 instead.", true)]
|
||||||
public const string Win2008R2 = "6.1";
|
public const string Win2008R2 = "6.1";
|
||||||
public const string Win7 = "6.1";
|
public const string Win7 = "6.1";
|
||||||
public const string Win8 = "6.2";
|
public const string Win8 = "6.2";
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
/// properties. Once these traits are applied, build scripts can include/exclude tests based on them.
|
/// properties. Once these traits are applied, build scripts can include/exclude tests based on them.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// <para>
|
/// <para>
|
||||||
/// All flakiness-related traits start with <code>Flaky:</code> and are grouped first by the process running the tests: Azure Pipelines (AzP) or Helix.
|
/// All flakiness-related traits start with <c>Flaky:</c> and are grouped first by the process running the tests: Azure Pipelines (AzP) or Helix.
|
||||||
/// Then there is a segment specifying the "selector" which indicates where the test is flaky. Finally a segment specifying the value of that selector.
|
/// Then there is a segment specifying the "selector" which indicates where the test is flaky. Finally a segment specifying the value of that selector.
|
||||||
/// The value of these traits is always either "true" or the trait is not present. We encode the entire selector in the name of the trait because xUnit.net only
|
/// The value of these traits is always either "true" or the trait is not present. We encode the entire selector in the name of the trait because xUnit.net only
|
||||||
/// provides "==" and "!=" operators for traits, there is no way to check if a trait "contains" or "does not contain" a value. VSTest does support "contains" checks
|
/// provides "==" and "!=" operators for traits, there is no way to check if a trait "contains" or "does not contain" a value. VSTest does support "contains" checks
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Testing
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Skips a test if the OS is the given type (Windows) and the OS version is greater than specified.
|
||||||
|
/// E.g. Specifying Window 8 skips on Win 10, but not on Linux. Combine with OSSkipConditionAttribute as needed.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true)]
|
||||||
|
public class MaximumOSVersionAttribute : Attribute, ITestCondition
|
||||||
|
{
|
||||||
|
private readonly OperatingSystems _targetOS;
|
||||||
|
private readonly Version _maxVersion;
|
||||||
|
private readonly OperatingSystems _currentOS;
|
||||||
|
private readonly Version _currentVersion;
|
||||||
|
private readonly bool _skip;
|
||||||
|
|
||||||
|
public MaximumOSVersionAttribute(OperatingSystems operatingSystem, string maxVersion) :
|
||||||
|
this(operatingSystem, Version.Parse(maxVersion), GetCurrentOS(), GetCurrentOSVersion())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// to enable unit testing
|
||||||
|
internal MaximumOSVersionAttribute(OperatingSystems targetOS, Version maxVersion, OperatingSystems currentOS, Version currentVersion)
|
||||||
|
{
|
||||||
|
if (targetOS != OperatingSystems.Windows)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException("Max version support is only implemented for Windows.");
|
||||||
|
}
|
||||||
|
_targetOS = targetOS;
|
||||||
|
_maxVersion = maxVersion;
|
||||||
|
_currentOS = currentOS;
|
||||||
|
// We drop the 4th field because it is not significant and it messes up the comparisons.
|
||||||
|
_currentVersion = new Version(currentVersion.Major, currentVersion.Minor,
|
||||||
|
// Major and Minor are required by the parser, but if Build isn't specified then it returns -1
|
||||||
|
// which the constructor rejects.
|
||||||
|
currentVersion.Build == -1 ? 0 : currentVersion.Build);
|
||||||
|
|
||||||
|
// Do not skip other OS's, Use OSSkipConditionAttribute or a separate MaximumOsVersionAttribute for that.
|
||||||
|
_skip = _targetOS == _currentOS && _maxVersion < _currentVersion;
|
||||||
|
SkipReason = $"This test requires {_targetOS} {_maxVersion} or earlier.";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Since a test would be executed only if 'IsMet' is true, return false if we want to skip
|
||||||
|
public bool IsMet => !_skip;
|
||||||
|
|
||||||
|
public string SkipReason { get; set; }
|
||||||
|
|
||||||
|
private static OperatingSystems GetCurrentOS()
|
||||||
|
{
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
|
{
|
||||||
|
return OperatingSystems.Windows;
|
||||||
|
}
|
||||||
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||||
|
{
|
||||||
|
return OperatingSystems.Linux;
|
||||||
|
}
|
||||||
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||||
|
{
|
||||||
|
return OperatingSystems.MacOSX;
|
||||||
|
}
|
||||||
|
throw new PlatformNotSupportedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
static private Version GetCurrentOSVersion()
|
||||||
|
{
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
|
{
|
||||||
|
return Environment.OSVersion.Version;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Not implemented, but this will still be called before the OS check happens so don't throw.
|
||||||
|
return new Version(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Testing
|
namespace Microsoft.AspNetCore.Testing
|
||||||
|
|
@ -12,46 +10,31 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
public class OSSkipConditionAttribute : Attribute, ITestCondition
|
public class OSSkipConditionAttribute : Attribute, ITestCondition
|
||||||
{
|
{
|
||||||
private readonly OperatingSystems _excludedOperatingSystem;
|
private readonly OperatingSystems _excludedOperatingSystem;
|
||||||
private readonly IEnumerable<string> _excludedVersions;
|
|
||||||
private readonly OperatingSystems _osPlatform;
|
private readonly OperatingSystems _osPlatform;
|
||||||
private readonly string _osVersion;
|
|
||||||
|
|
||||||
|
public OSSkipConditionAttribute(OperatingSystems operatingSystem) :
|
||||||
|
this(operatingSystem, GetCurrentOS())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[Obsolete("Use the Minimum/MaximumOSVersionAttribute for version checks.", error: true)]
|
||||||
public OSSkipConditionAttribute(OperatingSystems operatingSystem, params string[] versions) :
|
public OSSkipConditionAttribute(OperatingSystems operatingSystem, params string[] versions) :
|
||||||
this(
|
this(operatingSystem, GetCurrentOS())
|
||||||
operatingSystem,
|
|
||||||
GetCurrentOS(),
|
|
||||||
GetCurrentOSVersion(),
|
|
||||||
versions)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// to enable unit testing
|
// to enable unit testing
|
||||||
internal OSSkipConditionAttribute(
|
internal OSSkipConditionAttribute(OperatingSystems operatingSystem, OperatingSystems osPlatform)
|
||||||
OperatingSystems operatingSystem, OperatingSystems osPlatform, string osVersion, params string[] versions)
|
|
||||||
{
|
{
|
||||||
_excludedOperatingSystem = operatingSystem;
|
_excludedOperatingSystem = operatingSystem;
|
||||||
_excludedVersions = versions ?? Enumerable.Empty<string>();
|
|
||||||
_osPlatform = osPlatform;
|
_osPlatform = osPlatform;
|
||||||
_osVersion = osVersion;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsMet
|
public bool IsMet
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var currentOSInfo = new OSInfo()
|
var skip = (_excludedOperatingSystem & _osPlatform) == _osPlatform;
|
||||||
{
|
|
||||||
OperatingSystem = _osPlatform,
|
|
||||||
Version = _osVersion,
|
|
||||||
};
|
|
||||||
|
|
||||||
var skip = (_excludedOperatingSystem & currentOSInfo.OperatingSystem) == currentOSInfo.OperatingSystem;
|
|
||||||
if (_excludedVersions.Any())
|
|
||||||
{
|
|
||||||
skip = skip
|
|
||||||
&& _excludedVersions.Any(ex => _osVersion.StartsWith(ex, StringComparison.OrdinalIgnoreCase));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Since a test would be excuted only if 'IsMet' is true, return false if we want to skip
|
// Since a test would be excuted only if 'IsMet' is true, return false if we want to skip
|
||||||
return !skip;
|
return !skip;
|
||||||
}
|
}
|
||||||
|
|
@ -75,25 +58,5 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
}
|
}
|
||||||
throw new PlatformNotSupportedException();
|
throw new PlatformNotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
static private string GetCurrentOSVersion()
|
|
||||||
{
|
|
||||||
// currently not used on other OS's
|
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
||||||
{
|
|
||||||
return Environment.OSVersion.Version.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class OSInfo
|
|
||||||
{
|
|
||||||
public OperatingSystems OperatingSystem { get; set; }
|
|
||||||
|
|
||||||
public string Version { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Testing
|
namespace Microsoft.AspNetCore.Testing
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -10,6 +12,7 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
{
|
{
|
||||||
public const string Win7 = "6.1";
|
public const string Win7 = "6.1";
|
||||||
|
|
||||||
|
[Obsolete("Use Win7 instead.", error: true)]
|
||||||
public const string Win2008R2 = Win7;
|
public const string Win2008R2 = Win7;
|
||||||
|
|
||||||
public const string Win8 = "6.2";
|
public const string Win8 = "6.2";
|
||||||
|
|
@ -23,14 +26,24 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string Win10_RS4 = "10.0.17134";
|
public const string Win10_RS4 = "10.0.17134";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 1809, RS5, 17763
|
||||||
|
/// </summary>
|
||||||
|
public const string Win10_RS5 = "10.0.17763";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 1903, 19H1, 18362
|
||||||
|
/// </summary>
|
||||||
|
public const string Win10_19H1 = "10.0.18362";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 1909, 19H2, 18363
|
/// 1909, 19H2, 18363
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string Win10_19H2 = "10.0.18363";
|
public const string Win10_19H2 = "10.0.18363";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// _, 20H2, 18990
|
/// 2004, 20H1, 19033
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string Win10_20H1 = "10.0.18990";
|
public const string Win10_20H1 = "10.0.19033";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Testing
|
||||||
|
{
|
||||||
|
public class MaximumOSVersionAttributeTest
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Linux_ThrowsNotImplemeneted()
|
||||||
|
{
|
||||||
|
Assert.Throws<NotImplementedException>(() => new MaximumOSVersionAttribute(OperatingSystems.Linux, "2.5"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Mac_ThrowsNotImplemeneted()
|
||||||
|
{
|
||||||
|
Assert.Throws<NotImplementedException>(() => new MaximumOSVersionAttribute(OperatingSystems.MacOSX, "2.5"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void WindowsOrLinux_ThrowsNotImplemeneted()
|
||||||
|
{
|
||||||
|
Assert.Throws<NotImplementedException>(() => new MaximumOSVersionAttribute(OperatingSystems.Linux | OperatingSystems.Windows, "2.5"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void DoesNotSkip_ShortVersions()
|
||||||
|
{
|
||||||
|
var osSkipAttribute = new MaximumOSVersionAttribute(
|
||||||
|
OperatingSystems.Windows,
|
||||||
|
new Version("2.5"),
|
||||||
|
OperatingSystems.Windows,
|
||||||
|
new Version("2.0"));
|
||||||
|
|
||||||
|
Assert.True(osSkipAttribute.IsMet);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void DoesNotSkip_EarlierVersions()
|
||||||
|
{
|
||||||
|
var osSkipAttribute = new MaximumOSVersionAttribute(
|
||||||
|
OperatingSystems.Windows,
|
||||||
|
new Version("2.5.9"),
|
||||||
|
OperatingSystems.Windows,
|
||||||
|
new Version("2.0.10.12"));
|
||||||
|
|
||||||
|
Assert.True(osSkipAttribute.IsMet);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void DoesNotSkip_SameVersion()
|
||||||
|
{
|
||||||
|
var osSkipAttribute = new MaximumOSVersionAttribute(
|
||||||
|
OperatingSystems.Windows,
|
||||||
|
new Version("2.5.10"),
|
||||||
|
OperatingSystems.Windows,
|
||||||
|
new Version("2.5.10.12"));
|
||||||
|
|
||||||
|
Assert.True(osSkipAttribute.IsMet);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Skip_LaterVersion()
|
||||||
|
{
|
||||||
|
var osSkipAttribute = new MaximumOSVersionAttribute(
|
||||||
|
OperatingSystems.Windows,
|
||||||
|
new Version("2.5.11"),
|
||||||
|
OperatingSystems.Windows,
|
||||||
|
new Version("3.0.10.12"));
|
||||||
|
|
||||||
|
Assert.False(osSkipAttribute.IsMet);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void DoesNotSkip_WhenOnlyVersionsMatch()
|
||||||
|
{
|
||||||
|
var osSkipAttribute = new MaximumOSVersionAttribute(
|
||||||
|
OperatingSystems.Windows,
|
||||||
|
new Version("2.5.10.12"),
|
||||||
|
OperatingSystems.Linux,
|
||||||
|
new Version("2.5.10.12"));
|
||||||
|
|
||||||
|
Assert.True(osSkipAttribute.IsMet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Testing
|
||||||
|
{
|
||||||
|
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||||
|
public class MaximumOSVersionTest
|
||||||
|
{
|
||||||
|
[ConditionalFact]
|
||||||
|
[MaximumOSVersion(OperatingSystems.Windows, WindowsVersions.Win7)]
|
||||||
|
public void RunTest_Win7DoesRunOnWin7()
|
||||||
|
{
|
||||||
|
Assert.True(
|
||||||
|
RuntimeInformation.IsOSPlatform(OSPlatform.Windows) &&
|
||||||
|
Environment.OSVersion.Version.ToString().StartsWith("6.1"),
|
||||||
|
"Test should only be running on Win7 or Win2008R2.");
|
||||||
|
}
|
||||||
|
|
||||||
|
[ConditionalTheory]
|
||||||
|
[MaximumOSVersion(OperatingSystems.Windows, WindowsVersions.Win7)]
|
||||||
|
[InlineData(1)]
|
||||||
|
public void RunTheory_Win7DoesRunOnWin7(int arg)
|
||||||
|
{
|
||||||
|
Assert.True(
|
||||||
|
RuntimeInformation.IsOSPlatform(OSPlatform.Windows) &&
|
||||||
|
Environment.OSVersion.Version.ToString().StartsWith("6.1"),
|
||||||
|
"Test should only be running on Win7 or Win2008R2.");
|
||||||
|
}
|
||||||
|
|
||||||
|
[ConditionalFact]
|
||||||
|
[MaximumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10_RS4)]
|
||||||
|
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||||
|
public void RunTest_Win10_RS4()
|
||||||
|
{
|
||||||
|
Assert.True(RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
|
||||||
|
var versionKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion");
|
||||||
|
Assert.NotNull(versionKey);
|
||||||
|
var currentVersion = (string)versionKey.GetValue("CurrentBuildNumber");
|
||||||
|
Assert.NotNull(currentVersion);
|
||||||
|
Assert.True(17134 >= int.Parse(currentVersion));
|
||||||
|
}
|
||||||
|
|
||||||
|
[ConditionalFact]
|
||||||
|
[MaximumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10_19H2)]
|
||||||
|
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||||
|
public void RunTest_Win10_19H2()
|
||||||
|
{
|
||||||
|
Assert.True(RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
|
||||||
|
var versionKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion");
|
||||||
|
Assert.NotNull(versionKey);
|
||||||
|
var currentVersion = (string)versionKey.GetValue("CurrentBuildNumber");
|
||||||
|
Assert.NotNull(currentVersion);
|
||||||
|
Assert.True(18363 >= int.Parse(currentVersion));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[MaximumOSVersion(OperatingSystems.Windows, WindowsVersions.Win7)]
|
||||||
|
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||||
|
public class OSMaxVersionClassTest
|
||||||
|
{
|
||||||
|
[ConditionalFact]
|
||||||
|
public void TestSkipClass_Win7DoesRunOnWin7()
|
||||||
|
{
|
||||||
|
Assert.True(
|
||||||
|
RuntimeInformation.IsOSPlatform(OSPlatform.Windows) &&
|
||||||
|
Environment.OSVersion.Version.ToString().StartsWith("6.1"),
|
||||||
|
"Test should only be running on Win7 or Win2008R2.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Let this one run cross plat just to check the constructor logic.
|
||||||
|
[MaximumOSVersion(OperatingSystems.Windows, WindowsVersions.Win7)]
|
||||||
|
public class OSMaxVersionCrossPlatTest
|
||||||
|
{
|
||||||
|
[ConditionalFact]
|
||||||
|
public void TestSkipClass_Win7DoesRunOnWin7()
|
||||||
|
{
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
|
{
|
||||||
|
Assert.True(Environment.OSVersion.Version.ToString().StartsWith("6.1"),
|
||||||
|
"Test should only be running on Win7 or Win2008R2.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -10,13 +10,12 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
public class OSSkipConditionAttributeTest
|
public class OSSkipConditionAttributeTest
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Skips_WhenOnlyOperatingSystemIsSupplied()
|
public void Skips_WhenOperatingSystemMatches()
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
var osSkipAttribute = new OSSkipConditionAttribute(
|
var osSkipAttribute = new OSSkipConditionAttribute(
|
||||||
OperatingSystems.Windows,
|
OperatingSystems.Windows,
|
||||||
OperatingSystems.Windows,
|
OperatingSystems.Windows);
|
||||||
"2.5");
|
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.False(osSkipAttribute.IsMet);
|
Assert.False(osSkipAttribute.IsMet);
|
||||||
|
|
@ -28,77 +27,18 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
// Act
|
// Act
|
||||||
var osSkipAttribute = new OSSkipConditionAttribute(
|
var osSkipAttribute = new OSSkipConditionAttribute(
|
||||||
OperatingSystems.Linux,
|
OperatingSystems.Linux,
|
||||||
OperatingSystems.Windows,
|
OperatingSystems.Windows);
|
||||||
"2.5");
|
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.True(osSkipAttribute.IsMet);
|
Assert.True(osSkipAttribute.IsMet);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void DoesNotSkip_WhenVersionsDoNotMatch()
|
|
||||||
{
|
|
||||||
// Act
|
|
||||||
var osSkipAttribute = new OSSkipConditionAttribute(
|
|
||||||
OperatingSystems.Windows,
|
|
||||||
OperatingSystems.Windows,
|
|
||||||
"2.5",
|
|
||||||
"10.0");
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
Assert.True(osSkipAttribute.IsMet);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void DoesNotSkip_WhenOnlyVersionsMatch()
|
|
||||||
{
|
|
||||||
// Act
|
|
||||||
var osSkipAttribute = new OSSkipConditionAttribute(
|
|
||||||
OperatingSystems.Linux,
|
|
||||||
OperatingSystems.Windows,
|
|
||||||
"2.5",
|
|
||||||
"2.5");
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
Assert.True(osSkipAttribute.IsMet);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData("2.5", "2.5")]
|
|
||||||
[InlineData("blue", "Blue")]
|
|
||||||
public void Skips_WhenVersionsMatches(string currentOSVersion, string skipVersion)
|
|
||||||
{
|
|
||||||
// Act
|
|
||||||
var osSkipAttribute = new OSSkipConditionAttribute(
|
|
||||||
OperatingSystems.Windows,
|
|
||||||
OperatingSystems.Windows,
|
|
||||||
currentOSVersion,
|
|
||||||
skipVersion);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
Assert.False(osSkipAttribute.IsMet);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Skips_WhenVersionsMatchesOutOfMultiple()
|
|
||||||
{
|
|
||||||
// Act
|
|
||||||
var osSkipAttribute = new OSSkipConditionAttribute(
|
|
||||||
OperatingSystems.Windows,
|
|
||||||
OperatingSystems.Windows,
|
|
||||||
"2.5",
|
|
||||||
"10.0", "3.4", "2.5");
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
Assert.False(osSkipAttribute.IsMet);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Skips_BothMacOSXAndLinux()
|
public void Skips_BothMacOSXAndLinux()
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
var osSkipAttributeLinux = new OSSkipConditionAttribute(OperatingSystems.Linux | OperatingSystems.MacOSX, OperatingSystems.Linux, string.Empty);
|
var osSkipAttributeLinux = new OSSkipConditionAttribute(OperatingSystems.Linux | OperatingSystems.MacOSX, OperatingSystems.Linux);
|
||||||
var osSkipAttributeMacOSX = new OSSkipConditionAttribute(OperatingSystems.Linux | OperatingSystems.MacOSX, OperatingSystems.MacOSX, string.Empty);
|
var osSkipAttributeMacOSX = new OSSkipConditionAttribute(OperatingSystems.Linux | OperatingSystems.MacOSX, OperatingSystems.MacOSX);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.False(osSkipAttributeLinux.IsMet);
|
Assert.False(osSkipAttributeLinux.IsMet);
|
||||||
|
|
@ -109,8 +49,8 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
public void Skips_BothMacOSXAndWindows()
|
public void Skips_BothMacOSXAndWindows()
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
var osSkipAttribute = new OSSkipConditionAttribute(OperatingSystems.Windows | OperatingSystems.MacOSX, OperatingSystems.Windows, string.Empty);
|
var osSkipAttribute = new OSSkipConditionAttribute(OperatingSystems.Windows | OperatingSystems.MacOSX, OperatingSystems.Windows);
|
||||||
var osSkipAttributeMacOSX = new OSSkipConditionAttribute(OperatingSystems.Windows | OperatingSystems.MacOSX, OperatingSystems.MacOSX, string.Empty);
|
var osSkipAttributeMacOSX = new OSSkipConditionAttribute(OperatingSystems.Windows | OperatingSystems.MacOSX, OperatingSystems.MacOSX);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.False(osSkipAttribute.IsMet);
|
Assert.False(osSkipAttribute.IsMet);
|
||||||
|
|
@ -121,8 +61,8 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
public void Skips_BothWindowsAndLinux()
|
public void Skips_BothWindowsAndLinux()
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
var osSkipAttribute = new OSSkipConditionAttribute(OperatingSystems.Linux | OperatingSystems.Windows, OperatingSystems.Windows, string.Empty);
|
var osSkipAttribute = new OSSkipConditionAttribute(OperatingSystems.Linux | OperatingSystems.Windows, OperatingSystems.Windows);
|
||||||
var osSkipAttributeLinux = new OSSkipConditionAttribute(OperatingSystems.Linux | OperatingSystems.Windows, OperatingSystems.Linux, string.Empty);
|
var osSkipAttributeLinux = new OSSkipConditionAttribute(OperatingSystems.Linux | OperatingSystems.Windows, OperatingSystems.Linux);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.False(osSkipAttribute.IsMet);
|
Assert.False(osSkipAttribute.IsMet);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
|
@ -27,16 +26,6 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
"Test should not be running on MacOSX.");
|
"Test should not be running on MacOSX.");
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalFact]
|
|
||||||
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2)]
|
|
||||||
public void RunTest_DoesNotRunOnWin7OrWin2008R2()
|
|
||||||
{
|
|
||||||
Assert.False(
|
|
||||||
RuntimeInformation.IsOSPlatform(OSPlatform.Windows) &&
|
|
||||||
Environment.OSVersion.Version.ToString().StartsWith("6.1"),
|
|
||||||
"Test should not be running on Win7 or Win2008R2.");
|
|
||||||
}
|
|
||||||
|
|
||||||
[ConditionalFact]
|
[ConditionalFact]
|
||||||
[OSSkipCondition(OperatingSystems.Windows)]
|
[OSSkipCondition(OperatingSystems.Windows)]
|
||||||
public void TestSkipWindows()
|
public void TestSkipWindows()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue