Move settings into .editorconfig (#12426)

Our code styles were in a number of files. Consolodate into .editorconfig for discoverability.

I've also tried to deviate as little as possible in tests. This required fixing a number of analyzer issues in test code.

Also add some more build related solution folders for clarity and discoverability.
This commit is contained in:
Jeremy Kuhne 2024-11-05 17:30:07 -08:00 коммит произвёл GitHub
Родитель 8c4acf0349
Коммит 65f897bc43
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
338 изменённых файлов: 3443 добавлений и 4027 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -45,12 +45,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Accessibility", "Accessibil
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Windows.Forms.IntegrationTests.Common", "src\System.Windows.Forms\tests\IntegrationTests\System.Windows.Forms.IntegrationTests.Common\System.Windows.Forms.IntegrationTests.Common.csproj", "{48979B4E-EAEC-4B41-BB49-44CA230BECAB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{462AD69A-9395-4E98-882D-569CDE562559}"
ProjectSection(SolutionItems) = preProject
azure-pipelines.yml = azure-pipelines.yml
eng\pipelines\build.yml = eng\pipelines\build.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "documentation", "documentation", "{C029199F-7D5C-417C-AA52-913A214E3285}"
ProjectSection(SolutionItems) = preProject
docs\building.md = docs\building.md
@ -154,11 +148,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Private.Windows.Core
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "eng", "eng", "{8B4B1E09-B3C7-4044-B223-94EDEC1CAA20}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitattributes = .gitattributes
.gitignore = .gitignore
eng\CodeAnalysis.src.globalconfig = eng\CodeAnalysis.src.globalconfig
eng\CodeAnalysis.test.globalconfig = eng\CodeAnalysis.test.globalconfig
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
global.json = global.json
@ -187,6 +178,29 @@ Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "System.Windows.Forms.Analyz
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Private.Windows.Core.Tests", "src\System.Private.Windows.Core\tests\System.Private.Windows.Core.Tests\System.Private.Windows.Core.Tests.csproj", "{B653C860-9B52-4597-9921-24DA79A4E6B1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Pipelines", "Pipelines", "{656C66A4-59CD-4E14-8AE4-1F5BCEECB553}"
ProjectSection(SolutionItems) = preProject
eng\pipelines\azure-pipelines-codeql.yml = eng\pipelines\azure-pipelines-codeql.yml
azure-pipelines-PR.yml = azure-pipelines-PR.yml
azure-pipelines-richnav.yml = azure-pipelines-richnav.yml
azure-pipelines.yml = azure-pipelines.yml
eng\pipelines\build-PR.yml = eng\pipelines\build-PR.yml
eng\pipelines\build.yml = eng\pipelines\build.yml
eng\CIBuild.cmd = eng\CIBuild.cmd
eng\custom-cibuild.ps1 = eng\custom-cibuild.ps1
eng\pipelines\post-build-PR.yml = eng\pipelines\post-build-PR.yml
eng\pipelines\post-build.yml = eng\pipelines\post-build.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Analyzers", "Analyzers", "{D4D97D78-D213-45DF-B003-9C4C9F2E5E1C}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
eng\CodeAnalysisSource.cs = eng\CodeAnalysisSource.cs
eng\CodeAnalysisSource.vb = eng\CodeAnalysisSource.vb
eng\CodeStyle.props = eng\CodeStyle.props
eng\CodeStyle.targets = eng\CodeStyle.targets
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -1092,7 +1106,6 @@ Global
{6103E743-057D-41C6-946C-23A751A08748} = {088DD24C-DF6B-45F3-A8BC-592580A4B2A9}
{088DD24C-DF6B-45F3-A8BC-592580A4B2A9} = {77FEDB47-F7F6-490D-AF7C-ABB4A9E0B9D7}
{48979B4E-EAEC-4B41-BB49-44CA230BECAB} = {680FB14C-7B0C-4D63-9F1A-18ACCDB0F52A}
{462AD69A-9395-4E98-882D-569CDE562559} = {8B4B1E09-B3C7-4044-B223-94EDEC1CAA20}
{D390F7D2-1E11-4DEE-B7F1-4FD0681A81F0} = {DF68A171-D27B-4E6A-8A7E-63A651622355}
{55E34830-B375-41FF-AFCA-F53B80A4D152} = {77FEDB47-F7F6-490D-AF7C-ABB4A9E0B9D7}
{D8598EC8-D64B-4BE7-A4DC-5D5CED6A3938} = {583F1292-AE8D-4511-B8D8-A81FE4642DDC}
@ -1139,6 +1152,8 @@ Global
{C4C031D5-F79A-44B6-811E-0797E7D5C1C1} = {E4C6C5F5-46E9-4C63-9628-26752B4D9C11}
{0FD53580-3175-4F8F-8372-BE46C9122EE0} = {D3AD0BF9-F5E2-4913-9AE3-9C4998F95EA1}
{B653C860-9B52-4597-9921-24DA79A4E6B1} = {583F1292-AE8D-4511-B8D8-A81FE4642DDC}
{656C66A4-59CD-4E14-8AE4-1F5BCEECB553} = {8B4B1E09-B3C7-4044-B223-94EDEC1CAA20}
{D4D97D78-D213-45DF-B003-9C4C9F2E5E1C} = {8B4B1E09-B3C7-4044-B223-94EDEC1CAA20}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7B1B0433-F612-4E5A-BE7E-FCF5B9F6E136}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,459 +0,0 @@
is_global = true
# This file takes priority over CodeAnalysis.src.globalconfig
global_level = 1
# CA1052: Static holder types should be Static or NotInheritable
dotnet_diagnostic.CA1052.severity = none # TODO: warning
dotnet_code_quality.CA1052.api_surface = unset
# CA1311: Specify a culture or use an invariant version
dotnet_diagnostic.CA1311.severity = none
# CA1416: Validate platform compatibility
dotnet_diagnostic.CA1416.severity = none # TODO: warning
# CA1507: Use nameof to express symbol names
dotnet_diagnostic.CA1507.severity = none
# CA1727: Use PascalCase for named placeholders
dotnet_diagnostic.CA1727.severity = suggestion
# CA1802: Use literals where appropriate
dotnet_code_quality.CA1802.api_surface = unset
# CA1810: Initialize reference type static fields inline
dotnet_diagnostic.CA1810.severity = none # TODO: warning
# CA1812: Avoid uninstantiated internal classes
dotnet_diagnostic.CA1812.severity = none
# CA1815: Override equals and operator equals on value types
dotnet_diagnostic.CA1815.severity = none
# CA1822: Mark members as static
dotnet_diagnostic.CA1822.severity = none # TODO: warning
dotnet_code_quality.CA1822.api_surface = unset
# CA1852: Seal internal types
dotnet_diagnostic.CA1852.severity = none
# CA1853: Unnecessary call to 'Dictionary.ContainsKey(key)'
dotnet_diagnostic.CA1853.severity = none
# CA1854: Prefer the 'IDictionary.TryGetValue(TKey, out TValue)' method
dotnet_diagnostic.CA1854.severity = none
# CA2007: Consider calling ConfigureAwait on the awaited task
dotnet_diagnostic.CA2007.severity = none # TODO: warning
# CA2014: Do not use stackalloc in loops.
dotnet_diagnostic.CA2014.severity = none # TODO: warning
# CA2208: Instantiate argument exceptions correctly
dotnet_code_quality.CA2208.api_surface = unset
# CA2245: Do not assign a property to itself
dotnet_diagnostic.CA2245.severity = warning
# CA2253: Named placeholders should not be numeric values
dotnet_diagnostic.CA2253.severity = none
# SA1000: Spacing around keywords
dotnet_diagnostic.SA1000.severity = none
# SA1001: Commas should not be preceded by whitespace
dotnet_diagnostic.SA1001.severity = none
# SA1014: Opening generic brackets should not be preceded by a space
dotnet_diagnostic.SA1014.severity = none
# SA1018: Nullable type symbol should not be preceded by a space
dotnet_diagnostic.SA1018.severity = none
# SA1020: Increment symbol should not be preceded by a space
dotnet_diagnostic.SA1020.severity = none
# SA1026: Keyword followed by span or blank line
dotnet_diagnostic.SA1026.severity = none
# SA1027: Tabs and spaces should be used correctly
dotnet_diagnostic.SA1027.severity = none
# SA1028: Code should not contain trailing whitespace
dotnet_diagnostic.SA1028.severity = none
# SA1102: Query clause should follow previous clause
dotnet_diagnostic.SA1102.severity = none
# SA1103: Query clauses should be on separate lines or all on one line
dotnet_diagnostic.SA1103.severity = none
# SA1113: Comma should be on the same line as previous parameter
dotnet_diagnostic.SA1113.severity = none
# SA1115: Parameter should begin on the line after the previous parameter
dotnet_diagnostic.SA1115.severity = none
# SA1121: Use built-in type alias
dotnet_diagnostic.SA1121.severity = none
# SA1129: Do not use default value type constructor
dotnet_diagnostic.SA1129.severity = none
# SA1131: Constant values should appear on the right-hand side of comparisons
dotnet_diagnostic.SA1131.severity = suggestion
# SA1141: Use tuple syntax
dotnet_diagnostic.SA1141.severity = none
# SA1142: Refer to tuple elements by name
dotnet_diagnostic.SA1142.severity = none
# SA1205: Partial elements should declare an access modifier
dotnet_diagnostic.SA1205.severity = none
# SA1206: Keyword ordering
dotnet_diagnostic.SA1206.severity = none
# SA1212: A get accessor appears after a set accessor within a property or indexer
dotnet_diagnostic.SA1212.severity = none
# SA1302: Interface names should begin with I
dotnet_diagnostic.SA1302.severity = none
# SA1400: Member should declare an access modifier
dotnet_diagnostic.SA1400.severity = none
# SA1410: Remove delegate parens when possible
dotnet_diagnostic.SA1410.severity = none
# SA1411: Attribute constructor shouldn't use unnecessary parenthesis
dotnet_diagnostic.SA1411.severity = none
# SA1518: Code should not contain blank lines at the end of the file
dotnet_diagnostic.SA1518.severity = none
# IDE0001: Simplify name
dotnet_diagnostic.IDE0001.severity = silent
# IDE0002: Simplify member access
dotnet_diagnostic.IDE0002.severity = silent
# IDE0003: Remove this or Me qualification
dotnet_diagnostic.IDE0003.severity = silent
# IDE0004: Remove Unnecessary Cast
dotnet_diagnostic.IDE0004.severity = silent
# IDE0005: Using directive is unnecessary.
dotnet_diagnostic.IDE0005.severity = silent
# IDE0008: Use explicit type
dotnet_diagnostic.IDE0008.severity = silent
# IDE0017: Simplify object initialization
dotnet_diagnostic.IDE0017.severity = silent
# IDE0018: Inline variable declaration
dotnet_diagnostic.IDE0018.severity = silent
# IDE0019: Use pattern matching to avoid as followed by a null check
dotnet_diagnostic.IDE0019.severity = silent
# IDE0020: Use pattern matching to avoid is check followed by a cast (with variable)
dotnet_diagnostic.IDE0020.severity = silent
# IDE0028: Simplify collection initialization
dotnet_diagnostic.IDE0028.severity = silent
# IDE0029: Use coalesce expression
dotnet_diagnostic.IDE0029.severity = silent
# IDE0030: Use coalesce expression
dotnet_diagnostic.IDE0030.severity = silent
# IDE0031: Use null propagation
dotnet_diagnostic.IDE0031.severity = silent
# IDE0033: Use explicitly provided tuple name
dotnet_diagnostic.IDE0033.severity = silent
# IDE0034: Simplify 'default' expression
dotnet_diagnostic.IDE0034.severity = silent
# IDE0035: Remove unreachable code
dotnet_diagnostic.IDE0035.severity = silent
# IDE0036: Order modifiers
dotnet_diagnostic.IDE0036.severity = silent
# IDE0038: Use pattern matching to avoid is check followed by a cast (without variable)
dotnet_diagnostic.IDE0038.severity = silent
# IDE0039: Use local function
dotnet_diagnostic.IDE0039.severity = silent
# IDE0040: Add accessibility modifiers
dotnet_diagnostic.IDE0040.severity = silent
# IDE0041: Use 'is null' check
dotnet_diagnostic.IDE0041.severity = silent
# IDE0043: Invalid format string
dotnet_diagnostic.IDE0043.severity = silent
# IDE0044: Add readonly modifier
dotnet_diagnostic.IDE0044.severity = silent
# IDE0045: Use conditional expression for assignment
dotnet_diagnostic.IDE0045.severity = silent
# IDE0046: Use conditional expression for return
dotnet_diagnostic.IDE0046.severity = silent
# IDE0049: Use language keywords instead of framework type names for type references
dotnet_diagnostic.IDE0049.severity = silent
# IDE0051: Remove unused private members
dotnet_diagnostic.IDE0051.severity = silent
# IDE0052: Remove unread private members
dotnet_diagnostic.IDE0052.severity = silent
# IDE0054: Use compound assignment
dotnet_diagnostic.IDE0054.severity = silent
# IDE0055: Fix formatting
dotnet_diagnostic.IDE0055.severity = silent
# IDE0056: Use index operator
dotnet_diagnostic.IDE0056.severity = silent
# IDE0057: Use range operator
dotnet_diagnostic.IDE0057.severity = silent
# IDE0059: Unnecessary assignment of a value
dotnet_diagnostic.IDE0059.severity = silent
# IDE0060: Remove unused parameter
dotnet_code_quality_unused_parameters = unset
# IDE0062: Make local function 'static'
dotnet_diagnostic.IDE0062.severity = silent
# IDE0065: Misplaced using directive
dotnet_diagnostic.IDE0065.severity = silent
# IDE0066: Convert switch statement to expression
dotnet_diagnostic.IDE0066.severity = silent
# IDE0070: Use 'System.HashCode'
dotnet_diagnostic.IDE0070.severity = silent
# IDE0071: Simplify interpolation
dotnet_diagnostic.IDE0071.severity = silent
# IDE0073: The file header is missing or not located at the top of the file
dotnet_diagnostic.IDE0073.severity = silent
# IDE0074: Use compound assignment
dotnet_diagnostic.IDE0074.severity = silent
# IDE0076: Invalid global 'SuppressMessageAttribute'
dotnet_diagnostic.IDE0076.severity = silent
# IDE0078: Use pattern matching
dotnet_diagnostic.IDE0078.severity = silent
# IDE0079: RemoveUnnecessarySuppression
dotnet_diagnostic.IDE0079.severity = silent
# IDE0080: Remove unnecessary suppression operator
dotnet_diagnostic.IDE0080.severity = silent
# IDE0081: RemoveUnnecessaryByVal
dotnet_diagnostic.IDE0081.severity = silent
# IDE0082: 'typeof' can be converted to 'nameof'
dotnet_diagnostic.IDE0082.severity = silent
# IDE0084: Use pattern matching (IsNot operator)
dotnet_diagnostic.IDE0084.severity = silent
# IDE0090: Simplify new expression
dotnet_diagnostic.IDE0090.severity = warning
# IDE0100: Remove redundant equality
dotnet_diagnostic.IDE0100.severity = silent
# IDE0110: Remove unnecessary discard
dotnet_diagnostic.IDE0110.severity = silent
# IDE0120: Simplify LINQ expression
dotnet_diagnostic.IDE0120.severity = silent
# IDE0140: Simplify object creation
dotnet_diagnostic.IDE0140.severity = silent
# IDE0170: Simplify property pattern
dotnet_diagnostic.IDE0170.severity = silent
# IDE0180: Use tuple swap
dotnet_diagnostic.IDE0180.severity = silent
# IDE0200: Remove unnecessary lambda expression
dotnet_diagnostic.IDE0200.severity = silent
# IDE0230: Use UTF8 string literal
dotnet_diagnostic.IDE0230.severity = silent
# IDE1005: Delegate invocation can be simplified.
dotnet_diagnostic.IDE1005.severity = silent
# xUnit1000: Test classes must be public
dotnet_diagnostic.xUnit1000.severity = warning
# xUnit1001: Fact methods cannot have parameters
dotnet_diagnostic.xUnit1001.severity = warning
# xUnit1002: Test methods cannot have multiple Fact or Theory attributes
dotnet_diagnostic.xUnit1002.severity = warning
# xUnit1003: Theory methods must have test data
dotnet_diagnostic.xUnit1003.severity = warning
# xUnit1004: Test methods should not be skipped
dotnet_diagnostic.xUnit1004.severity = silent # TODO: warning
# xUnit1005: Fact methods should not have test data
dotnet_diagnostic.xUnit1005.severity = warning
# xUnit1006: Theory methods should have parameters
dotnet_diagnostic.xUnit1006.severity = warning
# xUnit1007: ClassData must point at a valid class
dotnet_diagnostic.xUnit1007.severity = warning
# xUnit1008: Test data attribute should only be used on a Theory
dotnet_diagnostic.xUnit1008.severity = warning
# xUnit1009: InlineData must match the number of method parameters
dotnet_diagnostic.xUnit1009.severity = warning
# xUnit1010: The value is not convertible to the method parameter type
dotnet_diagnostic.xUnit1010.severity = warning
# xUnit1011: There is no matching method parameter
dotnet_diagnostic.xUnit1011.severity = warning
# xUnit1012: Null should not be used for value type parameters
dotnet_diagnostic.xUnit1012.severity = warning
# xUnit1013: Public methods should be marked as test
dotnet_diagnostic.xUnit1013.severity = warning
# xUnit1014: MemberData should use nameof operator for member name
dotnet_diagnostic.xUnit1014.severity = warning
# xUnit1015: MemberData must reference an existing member
dotnet_diagnostic.xUnit1015.severity = warning
# xUnit1016: MemberData must reference a public member
dotnet_diagnostic.xUnit1016.severity = warning
# xUnit1017: MemberData must reference a static member
dotnet_diagnostic.xUnit1017.severity = warning
# xUnit1018: MemberData must reference a valid member kind
dotnet_diagnostic.xUnit1018.severity = warning
# xUnit1019: MemberData must reference a member providing a valid data type
dotnet_diagnostic.xUnit1019.severity = warning
# xUnit1020: MemberData must reference a property with a getter
dotnet_diagnostic.xUnit1020.severity = warning
# xUnit1021: MemberData should not have parameters if the referenced member is not a method
dotnet_diagnostic.xUnit1021.severity = warning
# xUnit1022: Theory methods cannot have a parameter array
dotnet_diagnostic.xUnit1022.severity = warning
# xUnit1023: Theory methods cannot have default parameter values
dotnet_diagnostic.xUnit1023.severity = warning
# xUnit1024: Test methods cannot have overloads
dotnet_diagnostic.xUnit1024.severity = warning
# xUnit1025: InlineData should be unique within the Theory it belongs to
dotnet_diagnostic.xUnit1025.severity = warning
# xUnit1026: Theory methods should use all of their parameters
dotnet_diagnostic.xUnit1026.severity = warning
# xUnit2000: Constants and literals should be the expected argument
dotnet_diagnostic.xUnit2000.severity = warning
# xUnit2001: Do not use invalid equality check
dotnet_diagnostic.xUnit2001.severity = warning
# xUnit2002: Do not use null check on value type
dotnet_diagnostic.xUnit2002.severity = warning
# xUnit2003: Do not use equality check to test for null value
dotnet_diagnostic.xUnit2003.severity = warning
# xUnit2004: Do not use equality check to test for boolean conditions
dotnet_diagnostic.xUnit2004.severity = warning
# xUnit2005: Do not use identity check on value type
dotnet_diagnostic.xUnit2005.severity = warning
# xUnit2006: Do not use invalid string equality check
dotnet_diagnostic.xUnit2006.severity = warning
# xUnit2007: Do not use typeof expression to check the type
dotnet_diagnostic.xUnit2007.severity = warning
# xUnit2008: Do not use boolean check to match on regular expressions
dotnet_diagnostic.xUnit2008.severity = warning
# xUnit2009: Do not use boolean check to check for substrings
dotnet_diagnostic.xUnit2009.severity = warning
# xUnit2010: Do not use boolean check to check for string equality
dotnet_diagnostic.xUnit2010.severity = warning
# xUnit2011: Do not use empty collection check
dotnet_diagnostic.xUnit2011.severity = warning
# xUnit2012: Do not use Enumerable.Any() to check if a value exists in a collection
dotnet_diagnostic.xUnit2012.severity = warning
# xUnit2013: Do not use equality check to check for collection size.
dotnet_diagnostic.xUnit2013.severity = none
# xUnit2014: Do not use throws check to check for asynchronously thrown exception
dotnet_diagnostic.xUnit2014.severity = none
# xUnit2015: Do not use typeof expression to check the exception type
dotnet_diagnostic.xUnit2015.severity = warning
# xUnit2016: Keep precision in the allowed range when asserting equality of doubles or decimals
dotnet_diagnostic.xUnit2016.severity = warning
# xUnit2017: Do not use Contains() to check if a value exists in a collection
dotnet_diagnostic.xUnit2017.severity = none
# xUnit2018: Do not compare an object's exact type to an abstract class or interface
dotnet_diagnostic.xUnit2018.severity = warning
# xUnit2019: Do not use obsolete throws check to check for asynchronously thrown exception
dotnet_diagnostic.xUnit2019.severity = warning
# xUnit3000: Test case classes must derive directly or indirectly from Xunit.LongLivedMarshalByRefObject
dotnet_diagnostic.xUnit3000.severity = warning
# xUnit3001: Classes that implement Xunit.Abstractions.IXunitSerializable must have a public parameterless constructor
dotnet_diagnostic.xUnit3001.severity = warning

Просмотреть файл

@ -2,28 +2,22 @@
<Project>
<ItemGroup>
<EditorConfigFiles Include="$(MSBuildThisFileDirectory)CodeAnalysis.src.globalconfig" />
</ItemGroup>
<ItemGroup Condition="'$(IsShipping)' == 'false'">
<!-- Include CodeAnalysis.test.globalconfig to override (relax) some rules from the primary configuration. -->
<EditorConfigFiles Include="$(MSBuildThisFileDirectory)CodeAnalysis.test.globalconfig" />
</ItemGroup>
<ItemGroup>
<!-- https://github.com/DotNetAnalyzers/StyleCopAnalyzers -->
<PackageReference Include="StyleCop.Analyzers" PrivateAssets="all" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" Visible="false" />
</ItemGroup>
<ItemGroup>
<!-- https://github.com/dotnet/roslyn-analyzers -->
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<!-- https://github.com/DotNetAnalyzers/DocumentationAnalyzers -->
<PackageReference Include="DotNetAnalyzers.DocumentationAnalyzers" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<!-- https://github.com/AArnott/CSharpIsNull -->
<PackageReference Include="CSharpIsNullAnalyzer" PrivateAssets="all" />
</ItemGroup>

Просмотреть файл

@ -1,9 +0,0 @@
{
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
"settings": {
"documentationRules": {
"copyrightText": "Licensed to the .NET Foundation under one or more agreements.\nThe .NET Foundation licenses this file to you under the MIT license.\nSee the LICENSE file in the project root for more information.",
"xmlHeader": false
}
}
}

Просмотреть файл

@ -78,7 +78,7 @@ public static class CommonTestHelper
TheoryData<Point> data = new();
if (!includeType.HasFlag(TestIncludeType.NoPositives))
{
data.Add(default(Point));
data.Add(default);
data.Add(new Point(10));
data.Add(new Point(1, 2));
}
@ -99,7 +99,7 @@ public static class CommonTestHelper
TheoryData<Size> data = new();
if (!includeType.HasFlag(TestIncludeType.NoPositives))
{
data.Add(default(Size));
data.Add(default);
data.Add(new Size(new Point(1, 1)));
data.Add(new Size(1, 2));
}

Просмотреть файл

@ -175,7 +175,7 @@ internal static class DebuggerAttributes
{
null => "null",
byte or sbyte or short or ushort or int or uint or long or ulong or float or double => member.ToString(),
string _ when noQuotes => member.ToString(),
string when noQuotes => member.ToString(),
string => $"\"{member}\"",
_ => $"{{{member}}}"
};

Просмотреть файл

@ -0,0 +1,11 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System;
public static unsafe class NativeAssert
{
public static void Null(void* pointer) => Assert.True(pointer is null);
public static void NotNull(void* pointer) => Assert.True(pointer is not null);
}

Просмотреть файл

@ -9,7 +9,7 @@ public static class ReflectionHelper
{
public static IEnumerable<Type> GetPublicNotAbstractClasses<T>()
{
var types = typeof(T).Assembly.GetTypes().Where(type => IsPublicNonAbstract<T>(type));
var types = typeof(T).Assembly.GetTypes().Where(IsPublicNonAbstract<T>);
foreach (var type in types)
{
if (type.GetConstructor(

Просмотреть файл

@ -33,14 +33,14 @@ public static partial class TestAccessors
/// <![CDATA[
/// Version version = new Version(4, 1);
/// Assert.Equal(4, version.TestAccessor().Dynamic._Major));
///
///
/// // Or
///
///
/// dynamic accessor = version.TestAccessor().Dynamic;
/// Assert.Equal(4, accessor._Major));
///
///
/// // Or
///
///
/// Version version2 = new Version("4.1");
/// dynamic accessor = typeof(Version).TestAccessor().Dynamic;
/// Assert.Equal(version2, accessor.Parse("4.1")));

Просмотреть файл

@ -46,7 +46,6 @@ public static class TestData
T.NegativeInfinity,
T.Epsilon,
T.Epsilon * T.NegativeOne
,
];
}

Просмотреть файл

@ -9,7 +9,7 @@ Namespace Microsoft.VisualBasic.Forms.Tests
Public Class TimeTests
Friend Const PrecisionTickLimit As Integer = 1_000_000
Private Function TimesEqual(
Private Shared Function TimesEqual(
vbTime As Date,
systemTime As Date,
acceptableDifferenceInTicks As Long) As Boolean

Просмотреть файл

@ -68,7 +68,7 @@ Namespace Microsoft.VisualBasic.Forms.Tests
''' The full path and file name of the created file.
''' If size = -1 no file is create but the full path is returned.
''' </returns>
Friend Function CreateTempFile(sourceDirectoryName As String, Optional filename As String = "Testing.Txt", Optional size As Integer = -1) As String
Friend Shared Function CreateTempFile(sourceDirectoryName As String, Optional filename As String = "Testing.Txt", Optional size As Integer = -1) As String
Dim filenameWithPath As String = Path.Combine(sourceDirectoryName, filename)
If size >= 0 Then
@ -109,7 +109,7 @@ Namespace Microsoft.VisualBasic.Forms.Tests
GC.SuppressFinalize(Me)
End Sub
Friend Function GetUniqueFileNameWithPath(testDirectory As String) As String
Friend Shared Function GetUniqueFileNameWithPath(testDirectory As String) As String
Return Path.Combine(testDirectory, GetUniqueFileName())
End Function

Просмотреть файл

@ -74,7 +74,7 @@ public class AudioTests
public void Stop()
{
Audio audio = new();
Action testCode = () => audio.Stop();
Action testCode = audio.Stop;
testCode.Should().NotThrow();
}
}

Просмотреть файл

@ -13,7 +13,7 @@ public class ComputerInfoTests
{
ComputerInfo info = new();
CultureInfo.InstalledUICulture.Should().Be(info.InstalledUICulture);
Environment.OSVersion.Platform.ToString().Should().Be( info.OSPlatform);
Environment.OSVersion.Platform.ToString().Should().Be(info.OSPlatform);
Environment.OSVersion.Version.ToString().Should().Be(info.OSVersion);
}

Просмотреть файл

@ -40,7 +40,7 @@ public class FileLogTraceListenerTests : FileCleanupTestBase
listener.WriteLine("WriteLine");
listener.TraceOutputOptions = TraceOptions.LogicalOperationStack | TraceOptions.DateTime | TraceOptions.Timestamp | TraceOptions.ProcessId | TraceOptions.ThreadId;
listener.TraceEvent(eventCache: cache, source: "Source", eventType: TraceEventType.Warning, id: 3, message: "TraceEvent");
listener.AutoFlush=true;
listener.AutoFlush = true;
listener.TraceData(eventCache: cache, source: "Source", eventType: TraceEventType.Error, id: 4, data: "TraceData");
listener.Flush();
listener.Close();

Просмотреть файл

@ -10,7 +10,7 @@ using Xunit.Sdk;
namespace System.Drawing;
public unsafe static class Helpers
public static unsafe class Helpers
{
// This MUST come before s_anyInstalledPrinters. Caching for performance in tests.
public static PrinterSettings.StringCollection InstalledPrinters { get; } = PrinterSettings.InstalledPrinters;

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// (C) 2004 Ximian, Inc. http://www.ximian.com
// Copyright (C) 2004,2006-2007 Novell, Inc (http://www.novell.com)
//
@ -481,7 +481,7 @@ public class BitmapTests : FileCleanupTestBase
Bitmap bitmap = new(1, 1);
bitmap.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => bitmap.Clone());
AssertExtensions.Throws<ArgumentException>(null, bitmap.Clone);
AssertExtensions.Throws<ArgumentException>(null, () => bitmap.Clone(new Rectangle(0, 0, 1, 1), PixelFormat.Format32bppArgb));
AssertExtensions.Throws<ArgumentException>(null, () => bitmap.Clone(new RectangleF(0, 0, 1, 1), PixelFormat.Format32bppArgb));
}
@ -882,7 +882,7 @@ public class BitmapTests : FileCleanupTestBase
Bitmap bitmap = new(1, 1);
bitmap.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => bitmap.MakeTransparent());
AssertExtensions.Throws<ArgumentException>(null, bitmap.MakeTransparent);
AssertExtensions.Throws<ArgumentException>(null, () => bitmap.MakeTransparent(Color.Red));
}
@ -890,7 +890,7 @@ public class BitmapTests : FileCleanupTestBase
public void MakeTransparent_GrayscalePixelFormat_ThrowsArgumentException()
{
using Bitmap bitmap = new(1, 1, PixelFormat.Format16bppGrayScale);
AssertExtensions.Throws<ArgumentException>(null, () => bitmap.MakeTransparent());
AssertExtensions.Throws<ArgumentException>(null, bitmap.MakeTransparent);
try
{
@ -1010,7 +1010,7 @@ public class BitmapTests : FileCleanupTestBase
public static IEnumerable<object[]> LockBits_TestData()
{
Bitmap bitmap() => new(2, 2, PixelFormat.Format32bppArgb);
static Bitmap bitmap() => new(2, 2, PixelFormat.Format32bppArgb);
yield return new object[] { bitmap(), new Rectangle(0, 0, 2, 2), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb, 8, 1 };
yield return new object[] { bitmap(), new Rectangle(0, 0, 2, 2), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb, 8, 3 };
yield return new object[] { bitmap(), new Rectangle(0, 0, 2, 2), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb, 8, 2 };
@ -1712,7 +1712,7 @@ public class BitmapTests : FileCleanupTestBase
}
public override void Flush() => _stream.Flush();
public override int Read(byte[] buffer, int offset, int count) => _canRead ? _stream.Read(buffer, offset, count) : throw new NotSupportedException();
public override int Read(byte[] buffer, int offset, int count) => _canRead ? _stream.Read(buffer, offset, count) : throw new NotSupportedException();
public override long Seek(long offset, SeekOrigin origin) => _stream.Seek(offset, origin);
public override void SetLength(long value) => _stream.SetLength(value);
public override void Write(byte[] buffer, int offset, int count) => _stream.Write(buffer, offset, count);

Просмотреть файл

@ -230,7 +230,7 @@ public class BufferedGraphicsContextTests
using Graphics graphics = Graphics.FromImage(image);
using (context.Allocate(graphics, Rectangle.Empty))
{
Assert.Throws<InvalidOperationException>(() => context.Dispose());
Assert.Throws<InvalidOperationException>(context.Dispose);
}
}
@ -243,7 +243,7 @@ public class BufferedGraphicsContextTests
using (context.Allocate(graphics, Rectangle.Empty))
{
context.Invalidate();
Assert.Throws<InvalidOperationException>(() => context.Dispose());
Assert.Throws<InvalidOperationException>(context.Dispose);
}
}
}

Просмотреть файл

@ -8,7 +8,7 @@ public class CharacterRangeTests
[Fact]
public void Ctor_Default()
{
CharacterRange range = new();
CharacterRange range = default;
Assert.Equal(0, range.First);
Assert.Equal(0, range.Length);
}

Просмотреть файл

@ -43,7 +43,7 @@ public class ColorTranslatorTests
public static IEnumerable<object[]> ToWin32Color_TestData()
{
yield return new object[] { new Color(), 0 };
yield return new object[] { default(Color), 0 };
yield return new object[] { Color.Red, 255 };
yield return new object[] { Color.White, 16777215 };
yield return new object[] { Color.FromArgb(1, 2, 3), 197121 };
@ -83,7 +83,7 @@ public class ColorTranslatorTests
public static IEnumerable<object[]> ToOle_TestData()
{
yield return new object[] { new Color(), 0 };
yield return new object[] { default(Color), 0 };
yield return new object[] { Color.Red, 255 };
yield return new object[] { Color.White, 16777215 };
yield return new object[] { Color.FromArgb(1, 2, 3), 197121 };

Просмотреть файл

@ -214,7 +214,7 @@ public class CustomLineCapTests
AssertExtensions.Throws<ArgumentException>(null, () => customLineCap.BaseCap);
AssertExtensions.Throws<ArgumentException>(null, () => customLineCap.BaseInset);
AssertExtensions.Throws<ArgumentException>(null, () => customLineCap.WidthScale);
AssertExtensions.Throws<ArgumentException>(null, () => customLineCap.Clone());
AssertExtensions.Throws<ArgumentException>(null, customLineCap.Clone);
AssertExtensions.Throws<ArgumentException>(null, () => customLineCap.SetStrokeCaps(LineCap.Flat, LineCap.Flat));
AssertExtensions.Throws<ArgumentException>(null, () => customLineCap.GetStrokeCaps(out LineCap startCap, out LineCap endCap));
}

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
@ -229,8 +229,8 @@ public class GraphicsPathIteratorTests
using GraphicsPath gp = new();
using GraphicsPathIterator gpi = new(gp);
Assert.Equal(0, gpi.Enumerate(ref points, ref types));
Assert.Equal(0, points.Length);
Assert.Equal(0, types.Length);
Assert.Empty(points);
Assert.Empty(types);
}
[Fact]

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
@ -136,8 +136,8 @@ public class GraphicsPathTests
public void PathData_ReturnsExpected()
{
using GraphicsPath gp = new();
Assert.Equal(0, gp.PathData.Points.Length);
Assert.Equal(0, gp.PathData.Types.Length);
Assert.Empty(gp.PathData.Points);
Assert.Empty(gp.PathData.Types);
}
[Fact]
@ -746,10 +746,10 @@ public class GraphicsPathTests
using GraphicsPath gpi = new();
using GraphicsPath gpf = new();
gpi.AddRectangle(new Rectangle(1, 2, width, height));
Assert.Equal(0, gpi.PathData.Points.Length);
Assert.Empty(gpi.PathData.Points);
gpf.AddRectangle(new RectangleF(1f, 2f, width, height));
Assert.Equal(0, gpf.PathData.Points.Length);
Assert.Empty(gpf.PathData.Points);
}
[Fact]
@ -1278,14 +1278,14 @@ public class GraphicsPathTests
public void Warp_DestinationPointsNull_ThrowsArgumentNullException()
{
using GraphicsPath gp = new();
AssertExtensions.Throws<ArgumentNullException>("destPoints", () => gp.Warp(null, new RectangleF()));
AssertExtensions.Throws<ArgumentNullException>("destPoints", () => gp.Warp(null, default));
}
[Fact]
public void Warp_DestinationPointsZero_ThrowsArgumentException()
{
using GraphicsPath gp = new();
AssertExtensions.Throws<ArgumentException>(null, () => new GraphicsPath().Warp([], new RectangleF()));
AssertExtensions.Throws<ArgumentException>(null, () => new GraphicsPath().Warp([], default));
}
[Fact]
@ -1313,7 +1313,7 @@ public class GraphicsPathTests
{
using GraphicsPath gp = new();
gp.AddPolygon([new(5, 5), new(15, 5), new(10, 15)]);
gp.Warp([new(0, 0)], new Rectangle(), null);
gp.Warp([new(0, 0)], default(Rectangle), null);
AssertWrapNaN(gp);
}
@ -1738,8 +1738,8 @@ public class GraphicsPathTests
using GraphicsPath gp = new();
AssertExtensions.Throws<ArgumentNullException>("pen", () => gp.IsOutlineVisible(1, 1, null));
AssertExtensions.Throws<ArgumentNullException>("pen", () => gp.IsOutlineVisible(1.0f, 1.0f, null));
AssertExtensions.Throws<ArgumentNullException>("pen", () => gp.IsOutlineVisible(new Point(), null));
AssertExtensions.Throws<ArgumentNullException>("pen", () => gp.IsOutlineVisible(new PointF(), null));
AssertExtensions.Throws<ArgumentNullException>("pen", () => gp.IsOutlineVisible(default, null));
AssertExtensions.Throws<ArgumentNullException>("pen", () => gp.IsOutlineVisible(default(PointF), null));
}
[Fact]
@ -1848,8 +1848,8 @@ public class GraphicsPathTests
{
new Point[]
{
new(1,2), new(3,4), new(5,6), new(7,8),
new(9,10), new(11,12), new(13,14)
new(1, 2), new(3, 4), new(5, 6), new(7, 8),
new(9, 10), new(11, 12), new(13, 14)
}
};
}
@ -1979,21 +1979,21 @@ public class GraphicsPathTests
gp.AddString("Mono::", FontFamily.GenericMonospace, 0, 10, new Point(10, 10), StringFormat.GenericDefault);
byte[] expectedTypes =
[
0,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,129,
0,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,161,
0,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,129,
0,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,161,
0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,131,0,3,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,163,0,3,3,3,
3,3,3,3,3,3,3,3,3,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,
3,3,3,3,3,3,3,3,3,1,1,3,3,3,3,3,3,3,3,3,3,3,3,1,1,3,3,3,
3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,1,1,3,3,3,3,
3,3,3,3,3,3,3,3,3,3,3,161,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,3,131,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,163,0,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,
3,3,3,3,3,3,3,3,3,3,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,
1,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,
1,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,1,129
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 129,
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 161,
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 129,
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 161,
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 131, 0, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 163, 0, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 161, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 131, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 163, 0, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1,
1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 129
];
AssertReverse(gp, gp.PathPoints, expectedTypes);
@ -2061,8 +2061,8 @@ public class GraphicsPathTests
private void AssertEmptyGraphicsPath(GraphicsPath gp)
{
Assert.Equal(0, gp.PathData.Points.Length);
Assert.Equal(0, gp.PathData.Types.Length);
Assert.Empty(gp.PathData.Points);
Assert.Empty(gp.PathData.Types);
Assert.Equal(0, gp.PointCount);
}
@ -2114,7 +2114,7 @@ public class GraphicsPathTests
path.PathPoints.Should().HaveCount(4);
path.PathTypes.Should().HaveCount(4);
path.PathData.Points.Should().HaveCount(4);
path.GetBounds().Should().BeApproximately(new (1f, 1f, 3f, 3f), Delta);
path.GetBounds().Should().BeApproximately(new(1f, 1f, 3f, 3f), Delta);
path.PathPoints.Should().BeApproximatelyEquivalentTo(expectedPoints, Delta);
path.PathTypes.Should().BeEquivalentTo(new byte[] { 0, 3, 3, 3 });
}
@ -2130,7 +2130,7 @@ public class GraphicsPathTests
path.PathPoints.Should().HaveCount(4);
path.PathTypes.Should().HaveCount(4);
path.PathData.Points.Should().HaveCount(4);
path.GetBounds().Should().BeApproximately(new (1f, 1f, 1f, 1f), Delta);
path.GetBounds().Should().BeApproximately(new(1f, 1f, 1f, 1f), Delta);
path.PathPoints.Should().BeApproximatelyEquivalentTo(expectedPoints, Delta);
path.PathTypes.Should().BeEquivalentTo(new byte[] { 0, 3, 3, 3 });
}
@ -2140,7 +2140,7 @@ public class GraphicsPathTests
path.PathPoints.Should().HaveCount(10);
path.PathTypes.Should().HaveCount(10);
path.PathData.Points.Should().HaveCount(10);
path.GetBounds().Should().BeApproximately(new (0.8333333f, 0.8333333f, 2.33333278f, 2.33333278f), Delta);
path.GetBounds().Should().BeApproximately(new(0.8333333f, 0.8333333f, 2.33333278f, 2.33333278f), Delta);
path.PathTypes.Should().BeEquivalentTo(new byte[] { 0, 3, 3, 3, 3, 3, 3, 3, 3, 131 });
}
@ -2156,7 +2156,7 @@ public class GraphicsPathTests
path.PathPoints.Should().HaveCount(4);
path.PathTypes.Should().HaveCount(4);
path.PathData.Points.Should().HaveCount(4);
path.GetBounds().Should().BeApproximately(new (1f, 1f, 2f, 2f), Delta);
path.GetBounds().Should().BeApproximately(new(1f, 1f, 2f, 2f), Delta);
path.PathPoints.Should().BeApproximatelyEquivalentTo(expectedPoints, Delta);
path.PathTypes.Should().BeEquivalentTo(new byte[] { 0, 1, 1, 129 });
}
@ -2166,7 +2166,7 @@ public class GraphicsPathTests
path.PathPoints.Should().HaveCount(13);
path.PathTypes.Should().HaveCount(13);
path.PathData.Points.Should().HaveCount(13);
path.GetBounds().Should().BeApproximately(new (1f, 1f, 2f, 2f), Delta);
path.GetBounds().Should().BeApproximately(new(1f, 1f, 2f, 2f), Delta);
path.PathTypes.Should().BeEquivalentTo(new byte[] { 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 131 });
}
@ -2182,7 +2182,7 @@ public class GraphicsPathTests
path.PathPoints.Should().HaveCount(5);
path.PathTypes.Should().HaveCount(5);
path.PathData.Points.Should().HaveCount(5);
path.GetBounds().Should().BeApproximately(new (2f, 2f, 0.9999058f, 0.0274119377f), Delta);
path.GetBounds().Should().BeApproximately(new(2f, 2f, 0.9999058f, 0.0274119377f), Delta);
path.PathPoints.Should().BeApproximatelyEquivalentTo(expectedPoints, Delta);
path.PathTypes.Should().BeEquivalentTo(new byte[] { 0, 1, 3, 3, 131 });
}
@ -2199,7 +2199,7 @@ public class GraphicsPathTests
path.PathPoints.Should().HaveCount(3);
path.PathTypes.Should().HaveCount(3);
path.PathData.Points.Should().HaveCount(3);
path.GetBounds().Should().BeApproximately(new (1f, 1f, 2f, 2f), Delta);
path.GetBounds().Should().BeApproximately(new(1f, 1f, 2f, 2f), Delta);
path.PathPoints.Should().BeApproximatelyEquivalentTo(expectedPoints, Delta);
path.PathTypes.Should().BeEquivalentTo(new byte[] { 0, 1, 129 });
}

Просмотреть файл

@ -7,7 +7,7 @@ public class HatchBrushTests
{
public static IEnumerable<object[]> Ctor_HatchStyle_ForeColor_TestData()
{
yield return new object[] { HatchStyle.Horizontal, new Color() };
yield return new object[] { HatchStyle.Horizontal, default(Color) };
yield return new object[] { HatchStyle.SolidDiamond, Color.PapayaWhip };
}
@ -26,7 +26,7 @@ public class HatchBrushTests
public static IEnumerable<object[]> Ctor_HatchStyle_ForeColor_BackColor_TestData()
{
yield return new object[] { HatchStyle.Horizontal, new Color(), new Color() };
yield return new object[] { HatchStyle.Horizontal, default(Color), default(Color) };
yield return new object[] { HatchStyle.SolidDiamond, Color.PapayaWhip, Color.Plum };
}
@ -45,7 +45,7 @@ public class HatchBrushTests
}
[Theory]
[InlineData(HatchStyle.Horizontal -1 )]
[InlineData(HatchStyle.Horizontal - 1)]
[InlineData(HatchStyle.SolidDiamond + 1)]
public void Ctor_InvalidHatchStyle_ThrowsArgumentException(HatchStyle hatchStyle)
{
@ -82,7 +82,7 @@ public class HatchBrushTests
HatchBrush brush = new(HatchStyle.DarkHorizontal, Color.PeachPuff, Color.Purple);
brush.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => brush.Clone());
AssertExtensions.Throws<ArgumentException>(null, brush.Clone);
}
[Fact]

Просмотреть файл

@ -23,7 +23,7 @@ public class LinearGradientBrushTests
{
using LinearGradientBrush brush = new((PointF)point1, point2, color1, color2);
Assert.Equal([1], brush.Blend.Factors);
Assert.Equal(1, brush.Blend.Positions.Length);
Assert.Single(brush.Blend.Positions);
Assert.False(brush.GammaCorrection);
_ = brush.InterpolationColors;
@ -50,7 +50,7 @@ public class LinearGradientBrushTests
{
using LinearGradientBrush brush = new(point1, point2, color1, color2);
Assert.Equal([1], brush.Blend.Factors);
Assert.Equal(1, brush.Blend.Positions.Length);
Assert.Single(brush.Blend.Positions);
Assert.False(brush.GammaCorrection);
_ = brush.InterpolationColors;
@ -84,7 +84,7 @@ public class LinearGradientBrushTests
{
using LinearGradientBrush brush = new(rectangle, color1, color2, linearGradientMode);
Assert.Equal([1], brush.Blend.Factors);
Assert.Equal(1, brush.Blend.Positions.Length);
Assert.Single(brush.Blend.Positions);
Assert.False(brush.GammaCorrection);
_ = brush.InterpolationColors;
@ -101,7 +101,7 @@ public class LinearGradientBrushTests
{
using LinearGradientBrush brush = new((RectangleF)rectangle, color1, color2, linearGradientMode);
Assert.Equal([1], brush.Blend.Factors);
Assert.Equal(1, brush.Blend.Positions.Length);
Assert.Single(brush.Blend.Positions);
Assert.False(brush.GammaCorrection);
_ = brush.InterpolationColors;
@ -127,7 +127,7 @@ public class LinearGradientBrushTests
{
using LinearGradientBrush brush = new(rectangle, color1, color2, angle);
Assert.Equal([1], brush.Blend.Factors);
Assert.Equal(1, brush.Blend.Positions.Length);
Assert.Single(brush.Blend.Positions);
Assert.False(brush.GammaCorrection);
_ = brush.InterpolationColors;
@ -144,7 +144,7 @@ public class LinearGradientBrushTests
{
using LinearGradientBrush brush = new((RectangleF)rectangle, color1, color2, angle);
Assert.Equal([1], brush.Blend.Factors);
Assert.Equal(1, brush.Blend.Positions.Length);
Assert.Single(brush.Blend.Positions);
Assert.False(brush.GammaCorrection);
_ = brush.InterpolationColors;
@ -170,7 +170,7 @@ public class LinearGradientBrushTests
{
using LinearGradientBrush brush = new(rectangle, color1, color2, angle, isAngleScalable);
Assert.Equal([1], brush.Blend.Factors);
Assert.Equal(1, brush.Blend.Positions.Length);
Assert.Single(brush.Blend.Positions);
Assert.False(brush.GammaCorrection);
_ = brush.InterpolationColors;
@ -187,7 +187,7 @@ public class LinearGradientBrushTests
{
using LinearGradientBrush brush = new((RectangleF)rectangle, color1, color2, angle, isAngleScalable);
Assert.Equal([1], brush.Blend.Factors);
Assert.Equal(1, brush.Blend.Positions.Length);
Assert.Single(brush.Blend.Positions);
Assert.False(brush.GammaCorrection);
_ = brush.InterpolationColors;
@ -249,7 +249,7 @@ public class LinearGradientBrushTests
LinearGradientBrush brush = new(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true);
brush.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => brush.Clone());
AssertExtensions.Throws<ArgumentException>(null, brush.Clone);
}
[Fact]
@ -649,7 +649,7 @@ public class LinearGradientBrushTests
LinearGradientBrush brush = new(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true);
brush.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => brush.ResetTransform());
AssertExtensions.Throws<ArgumentException>(null, brush.ResetTransform);
}
[Fact]

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// Copyright (C) 2005-2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
@ -127,8 +127,8 @@ public partial class MatrixTests
[Fact]
public void Ctor_NullPoints_ThrowsArgumentNullException()
{
AssertExtensions.Throws<ArgumentNullException>("plgpts", () => new Matrix(new RectangleF(), null));
AssertExtensions.Throws<ArgumentNullException>("plgpts", () => new Matrix(new Rectangle(), null));
AssertExtensions.Throws<ArgumentNullException>("plgpts", () => new Matrix(default(RectangleF), null));
AssertExtensions.Throws<ArgumentNullException>("plgpts", () => new Matrix(default, null));
}
[Theory]
@ -137,8 +137,8 @@ public partial class MatrixTests
[InlineData(4)]
public void Ctor_PointsLengthNotThree_ThrowsArgumentNullException(int length)
{
AssertExtensions.Throws<ArgumentException>(null, () => new Matrix(new RectangleF(), new PointF[length]));
AssertExtensions.Throws<ArgumentException>(null, () => new Matrix(new Rectangle(), new Point[length]));
AssertExtensions.Throws<ArgumentException>(null, () => new Matrix(default, new PointF[length]));
AssertExtensions.Throws<ArgumentException>(null, () => new Matrix(default, new Point[length]));
}
[Fact]
@ -258,12 +258,12 @@ public partial class MatrixTests
using Matrix matrix4 = new(1, 2, 3, f, 5, 6);
using Matrix matrix5 = new(1, 2, 3, 4, f, 6);
using Matrix matrix6 = new(1, 2, 3, 4, 5, f);
AssertExtensions.Throws<ArgumentException>(null, () => matrix1.Invert());
AssertExtensions.Throws<ArgumentException>(null, () => matrix2.Invert());
AssertExtensions.Throws<ArgumentException>(null, () => matrix3.Invert());
AssertExtensions.Throws<ArgumentException>(null, () => matrix4.Invert());
AssertExtensions.Throws<ArgumentException>(null, () => matrix5.Invert());
AssertExtensions.Throws<ArgumentException>(null, () => matrix6.Invert());
AssertExtensions.Throws<ArgumentException>(null, matrix1.Invert);
AssertExtensions.Throws<ArgumentException>(null, matrix2.Invert);
AssertExtensions.Throws<ArgumentException>(null, matrix3.Invert);
AssertExtensions.Throws<ArgumentException>(null, matrix4.Invert);
AssertExtensions.Throws<ArgumentException>(null, matrix5.Invert);
AssertExtensions.Throws<ArgumentException>(null, matrix6.Invert);
}
[Fact]

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// Copyright (C) 2005-2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
@ -131,7 +131,7 @@ public class PathGradientBrushTests
PathGradientBrush brush = new(_defaultFloatPoints);
brush.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => brush.Clone());
AssertExtensions.Throws<ArgumentException>(null, brush.Clone);
}
[Fact]
@ -265,7 +265,7 @@ public class PathGradientBrushTests
else
{
Assert.Equal(factors, brush.Blend.Factors);
Assert.Equal(1, brush.Blend.Positions.Length);
Assert.Single(brush.Blend.Positions);
}
}
@ -274,13 +274,13 @@ public class PathGradientBrushTests
{
using PathGradientBrush brush = new(_defaultFloatPoints, WrapMode.TileFlipXY);
brush.Blend.Factors = [];
Assert.Equal(1, brush.Blend.Factors.Length);
Assert.Single(brush.Blend.Factors);
brush.Blend.Factors = new float[2];
Assert.Equal(1, brush.Blend.Factors.Length);
Assert.Single(brush.Blend.Factors);
brush.Blend.Positions = [];
Assert.Equal(1, brush.Blend.Positions.Length);
Assert.Single(brush.Blend.Positions);
brush.Blend.Positions = new float[2];
Assert.Equal(1, brush.Blend.Positions.Length);
Assert.Single(brush.Blend.Positions);
}
[Fact]
@ -312,7 +312,7 @@ public class PathGradientBrushTests
[Fact]
public void Blend_InvalidFactorPositionsLengthMismatch_ThrowsArgumentException()
{
Blend invalidBlend = new () { Factors = new float[2], Positions = new float[1] };
Blend invalidBlend = new() { Factors = new float[2], Positions = new float[1] };
using PathGradientBrush brush = new(_defaultFloatPoints);
AssertExtensions.Throws<ArgumentException>("value", null, () => brush.Blend = invalidBlend);
@ -554,9 +554,9 @@ public class PathGradientBrushTests
Assert.NotEqual(Color.Pink, brush.InterpolationColors.Colors[0]);
Assert.Equal(defaultColors, brush.InterpolationColors.Colors);
brush.InterpolationColors.Positions = [];
Assert.Equal(1, brush.InterpolationColors.Positions.Length);
Assert.Single(brush.InterpolationColors.Positions);
brush.InterpolationColors.Positions = new float[2];
Assert.Equal(1, brush.InterpolationColors.Positions.Length);
Assert.Single(brush.InterpolationColors.Positions);
}
[Fact]
@ -688,7 +688,7 @@ public class PathGradientBrushTests
PathGradientBrush brush = new(_defaultFloatPoints);
brush.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => brush.ResetTransform());
AssertExtensions.Throws<ArgumentException>(null, brush.ResetTransform);
}
[Fact]
@ -941,7 +941,7 @@ public class PathGradientBrushTests
{
Assert.Equal(_defaultRectangle, brush.Rectangle);
Assert.Equal([1], brush.Blend.Factors);
Assert.Equal(1, brush.Blend.Positions.Length);
Assert.Single(brush.Blend.Positions);
Assert.Equal(new PointF(10.5f, 16f), brush.CenterPoint);
Assert.Equal(new Color[] { Color.Empty }, brush.InterpolationColors.Colors);
Assert.Equal(new Color[] { Color.FromArgb(255, 255, 255, 255) }, brush.SurroundColors);

Просмотреть файл

@ -411,7 +411,7 @@ public class FontTests
Font font = new(family, 10);
font.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => font.Clone());
AssertExtensions.Throws<ArgumentException>(null, font.Clone);
}
public static IEnumerable<object[]> Equals_TestData()
@ -652,7 +652,7 @@ public class FontTests
}
}
[Serializable()]
[Serializable]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct UnblittableLOGFONT
{

Просмотреть файл

@ -141,12 +141,12 @@ public partial class GraphicsTests
hdc = graphics.GetHdc();
graphics.ReleaseHdc(hdc);
AssertExtensions.Throws<ArgumentException>(null, () => graphics.ReleaseHdc());
AssertExtensions.Throws<ArgumentException>(null, graphics.ReleaseHdc);
AssertExtensions.Throws<ArgumentException>(null, () => graphics.ReleaseHdcInternal(hdc));
hdc = graphics.GetHdc();
graphics.ReleaseHdcInternal(hdc);
AssertExtensions.Throws<ArgumentException>(null, () => graphics.ReleaseHdc());
AssertExtensions.Throws<ArgumentException>(null, graphics.ReleaseHdc);
AssertExtensions.Throws<ArgumentException>(null, () => graphics.ReleaseHdcInternal(hdc));
}
@ -187,7 +187,7 @@ public partial class GraphicsTests
{
using Bitmap bitmap = new(10, 10);
using Graphics graphics = Graphics.FromImage(bitmap);
AssertExtensions.Throws<ArgumentException>(null, () => graphics.ReleaseHdc());
AssertExtensions.Throws<ArgumentException>(null, graphics.ReleaseHdc);
AssertExtensions.Throws<ArgumentException>(null, () => graphics.ReleaseHdc(IntPtr.Zero));
AssertExtensions.Throws<ArgumentException>(null, () => graphics.ReleaseHdcInternal(IntPtr.Zero));
}
@ -199,7 +199,7 @@ public partial class GraphicsTests
Graphics graphics = Graphics.FromImage(bitmap);
graphics.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => graphics.ReleaseHdc());
AssertExtensions.Throws<ArgumentException>(null, graphics.ReleaseHdc);
AssertExtensions.Throws<ArgumentException>(null, () => graphics.ReleaseHdc(IntPtr.Zero));
AssertExtensions.Throws<ArgumentException>(null, () => graphics.ReleaseHdcInternal(IntPtr.Zero));
}
@ -556,7 +556,7 @@ public partial class GraphicsTests
graphics.GetHdc();
try
{
Assert.Throws<InvalidOperationException>(() => graphics.Flush());
Assert.Throws<InvalidOperationException>(graphics.Flush);
Assert.Throws<InvalidOperationException>(() => graphics.Flush(FlushIntention.Sync));
}
finally
@ -572,7 +572,7 @@ public partial class GraphicsTests
Graphics graphics = Graphics.FromImage(image);
graphics.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => graphics.Flush());
AssertExtensions.Throws<ArgumentException>(null, graphics.Flush);
AssertExtensions.Throws<ArgumentException>(null, () => graphics.Flush(FlushIntention.Flush));
}
@ -1163,7 +1163,7 @@ public partial class GraphicsTests
graphics.GetHdc();
try
{
Assert.Throws<InvalidOperationException>(() => graphics.ResetTransform());
Assert.Throws<InvalidOperationException>(graphics.ResetTransform);
}
finally
{
@ -1178,7 +1178,7 @@ public partial class GraphicsTests
Graphics graphics = Graphics.FromImage(image);
graphics.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => graphics.ResetTransform());
AssertExtensions.Throws<ArgumentException>(null, graphics.ResetTransform);
}
[Fact]
@ -2781,7 +2781,7 @@ public partial class GraphicsTests
{
using Bitmap image = new(50, 50);
using Graphics graphics = Graphics.FromImage(image);
graphics.DrawString("Test text", SystemFonts.DefaultFont, Brushes.White, new Point());
graphics.DrawString("Test text", SystemFonts.DefaultFont, Brushes.White, default(Point));
Helpers.VerifyBitmapNotBlank(image);
}
@ -2793,7 +2793,7 @@ public partial class GraphicsTests
graphics.CompositingMode = CompositingMode.SourceCopy;
AssertExtensions.Throws<ArgumentException>(
null,
() => graphics.DrawString("Test text", SystemFonts.DefaultFont, Brushes.White, new Point()));
() => graphics.DrawString("Test text", SystemFonts.DefaultFont, Brushes.White, default(Point)));
}
private static void VerifyGraphics(Graphics graphics, RectangleF expectedVisibleClipBounds)
@ -2898,7 +2898,7 @@ public partial class GraphicsTests
}
#endif
internal unsafe static void VerifyBitmapEmpty(Bitmap bitmap)
internal static unsafe void VerifyBitmapEmpty(Bitmap bitmap)
{
BitmapData data = bitmap.LockBits(default, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
try
@ -2912,7 +2912,7 @@ public partial class GraphicsTests
}
}
internal unsafe static void VerifyBitmapNotEmpty(Bitmap bitmap)
internal static unsafe void VerifyBitmapNotEmpty(Bitmap bitmap)
{
BitmapData data = bitmap.LockBits(default, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
try

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// Copyright (C) 2004,2006-2008 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
@ -551,7 +551,7 @@ public class IconTests
[Fact]
public void ToBitmap_PngIconSupportedInSwitches_Success()
{
void VerifyPng()
static void VerifyPng()
{
using Icon icon = GetPngIcon();
using Bitmap bitmap = icon.ToBitmap();
@ -586,10 +586,10 @@ public class IconTests
[Fact]
public void ToBitmap_PngIconNotSupportedInSwitches_ThrowsArgumentOutOfRangeException()
{
void VerifyPngNotSupported()
static void VerifyPngNotSupported()
{
using Icon icon = GetPngIcon();
AssertExtensions.Throws<ArgumentOutOfRangeException>(null, () => icon.ToBitmap());
AssertExtensions.Throws<ArgumentOutOfRangeException>(null, icon.ToBitmap);
}
if (RemoteExecutor.IsSupported && (!AppContext.TryGetSwitch(DontSupportPngFramesInIcons, out bool isEnabled) || !isEnabled))

Просмотреть файл

@ -9,8 +9,8 @@ public class ColorMapTests
public void Ctor_Default()
{
ColorMap cm = new();
Assert.Equal(new Color(), cm.OldColor);
Assert.Equal(new Color(), cm.NewColor);
Assert.Equal(default, cm.OldColor);
Assert.Equal(default, cm.NewColor);
}
[Fact]

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// Copyright (C) 2005-2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
@ -81,8 +81,8 @@ public class ColorMatrixTests
[3.0f],
[4.0f],
[5.0f]
}
, typeof(IndexOutOfRangeException)
},
typeof(IndexOutOfRangeException)
};
}
}

Просмотреть файл

@ -16,7 +16,7 @@ public class EffectsTests
// We don't really need to check all effect results, just seeing that something changed for one is probably
// enough until we look at providing alternative implementations.
bitmap.GetPixel(0,0).Should().Be(Color.FromArgb(255, 255, 255, 239));
bitmap.GetPixel(0, 0).Should().Be(Color.FromArgb(255, 255, 255, 239));
}
[Theory]

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// Copyright (C) 2005-2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
@ -84,7 +84,7 @@ public class ImageAttributesTests
ImageAttributes imageAttr = new();
imageAttr.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => imageAttr.Clone());
AssertExtensions.Throws<ArgumentException>(null, imageAttr.Clone);
}
[Fact]
@ -323,7 +323,7 @@ public class ImageAttributesTests
ImageAttributes imageAttr = new();
imageAttr.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => imageAttr.ClearColorMatrix());
AssertExtensions.Throws<ArgumentException>(null, imageAttr.ClearColorMatrix);
AssertExtensions.Throws<ArgumentException>(null, () => imageAttr.ClearColorMatrix(ColorAdjustType.Default));
}
@ -699,7 +699,7 @@ public class ImageAttributesTests
ImageAttributes imageAttr = new();
imageAttr.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => imageAttr.SetNoOp());
AssertExtensions.Throws<ArgumentException>(null, imageAttr.SetNoOp);
AssertExtensions.Throws<ArgumentException>(null, () => imageAttr.SetNoOp(ColorAdjustType.Default));
}
@ -767,7 +767,7 @@ public class ImageAttributesTests
ImageAttributes imageAttr = new();
imageAttr.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => imageAttr.ClearNoOp());
AssertExtensions.Throws<ArgumentException>(null, imageAttr.ClearNoOp);
AssertExtensions.Throws<ArgumentException>(null, () => imageAttr.ClearNoOp(ColorAdjustType.Default));
}
@ -877,7 +877,7 @@ public class ImageAttributesTests
ImageAttributes imageAttr = new();
imageAttr.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => imageAttr.ClearColorKey());
AssertExtensions.Throws<ArgumentException>(null, imageAttr.ClearColorKey);
AssertExtensions.Throws<ArgumentException>(null, () => imageAttr.ClearColorKey(ColorAdjustType.Default));
}
@ -1038,7 +1038,7 @@ public class ImageAttributesTests
ImageAttributes imageAttr = new();
imageAttr.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => imageAttr.ClearOutputChannel());
AssertExtensions.Throws<ArgumentException>(null, imageAttr.ClearOutputChannel);
AssertExtensions.Throws<ArgumentException>(null, () => imageAttr.ClearOutputChannel(ColorAdjustType.Default));
}
@ -1153,7 +1153,7 @@ public class ImageAttributesTests
ImageAttributes imageAttr = new();
imageAttr.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => imageAttr.ClearOutputChannelColorProfile());
AssertExtensions.Throws<ArgumentException>(null, imageAttr.ClearOutputChannelColorProfile);
AssertExtensions.Throws<ArgumentException>(null, () => imageAttr.ClearOutputChannelColorProfile(ColorAdjustType.Default));
}
@ -1275,7 +1275,7 @@ public class ImageAttributesTests
ImageAttributes imageAttr = new();
imageAttr.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => imageAttr.ClearRemapTable());
AssertExtensions.Throws<ArgumentException>(null, imageAttr.ClearRemapTable);
AssertExtensions.Throws<ArgumentException>(null, () => imageAttr.ClearRemapTable(ColorAdjustType.Default));
}

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// Authors:
// Jordi Mas i Hernandez (jordi@ximian.com)
// Sebastien Pouliot <sebastien@ximian.com>

Просмотреть файл

@ -34,8 +34,10 @@ public class ImageFormatTests
yield return new object[] { JpegImageFormat.Guid, ImageFormat.Jpeg };
yield return new object[] { WmfImageFormat.Guid, ImageFormat.Wmf };
#if NET
#pragma warning disable CA1416 // Validate platform compatibility
yield return new object[] { HeifImageFormat.Guid, ImageFormat.Heif };
yield return new object[] { WebpImageFormat.Guid, ImageFormat.Webp };
#pragma warning restore CA1416
#endif
yield return new object[] { new Guid("48749428-316f-496a-ab30-c819a92b3137"), CustomImageFormat };
}
@ -56,8 +58,10 @@ public class ImageFormatTests
yield return new object[] { "Jpeg", ImageFormat.Jpeg };
yield return new object[] { "Wmf", ImageFormat.Wmf };
#if NET
#pragma warning disable CA1416 // Validate platform compatibility
yield return new object[] { "Heif", ImageFormat.Heif };
yield return new object[] { "Webp", ImageFormat.Webp };
#pragma warning restore CA1416
#endif
yield return new object[] { "[ImageFormat: 48749428-316f-496a-ab30-c819a92b3137]", CustomImageFormat };
}
@ -69,7 +73,7 @@ public class ImageFormatTests
{
yield return new object[] { Path.Combine("bitmaps", "nature24bits.gif"), "Gif" };
yield return new object[] { Path.Combine("bitmaps", "nature24bits.jpg"), "Jpeg" };
yield return new object[] { Path.Combine("bitmaps", "VisualPng.ico"), "Icon"};
yield return new object[] { Path.Combine("bitmaps", "VisualPng.ico"), "Icon" };
yield return new object[] { Path.Combine("bitmaps", "almogaver32bits.tif"), "Tiff" };
}
}

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// Copyright (C) 2005-2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
@ -513,7 +513,7 @@ public class MetafileTests
using (Bitmap bmp = new(10, 10, PixelFormat.Format32bppArgb))
using (Graphics g = Graphics.FromImage(bmp))
using (Metafile metafile = new(
fileName, g.GetHdc(), new RectangleF(), MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly, description))
fileName, g.GetHdc(), default(RectangleF), MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly, description))
{
AssertMetafileIsBlank(metafile);
AssertEmfType(metafile.GetMetafileHeader(), EmfType.EmfOnly);
@ -597,7 +597,7 @@ public class MetafileTests
using (Bitmap bmp = new(10, 10, PixelFormat.Format32bppArgb))
using (Graphics g = Graphics.FromImage(bmp))
using (Metafile metafile = new(
fileName, g.GetHdc(), new Rectangle(), MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly, description))
fileName, g.GetHdc(), default, MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly, description))
{
AssertMetafileIsBlank(metafile);
AssertEmfType(metafile.GetMetafileHeader(), EmfType.EmfOnly);
@ -772,7 +772,7 @@ public class MetafileTests
using Graphics g = Graphics.FromImage(bmp);
using MemoryStream stream = new();
using Metafile metafile = new(
stream, g.GetHdc(), new Rectangle(), MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly, description);
stream, g.GetHdc(), default, MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly, description);
AssertMetafileIsBlank(metafile);
AssertEmfType(metafile.GetMetafileHeader(), EmfType.EmfOnly);
}
@ -898,7 +898,7 @@ public class MetafileTests
Metafile metafile = new(GetPath(WmfFile));
metafile.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => metafile.GetMetafileHeader());
AssertExtensions.Throws<ArgumentException>(null, metafile.GetMetafileHeader);
}
[Fact]

Просмотреть файл

@ -63,7 +63,7 @@ public class PropertyItemTests
public static IEnumerable<object[]> Properties_TestData()
{
yield return new object[] { int.MaxValue, int.MaxValue, short.MaxValue, new byte[1] { 0 } };
yield return new object[] { int.MinValue, int.MinValue, short.MinValue, new byte[2] { 1, 1} };
yield return new object[] { int.MinValue, int.MinValue, short.MinValue, new byte[2] { 1, 1 } };
yield return new object[] { 0, 0, 0, new byte[0] };
}

Просмотреть файл

@ -148,7 +148,7 @@ public class PenTests
[Theory]
[MemberData(nameof(Ctor_Brush_TestData))]
public void Brush_SetValid_GetReturnsExpected<T>(T brush, PenType penType) where T : Brush
public void Brush_SetValid_GetReturnsExpected<T>(T brush, PenType penType) where T : Brush
{
using Pen pen = new(Color.Red);
pen.Brush = brush;
@ -228,7 +228,7 @@ public class PenTests
Pen pen = new(brush);
pen.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => pen.Clone());
AssertExtensions.Throws<ArgumentException>(null, pen.Clone);
}
[Fact]
@ -875,7 +875,7 @@ public class PenTests
Pen pen = new(brush);
pen.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => pen.ResetTransform());
AssertExtensions.Throws<ArgumentException>(null, pen.ResetTransform);
}
public static IEnumerable<object[]> RotateTransform_TestData()

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
//

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// Copyright (C) 2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// Copyright (C) 2005-2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
@ -203,7 +203,7 @@ public class PrintDocumentTests : FileCleanupTestBase
Assert.False(flag);
}
[ConditionalFact(Helpers.AnyInstalledPrinters)]
[ConditionalFact(Helpers.AnyInstalledPrinters)]
public void QueryPageSettings_SetValue_ReturnsExpected()
{
bool flag = false;

Просмотреть файл

@ -85,7 +85,7 @@ public class PrinterResolutionTests
public static IEnumerable<object[]> ToString_TestData()
{
yield return new object[] { new PrinterResolution(), "[PrinterResolution X=0 Y=0]" };
yield return new object[] { new PrinterResolution { X = -1, Y = -2}, "[PrinterResolution X=-1 Y=-2]" };
yield return new object[] { new PrinterResolution { X = -1, Y = -2 }, "[PrinterResolution X=-1 Y=-2]" };
yield return new object[] { new PrinterResolution { Kind = PrinterResolutionKind.High }, "[PrinterResolution High]" };
yield return new object[] { new PrinterResolution { X = 1, Y = 2, Kind = PrinterResolutionKind.High }, "[PrinterResolution High]" };
}

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
//

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// Copyright (C) 2004-2008 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
@ -517,8 +517,8 @@ public class RegionTests
using GraphicsPath graphicPath = new();
using Region other = new();
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Complement(graphicPath));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Complement(new Rectangle()));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Complement(new RectangleF()));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Complement(default(Rectangle)));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Complement(default(RectangleF)));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Complement(disposedRegion));
}
@ -581,7 +581,7 @@ public class RegionTests
using (region)
using (other)
{
Assert.Equal(expected, region.Equals(other, s_graphic));
Assert.Equal(expected, region.Equals(other, s_graphic));
}
}
@ -900,8 +900,8 @@ public class RegionTests
using GraphicsPath graphicsPath = new();
using Region other = new();
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Exclude(graphicsPath));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Exclude(new Rectangle()));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Exclude(new RectangleF()));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Exclude(default(Rectangle)));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Exclude(default(RectangleF)));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Exclude(other));
}
@ -1051,7 +1051,7 @@ public class RegionTests
Assert.False(clipRegion.IsInfinite(s_graphic));
RectangleF[] rects = clipRegion.GetRegionScans(matrix);
Assert.Equal(1, rects.Length);
Assert.Single(rects);
Assert.Equal(new RectangleF(-5, -5, 10, 10), rects[0]);
}
@ -1257,8 +1257,8 @@ public class RegionTests
using GraphicsPath graphicsPath = new();
using Region other = new();
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Intersect(graphicsPath));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Intersect(new Rectangle()));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Intersect(new RectangleF()));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Intersect(default(Rectangle)));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Intersect(default(RectangleF)));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Intersect(other));
}
@ -1796,8 +1796,8 @@ public class RegionTests
using GraphicsPath graphicsPath = new();
using Region other = new();
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Union(graphicsPath));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Union(new Rectangle()));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Union(new RectangleF()));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Union(default(Rectangle)));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Union(default(RectangleF)));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Union(disposedRegion));
}
@ -2154,8 +2154,8 @@ public class RegionTests
using GraphicsPath graphicsPath = new();
using Region other = new();
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Xor(graphicsPath));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Xor(new Rectangle()));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Xor(new RectangleF()));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Xor(default(Rectangle)));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Xor(default(RectangleF)));
AssertExtensions.Throws<ArgumentException>(null, () => disposedRegion.Xor(other));
}
}

Просмотреть файл

@ -7,7 +7,7 @@ public class SolidBrushTests
{
public static IEnumerable<object[]> Colors_TestData()
{
yield return new object[] { new Color(), Color.FromArgb(0) };
yield return new object[] { default(Color), Color.FromArgb(0) };
yield return new object[] { Color.PapayaWhip, Color.PapayaWhip };
}
@ -53,13 +53,13 @@ public class SolidBrushTests
SolidBrush brush = new(Color.LavenderBlush);
brush.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => brush.Clone());
AssertExtensions.Throws<ArgumentException>(null, brush.Clone);
}
[Fact]
public void Color_EmptyAndGetDisposed_ThrowsArgumentException()
{
SolidBrush brush = new(new Color());
SolidBrush brush = new(default(Color));
brush.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => brush.Color);
@ -84,7 +84,7 @@ public class SolidBrushTests
[Fact]
public void Color_SetDisposed_ThrowsArgumentException()
{
SolidBrush brush = new(new Color());
SolidBrush brush = new(default(Color));
brush.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => brush.Color = Color.WhiteSmoke);
@ -109,6 +109,6 @@ public class SolidBrushTests
public void Dispose_SetImmutable_ThrowsArgumentException()
{
SolidBrush brush = Assert.IsType<SolidBrush>(SystemBrushes.ActiveBorder);
AssertExtensions.Throws<ArgumentException>(null, () => brush.Dispose());
AssertExtensions.Throws<ArgumentException>(null, brush.Dispose);
}
}

Просмотреть файл

@ -119,7 +119,7 @@ public class StringFormatTests
StringFormat format = new();
format.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => format.Clone());
AssertExtensions.Throws<ArgumentException>(null, format.Clone);
}
[Theory]
@ -429,6 +429,6 @@ public class StringFormatTests
StringFormat format = new(StringFormatFlags.DirectionVertical);
format.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => format.ToString());
AssertExtensions.Throws<ArgumentException>(null, format.ToString);
}
}

Просмотреть файл

@ -65,7 +65,7 @@ public class SystemFontsTests
// am-ET
0x5E => new SystemFontList("Ebrima"),
// For now we assume everything else uses Segoe UI
_ => new SystemFontList("Segoe UI"),// If there's other failure reported we can add it
_ => new SystemFontList("Segoe UI"), // If there's other failure reported we can add it
};
return fonts.ToTestData();
}
@ -125,7 +125,7 @@ public class SystemFontsTests
public IEnumerable<object[]> ToTestData()
{
return new []
return new[]
{
new object[] { () => SystemFonts.CaptionFont, nameof(CaptionFont), CaptionFont},
[(() => SystemFonts.IconTitleFont), nameof(IconTitleFont), IconTitleFont],

Просмотреть файл

@ -55,7 +55,7 @@ public class SystemPensTests
Assert.Equal(PenType.SolidColor, pen.PenType);
Assert.Same(pen, getPen());
AssertExtensions.Throws<ArgumentException>(null, () => pen.Dispose());
AssertExtensions.Throws<ArgumentException>(null, pen.Dispose);
AssertExtensions.Throws<ArgumentException>(null, () => pen.SetLineCap(LineCap.ArrowAnchor, LineCap.Custom, DashCap.Round));
AssertExtensions.Throws<ArgumentException>(null, () => pen.Alignment = PenAlignment.Center);

Просмотреть файл

@ -315,7 +315,7 @@ public class TextureBrushTests
TextureBrush brush = new(image);
brush.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => brush.Clone());
AssertExtensions.Throws<ArgumentException>(null, brush.Clone);
}
[Fact]
@ -450,7 +450,7 @@ public class TextureBrushTests
TextureBrush brush = new(image);
brush.Dispose();
AssertExtensions.Throws<ArgumentException>(null, () => brush.ResetTransform());
AssertExtensions.Throws<ArgumentException>(null, brush.ResetTransform);
}
public static IEnumerable<object[]> RotateTransform_TestData()

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// BMPCodec class testing unit
//
// Authors:

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// GIF Codec class testing unit
//
// Authors:

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// ICO Codec class testing unit
//
// Authors:
@ -49,7 +49,7 @@ public class IconCodecTest
Assert.True(bmp.RawFormat.Equals(ImageFormat.MemoryBmp));
Assert.Equal(PixelFormat.Format32bppArgb, bmp.PixelFormat);
Assert.Equal(2, bmp.Flags);
Assert.Equal(0, bmp.Palette.Entries.Length);
Assert.Empty(bmp.Palette.Entries);
}
[Fact]
@ -57,7 +57,7 @@ public class IconCodecTest
{
string sInFile = Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico");
using Image image = Image.FromFile(sInFile);
Assert.Equal(0, image.Palette.Entries.Length);
Assert.Empty(image.Palette.Entries);
}
// simley.ico has 48x48, 32x32 and 16x16 images (in that order)
@ -74,9 +74,9 @@ public class IconCodecTest
Assert.Equal(PixelFormat.Format32bppArgb, bmp.PixelFormat);
Assert.Equal(73746, bmp.Flags);
Assert.Equal(1, bmp.FrameDimensionsList.Length);
Assert.Equal(0, bmp.PropertyIdList.Length);
Assert.Equal(0, bmp.PropertyItems.Length);
Assert.Single(bmp.FrameDimensionsList);
Assert.Empty(bmp.PropertyIdList);
Assert.Empty(bmp.PropertyItems);
Assert.Null(bmp.Tag);
Assert.Equal(96.0f, bmp.HorizontalResolution);
Assert.Equal(96.0f, bmp.VerticalResolution);
@ -97,7 +97,7 @@ public class IconCodecTest
{
string sInFile = Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico");
using Bitmap bmp = new(sInFile);
Assert.Equal(0, bmp.Palette.Entries.Length);
Assert.Empty(bmp.Palette.Entries);
}
[Fact]
@ -222,9 +222,9 @@ public class IconCodecTest
Assert.Equal(PixelFormat.Format32bppArgb, bmp.PixelFormat);
Assert.Equal(73746, bmp.Flags);
Assert.Equal(1, bmp.FrameDimensionsList.Length);
Assert.Equal(0, bmp.PropertyIdList.Length);
Assert.Equal(0, bmp.PropertyItems.Length);
Assert.Single(bmp.FrameDimensionsList);
Assert.Empty(bmp.PropertyIdList);
Assert.Empty(bmp.PropertyItems);
Assert.Null(bmp.Tag);
Assert.Equal(96.0f, bmp.HorizontalResolution);
Assert.Equal(96.0f, bmp.VerticalResolution);
@ -245,7 +245,7 @@ public class IconCodecTest
{
string sInFile = Helpers.GetTestBitmapPath("VisualPng.ico");
using Bitmap bmp = new(sInFile);
Assert.Equal(0, bmp.Palette.Entries.Length);
Assert.Empty(bmp.Palette.Entries);
}
[Fact]
@ -427,9 +427,9 @@ public class IconCodecTest
Assert.Equal(PixelFormat.Format32bppArgb, bmp.PixelFormat);
Assert.Equal(73746, bmp.Flags);
Assert.Equal(1, bmp.FrameDimensionsList.Length);
Assert.Equal(0, bmp.PropertyIdList.Length);
Assert.Equal(0, bmp.PropertyItems.Length);
Assert.Single(bmp.FrameDimensionsList);
Assert.Empty(bmp.PropertyIdList);
Assert.Empty(bmp.PropertyItems);
Assert.Null(bmp.Tag);
Assert.Equal(96.0f, bmp.HorizontalResolution);
Assert.Equal(96.0f, bmp.VerticalResolution);
@ -450,7 +450,7 @@ public class IconCodecTest
{
string sInFile = Helpers.GetTestBitmapPath("48x48_one_entry_1bit.ico");
using Bitmap bmp = new(sInFile);
Assert.Equal(0, bmp.Palette.Entries.Length);
Assert.Empty(bmp.Palette.Entries);
}
[Fact]
@ -649,9 +649,9 @@ public class IconCodecTest
Assert.Equal(PixelFormat.Format32bppArgb, bmp.PixelFormat);
Assert.Equal(73746, bmp.Flags);
Assert.Equal(1, bmp.FrameDimensionsList.Length);
Assert.Equal(0, bmp.PropertyIdList.Length);
Assert.Equal(0, bmp.PropertyItems.Length);
Assert.Single(bmp.FrameDimensionsList);
Assert.Empty(bmp.PropertyIdList);
Assert.Empty(bmp.PropertyItems);
Assert.Null(bmp.Tag);
Assert.Equal(96.0f, bmp.HorizontalResolution);
Assert.Equal(96.0f, bmp.VerticalResolution);
@ -672,7 +672,7 @@ public class IconCodecTest
{
string sInFile = Helpers.GetTestBitmapPath("64x64_one_entry_8bit.ico");
using Bitmap bmp = new(sInFile);
Assert.Equal(0, bmp.Palette.Entries.Length);
Assert.Empty(bmp.Palette.Entries);
}
[Fact]
@ -907,9 +907,9 @@ public class IconCodecTest
Assert.Equal(PixelFormat.Format32bppArgb, bmp.PixelFormat);
Assert.Equal(73746, bmp.Flags);
Assert.Equal(1, bmp.FrameDimensionsList.Length);
Assert.Equal(0, bmp.PropertyIdList.Length);
Assert.Equal(0, bmp.PropertyItems.Length);
Assert.Single(bmp.FrameDimensionsList);
Assert.Empty(bmp.PropertyIdList);
Assert.Empty(bmp.PropertyItems);
Assert.Null(bmp.Tag);
Assert.Equal(96.0f, bmp.HorizontalResolution);
Assert.Equal(96.0f, bmp.VerticalResolution);
@ -930,7 +930,7 @@ public class IconCodecTest
{
string sInFile = Helpers.GetTestBitmapPath("96x96_one_entry_8bit.ico");
using Bitmap bmp = new(sInFile);
Assert.Equal(0, bmp.Palette.Entries.Length);
Assert.Empty(bmp.Palette.Entries);
}
[Fact]
@ -1840,10 +1840,10 @@ public class IconCodecTest
// note that image is "promoted" to 32bits
Assert.Equal(PixelFormat.Format32bppArgb, bmp.PixelFormat);
Assert.Equal(73746, bmp.Flags);
Assert.Equal(0, bmp.Palette.Entries.Length);
Assert.Equal(1, bmp.FrameDimensionsList.Length);
Assert.Equal(0, bmp.PropertyIdList.Length);
Assert.Equal(0, bmp.PropertyItems.Length);
Assert.Empty(bmp.Palette.Entries);
Assert.Single(bmp.FrameDimensionsList);
Assert.Empty(bmp.PropertyIdList);
Assert.Empty(bmp.PropertyItems);
Assert.Null(bmp.Tag);
Assert.Equal(96.0f, bmp.HorizontalResolution);
Assert.Equal(96.0f, bmp.VerticalResolution);

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// JpegCodec class testing unit
//
// Authors:
@ -192,7 +192,7 @@ public class JpegCodecTest
/* note: under MS flags aren't constant between executions in this case (no palette) */
// Assert.Equal(77960, bmp.Flags);
Assert.Equal(0, bmp.Palette.Entries.Length);
Assert.Empty(bmp.Palette.Entries);
}
[Fact]

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// PNG Codec class testing unit
//
// Authors:
@ -251,7 +251,7 @@ public class PngCodecTest
// MS returns a random Flags value (not a good sign)
// Assert.Equal (0, bmp.Palette.Flags);
Assert.Equal(0, bmp.Palette.Entries.Length);
Assert.Empty(bmp.Palette.Entries);
Assert.Equal(100, bmp.Width);
Assert.Equal(100, bmp.Height);

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// TIFF Codec class testing unit
//
// Authors:

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// Bitmap class testing unit
//
// Authors:
@ -554,7 +554,7 @@ public class BitmapTests
// The results match the .NET Framework
private static readonly byte[] s_defaultBitmapHash = [0x29, 0x39, 0x25, 0xCE, 0x10, 0x9C, 0x6A, 0xB, 0x2D, 0xCD, 0xAA, 0xD9,
0x18, 0xBE, 0xF3, 0xA5, 0x58, 0xA5, 0x4D, 0xD9, 0xFA, 0x41, 0x70, 0x76, 0x83, 0x3, 0x9C, 0x41, 0x5A, 0x25, 0xCE, 0xCB];
private static readonly byte[] s_finalWholeBitmapHash = [0xDE, 0xBF, 0xCF, 0xFB, 0xE, 0x9E, 0xA7, 0xC1, 0x23, 0xC, 0x9E,0x7E,
private static readonly byte[] s_finalWholeBitmapHash = [0xDE, 0xBF, 0xCF, 0xFB, 0xE, 0x9E, 0xA7, 0xC1, 0x23, 0xC, 0x9E, 0x7E,
0xE3, 0xC1, 0xFC, 0x14, 0x37, 0x21, 0xE2, 0x30, 0x2A, 0x6D, 0xD0, 0xDB, 0xBE, 0xE, 0x1C, 0x1F, 0xC2, 0xB7, 0xBD, 0xC4];
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotArm64Process))] // [ActiveIssue("https://github.com/dotnet/winforms/issues/8817")]
@ -1182,7 +1182,7 @@ public class BitmapTests
b.PixelFormat.Should().Be(PixelFormat.Format32bppArgb, msg);
// Unlike the GDI+ icon decoder the palette isn't kept
Assert.Equal(0, b.Palette.Entries.Length);
Assert.Empty(b.Palette.Entries);
Assert.Equal(size, b.Height);
Assert.Equal(size, b.Width);
Assert.Equal(b.RawFormat, ImageFormat.MemoryBmp);
@ -1269,7 +1269,7 @@ public class BitmapTests
using (Bitmap bitmap = new(sInFile))
{
Assert.Equal(PixelFormat.Format24bppRgb, bitmap.PixelFormat);
Assert.Equal(0, bitmap.Palette.Entries.Length);
Assert.Empty(bitmap.Palette.Entries);
Assert.Equal(183, bitmap.Height);
Assert.Equal(173, bitmap.Width);
Assert.Equal(73744, bitmap.Flags);
@ -1280,7 +1280,7 @@ public class BitmapTests
// hbitmap survives original bitmap disposal
using Image image = Image.FromHbitmap(hbitmap);
// Assert.Equal (PixelFormat.Format32bppRgb, image.PixelFormat);
Assert.Equal(0, image.Palette.Entries.Length);
Assert.Empty(image.Palette.Entries);
Assert.Equal(183, image.Height);
Assert.Equal(173, image.Width);
Assert.Equal(335888, image.Flags);
@ -1295,7 +1295,7 @@ public class BitmapTests
using (Bitmap bitmap = new(sInFile))
{
Assert.Equal(PixelFormat.Format24bppRgb, bitmap.PixelFormat);
Assert.Equal(0, bitmap.Palette.Entries.Length);
Assert.Empty(bitmap.Palette.Entries);
Assert.Equal(183, bitmap.Height);
Assert.Equal(173, bitmap.Width);
Assert.Equal(73744, bitmap.Flags);
@ -1307,7 +1307,7 @@ public class BitmapTests
using (Image image = Image.FromHbitmap(hbitmap))
{
// Assert.Equal (PixelFormat.Format32bppRgb, image.PixelFormat);
Assert.Equal(0, image.Palette.Entries.Length);
Assert.Empty(image.Palette.Entries);
Assert.Equal(183, image.Height);
Assert.Equal(173, image.Width);
Assert.Equal(335888, image.Flags);
@ -1316,7 +1316,7 @@ public class BitmapTests
using Image image2 = Image.FromHbitmap(hbitmap);
// Assert.Equal (PixelFormat.Format32bppRgb, image2.PixelFormat);
Assert.Equal(0, image2.Palette.Entries.Length);
Assert.Empty(image2.Palette.Entries);
Assert.Equal(183, image2.Height);
Assert.Equal(173, image2.Width);
Assert.Equal(335888, image2.Flags);

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// Graphics class testing unit
//
// Authors:
@ -154,7 +154,7 @@ public class GraphicsTest : IDisposable
g.Clip = new Region(new Rectangle(50, 40, 210, 220));
rects = g.Clip.GetRegionScans(new Matrix());
Assert.Equal(1, rects.Length);
Assert.Single(rects);
Assert.Equal(50, rects[0].X);
Assert.Equal(40, rects[0].Y);
Assert.Equal(210, rects[0].Width);
@ -208,7 +208,7 @@ public class GraphicsTest : IDisposable
g.IntersectClip(new Rectangle(290, 40, 60, 80));
_rects = g.Clip.GetRegionScans(new Matrix());
Assert.Equal(1, _rects.Length);
Assert.Single(_rects);
Assert.Equal(290, _rects[0].X);
Assert.Equal(40, _rects[0].Y);
@ -226,7 +226,7 @@ public class GraphicsTest : IDisposable
g.ResetClip();
_rects = g.Clip.GetRegionScans(new Matrix());
Assert.Equal(1, _rects.Length);
Assert.Single(_rects);
Assert.Equal(-4194304, _rects[0].X);
Assert.Equal(-4194304, _rects[0].Y);
@ -244,7 +244,7 @@ public class GraphicsTest : IDisposable
// Region
g.SetClip(new Region(new Rectangle(50, 40, 210, 220)), CombineMode.Replace);
rects = g.Clip.GetRegionScans(new Matrix());
Assert.Equal(1, rects.Length);
Assert.Single(rects);
Assert.Equal(50, rects[0].X);
Assert.Equal(40, rects[0].Y);
Assert.Equal(210, rects[0].Width);
@ -256,7 +256,7 @@ public class GraphicsTest : IDisposable
{
g.SetClip(new RectangleF(50, 40, 210, 220));
rects = g.Clip.GetRegionScans(new Matrix());
Assert.Equal(1, rects.Length);
Assert.Single(rects);
Assert.Equal(50, rects[0].X);
Assert.Equal(40, rects[0].Y);
Assert.Equal(210, rects[0].Width);
@ -268,7 +268,7 @@ public class GraphicsTest : IDisposable
{
g.SetClip(new Rectangle(50, 40, 210, 220));
rects = g.Clip.GetRegionScans(new Matrix());
Assert.Equal(1, rects.Length);
Assert.Single(rects);
Assert.Equal(50, rects[0].X);
Assert.Equal(40, rects[0].Y);
Assert.Equal(210, rects[0].Width);
@ -1848,22 +1848,22 @@ public class GraphicsTest : IDisposable
{
using Bitmap bitmap = new(20, 20);
using Graphics g = Graphics.FromImage(bitmap);
Region[] regions = g.MeasureCharacterRanges(null, _font, new RectangleF(), null);
Assert.Equal(0, regions.Length);
Region[] regions = g.MeasureCharacterRanges(null, _font, default, null);
Assert.Empty(regions);
regions = g.MeasureCharacterRanges(string.Empty, _font, new RectangleF(), null);
Assert.Equal(0, regions.Length);
regions = g.MeasureCharacterRanges(string.Empty.AsSpan(), _font, new RectangleF(), null);
Assert.Equal(0, regions.Length);
regions = g.MeasureCharacterRanges(string.Empty, _font, default, null);
Assert.Empty(regions);
regions = g.MeasureCharacterRanges(string.Empty.AsSpan(), _font, default, null);
Assert.Empty(regions);
// null font is ok with null or empty string
regions = g.MeasureCharacterRanges(null, null, new RectangleF(), null);
Assert.Equal(0, regions.Length);
regions = g.MeasureCharacterRanges(null, null, default, null);
Assert.Empty(regions);
regions = g.MeasureCharacterRanges(string.Empty, null, new RectangleF(), null);
Assert.Equal(0, regions.Length);
regions = g.MeasureCharacterRanges(string.Empty.AsSpan(), null, new RectangleF(), null);
Assert.Equal(0, regions.Length);
regions = g.MeasureCharacterRanges(string.Empty, null, default, null);
Assert.Empty(regions);
regions = g.MeasureCharacterRanges(string.Empty.AsSpan(), null, default, null);
Assert.Empty(regions);
}
[Fact]
@ -1872,11 +1872,11 @@ public class GraphicsTest : IDisposable
using Bitmap bitmap = new(20, 20);
using Graphics g = Graphics.FromImage(bitmap);
// string format without character ranges
Region[] regions = g.MeasureCharacterRanges("Mono", _font, new RectangleF(), new StringFormat());
Assert.Equal(0, regions.Length);
Region[] regions = g.MeasureCharacterRanges("Mono", _font, default, new StringFormat());
Assert.Empty(regions);
g.MeasureCharacterRanges("Mono".AsSpan(), _font, new RectangleF(), new StringFormat());
Assert.Equal(0, regions.Length);
g.MeasureCharacterRanges("Mono".AsSpan(), _font, default, new StringFormat());
Assert.Empty(regions);
}
[Fact]
@ -1884,8 +1884,8 @@ public class GraphicsTest : IDisposable
{
using Bitmap bitmap = new(20, 20);
using Graphics g = Graphics.FromImage(bitmap);
Assert.Throws<ArgumentNullException>(() => g.MeasureCharacterRanges("a", null, new RectangleF(), null));
Assert.Throws<ArgumentNullException>(() => g.MeasureCharacterRanges("a".AsSpan(), null, new RectangleF(), null));
Assert.Throws<ArgumentNullException>(() => g.MeasureCharacterRanges("a", null, default, null));
Assert.Throws<ArgumentNullException>(() => g.MeasureCharacterRanges("a".AsSpan(), null, default, null));
}
[Fact]
@ -2000,8 +2000,8 @@ public class GraphicsTest : IDisposable
{
using Bitmap bitmap = new(20, 20);
using Graphics g = Graphics.FromImage(bitmap);
Assert.Throws<ArgumentException>(() => g.MeasureCharacterRanges("Mono", _font, new RectangleF(), null));
Assert.Throws<ArgumentException>(() => g.MeasureCharacterRanges("Mono".AsSpan(), _font, new RectangleF(), null));
Assert.Throws<ArgumentException>(() => g.MeasureCharacterRanges("Mono", _font, default, null));
Assert.Throws<ArgumentException>(() => g.MeasureCharacterRanges("Mono".AsSpan(), _font, default, null));
}
private static readonly CharacterRange[] s_ranges = [new(0, 1), new(1, 1), new(2, 1)];
@ -2177,7 +2177,7 @@ public class GraphicsTest : IDisposable
{
using Bitmap b = new(10, 10);
using Graphics g = Graphics.FromImage(b);
Assert.Throws<ArgumentException>(() => g.ReleaseHdc());
Assert.Throws<ArgumentException>(g.ReleaseHdc);
}
[Fact]
@ -2187,7 +2187,7 @@ public class GraphicsTest : IDisposable
using Graphics g = Graphics.FromImage(b);
g.GetHdc();
g.ReleaseHdc();
Assert.Throws<ArgumentException>(() => g.ReleaseHdc());
Assert.Throws<ArgumentException>(g.ReleaseHdc);
}
[ConditionalFact]
@ -2535,7 +2535,7 @@ public class GraphicsTest : IDisposable
{
using Bitmap bmp = new(40, 40);
using Graphics g = Graphics.FromImage(bmp);
g.DrawImage(bmp, [ new(0, 0), new(1, 1), new(2, 2)]);
g.DrawImage(bmp, [new(0, 0), new(1, 1), new(2, 2)]);
}
[Fact]
@ -2591,7 +2591,7 @@ public class GraphicsTest : IDisposable
{
using Bitmap bmp = new(40, 40);
using Graphics g = Graphics.FromImage(bmp);
Assert.Throws<ArgumentNullException>(() => g.DrawImage(null, new Rectangle(), new Rectangle(), GraphicsUnit.Display));
Assert.Throws<ArgumentNullException>(() => g.DrawImage(null, default(Rectangle), default, GraphicsUnit.Display));
}
private void DrawImage_ImageRectangleRectangleGraphicsUnit(GraphicsUnit unit)

Просмотреть файл

@ -1,6 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// Metafile class unit tests
//
// Authors:
@ -218,7 +218,7 @@ public class MetafileFulltrustTest
IntPtr hdc = g.GetHdc();
try
{
Metafile mf = new(hdc, new Rectangle());
Metafile mf = new(hdc, default(Rectangle));
CheckEmptyHeader(mf, EmfType.EmfPlusDual);
}
finally
@ -235,7 +235,7 @@ public class MetafileFulltrustTest
IntPtr hdc = g.GetHdc();
try
{
Metafile mf = new(hdc, new RectangleF());
Metafile mf = new(hdc, default(RectangleF));
CheckEmptyHeader(mf, EmfType.EmfPlusDual);
}
finally

Просмотреть файл

@ -178,8 +178,8 @@ public class BinaryFormatWriterTests
public static TheoryData<object> SystemDrawing_TestData => new()
{
new PointF(),
new RectangleF()
default(PointF),
default(RectangleF)
};
public static TheoryData<object> DrawingPrimitives_TestData => new()
@ -225,7 +225,7 @@ public class BinaryFormatWriterTests
public static TheoryData<Array> Array_UnsupportedTestData => new()
{
new Point[] { new() },
new Point[] { default },
new object[] { new() },
};
}

Просмотреть файл

@ -233,11 +233,11 @@ public class HashtableTests : SerializationTest
},
new Hashtable()
{
{ "Foo", new Point() }
{ "Foo", default(Point) }
},
new Hashtable()
{
{ "Foo", new PointF() }
{ "Foo", default(PointF) }
},
new Hashtable()
{

Просмотреть файл

@ -47,7 +47,7 @@ public class ListTests : SerializationTest
new ArrayList()
{
int.MaxValue,
new Point()
default(Point)
}
};

Просмотреть файл

@ -17,6 +17,6 @@ public class StoringNull
bool success = nullFastValue.TryGetValue(out int result);
Assert.False(success);
Assert.Equal(default(int), result);
Assert.Equal(default, result);
}
}

Просмотреть файл

@ -33,27 +33,27 @@ public partial class ProjectFileReaderTests
{
CultureInfo culture = new(cultureName);
testData.Add(culture, $"Courier New", "Courier New", PropertyDefaultValue.FontSize, (int)GraphicsUnit.Point,(int)FontStyle.Regular);
testData.Add(culture, $"Courier New{s_separator} 11", "Courier New", 11f, (int)GraphicsUnit.Point,(int)FontStyle.Regular);
testData.Add(culture, $"Arial{s_separator} 11px", "Arial", 11f, (int)GraphicsUnit.Pixel,(int)FontStyle.Regular);
testData.Add(culture, $"Courier New{s_separator} 11 px", "Courier New", 11f, (int)GraphicsUnit.Pixel,(int)FontStyle.Regular);
testData.Add(culture, $"Courier New{s_separator} 11 px{s_separator} style=Regular", "Courier New", 11f, (int)GraphicsUnit.Pixel,(int)FontStyle.Regular);
testData.Add(culture, $"Courier New{s_separator} style=Bold", "Courier New", PropertyDefaultValue.FontSize, (int)GraphicsUnit.Point,(int)FontStyle.Bold);
testData.Add(culture, $"Courier New{s_separator} 11 px{s_separator} style=Bold{s_separator} Italic", "Courier New", 11f, (int)GraphicsUnit.Pixel, (int)(FontStyle.Bold |FontStyle.Italic));
testData.Add(culture, $"Courier New{s_separator} 11 px{s_separator} style=Regular, Italic", "Courier New", 11f, (int)GraphicsUnit.Pixel, (int)(FontStyle.Regular |FontStyle.Italic));
testData.Add(culture, $"Courier New{s_separator} 11 px{s_separator} style=Bold{s_separator} Italic{s_separator} Strikeout", "Courier New", 11f, (int)GraphicsUnit.Pixel, (int)(FontStyle.Bold |FontStyle.Italic |FontStyle.Strikeout));
testData.Add(culture, $"Arial{s_separator} 11 px{s_separator} style=Bold, Italic, Strikeout", "Arial", 11f, (int)GraphicsUnit.Pixel, (int)(FontStyle.Bold |FontStyle.Italic |FontStyle.Strikeout));
testData.Add(culture, $"arIAL{s_separator} 10{s_separator} style=bold", "arIAL", 10f, (int)GraphicsUnit.Point,(int)FontStyle.Bold);
testData.Add(culture, $"Arial{s_separator} 10{s_separator}", "Arial", 10f, (int)GraphicsUnit.Point,(int)FontStyle.Regular);
testData.Add(culture, $"Arial{s_separator}", "Arial", PropertyDefaultValue.FontSize, (int)GraphicsUnit.Point,(int)FontStyle.Regular);
testData.Add(culture, $"Arial{s_separator} 10{s_separator} style=12", "Arial", 10f, (int)GraphicsUnit.Point, (int)(FontStyle.Underline |FontStyle.Strikeout));
testData.Add(culture, $"Courier New{s_separator} Style=Bold", "Courier New", PropertyDefaultValue.FontSize, (int)GraphicsUnit.Point,(int)FontStyle.Bold); // FullFramework style keyword is case sensitive.
testData.Add(culture, $"{s_separator} 10{s_separator} style=bold", "", 10f, (int)GraphicsUnit.Point,(int)FontStyle.Bold);
testData.Add(culture, $"Courier New", "Courier New", PropertyDefaultValue.FontSize, (int)GraphicsUnit.Point, (int)FontStyle.Regular);
testData.Add(culture, $"Courier New{s_separator} 11", "Courier New", 11f, (int)GraphicsUnit.Point, (int)FontStyle.Regular);
testData.Add(culture, $"Arial{s_separator} 11px", "Arial", 11f, (int)GraphicsUnit.Pixel, (int)FontStyle.Regular);
testData.Add(culture, $"Courier New{s_separator} 11 px", "Courier New", 11f, (int)GraphicsUnit.Pixel, (int)FontStyle.Regular);
testData.Add(culture, $"Courier New{s_separator} 11 px{s_separator} style=Regular", "Courier New", 11f, (int)GraphicsUnit.Pixel, (int)FontStyle.Regular);
testData.Add(culture, $"Courier New{s_separator} style=Bold", "Courier New", PropertyDefaultValue.FontSize, (int)GraphicsUnit.Point, (int)FontStyle.Bold);
testData.Add(culture, $"Courier New{s_separator} 11 px{s_separator} style=Bold{s_separator} Italic", "Courier New", 11f, (int)GraphicsUnit.Pixel, (int)(FontStyle.Bold | FontStyle.Italic));
testData.Add(culture, $"Courier New{s_separator} 11 px{s_separator} style=Regular, Italic", "Courier New", 11f, (int)GraphicsUnit.Pixel, (int)(FontStyle.Regular | FontStyle.Italic));
testData.Add(culture, $"Courier New{s_separator} 11 px{s_separator} style=Bold{s_separator} Italic{s_separator} Strikeout", "Courier New", 11f, (int)GraphicsUnit.Pixel, (int)(FontStyle.Bold | FontStyle.Italic | FontStyle.Strikeout));
testData.Add(culture, $"Arial{s_separator} 11 px{s_separator} style=Bold, Italic, Strikeout", "Arial", 11f, (int)GraphicsUnit.Pixel, (int)(FontStyle.Bold | FontStyle.Italic | FontStyle.Strikeout));
testData.Add(culture, $"arIAL{s_separator} 10{s_separator} style=bold", "arIAL", 10f, (int)GraphicsUnit.Point, (int)FontStyle.Bold);
testData.Add(culture, $"Arial{s_separator} 10{s_separator}", "Arial", 10f, (int)GraphicsUnit.Point, (int)FontStyle.Regular);
testData.Add(culture, $"Arial{s_separator}", "Arial", PropertyDefaultValue.FontSize, (int)GraphicsUnit.Point, (int)FontStyle.Regular);
testData.Add(culture, $"Arial{s_separator} 10{s_separator} style=12", "Arial", 10f, (int)GraphicsUnit.Point, (int)(FontStyle.Underline | FontStyle.Strikeout));
testData.Add(culture, $"Courier New{s_separator} Style=Bold", "Courier New", PropertyDefaultValue.FontSize, (int)GraphicsUnit.Point, (int)FontStyle.Bold); // FullFramework style keyword is case sensitive.
testData.Add(culture, $"{s_separator} 10{s_separator} style=bold", "", 10f, (int)GraphicsUnit.Point, (int)FontStyle.Bold);
// NOTE: in .NET runtime these tests will result in FontName='', but the implementation relies on GDI+, which we don't have...
testData.Add(culture, $"11px{s_separator} Style=Bold", $"11px", PropertyDefaultValue.FontSize, (int)GraphicsUnit.Point,(int)FontStyle.Bold);
testData.Add(culture, $"11px", "11px", PropertyDefaultValue.FontSize, (int)GraphicsUnit.Point,(int)FontStyle.Regular);
testData.Add(culture, $"Style=Bold", "Style=Bold", PropertyDefaultValue.FontSize, (int)GraphicsUnit.Point,(int)FontStyle.Regular);
testData.Add(culture, $"11px{s_separator} Style=Bold", $"11px", PropertyDefaultValue.FontSize, (int)GraphicsUnit.Point, (int)FontStyle.Bold);
testData.Add(culture, $"11px", "11px", PropertyDefaultValue.FontSize, (int)GraphicsUnit.Point, (int)FontStyle.Regular);
testData.Add(culture, $"Style=Bold", "Style=Bold", PropertyDefaultValue.FontSize, (int)GraphicsUnit.Point, (int)FontStyle.Regular);
}
return testData;

Просмотреть файл

@ -32,4 +32,3 @@ public sealed class TestAdditionalText : AdditionalText
public override SourceText GetText(CancellationToken cancellationToken = default) => _text;
}

Просмотреть файл

@ -38,10 +38,10 @@ internal partial class ResourceCodeDomSerializer : CodeDomSerializer
{
name = methodInvokeEx.Parameters switch
{
// We've found a call to the ApplyResources method on a ComponentResourceManager object. now we just need to figure out
// which component ApplyResources is being called for, and put it into that component's bucket.
[CodeFieldReferenceExpression { TargetObject: CodeThisReferenceExpression } fieldReferenceEx, ..] => fieldReferenceEx.FieldName,
[CodeVariableReferenceExpression variableReferenceEx, ..] => variableReferenceEx.VariableName,
// We've found a call to the ApplyResources method on a ComponentResourceManager object. now we just need to figure out
// which component ApplyResources is being called for, and put it into that component's bucket.
[CodeFieldReferenceExpression { TargetObject: CodeThisReferenceExpression } fieldReferenceEx, ..] => fieldReferenceEx.FieldName,
[CodeVariableReferenceExpression variableReferenceEx, ..] => variableReferenceEx.VariableName,
_ => null
};
}

Просмотреть файл

@ -210,7 +210,7 @@ public sealed partial class AnchorEditor
public SpringControl(AnchorUI picker)
{
_picker = picker ?? throw new ArgumentException();
_picker = picker ?? throw new ArgumentNullException(nameof(picker));
TabStop = true;
}

Просмотреть файл

@ -11,10 +11,10 @@ internal sealed partial class ToolboxSnapDragDropEventArgs
[Flags]
public enum SnapDirection
{
None = 0x00,
Top = 0x01,
Bottom = 0x02,
Right = 0x04,
Left = 0x08
None = 0x00,
Top = 0x01,
Bottom = 0x02,
Right = 0x04,
Left = 0x08
}
}

Просмотреть файл

@ -1433,15 +1433,10 @@ public partial class DocumentDesigner : ScrollableControlDesigner, IRootDesigner
/// The view for this document. The designer should assume that the view will be shown shortly
/// after this call is made and make any necessary preparations.
/// </summary>
object IRootDesigner.GetView(ViewTechnology technology)
{
if (technology is not ViewTechnology.Default and not ((ViewTechnology)1))
{
throw new ArgumentException();
}
return _frame;
}
object IRootDesigner.GetView(ViewTechnology technology) =>
technology is not ViewTechnology.Default and not (ViewTechnology)1
? throw new ArgumentException(null, nameof(technology))
: (object)_frame;
/// <summary>
/// Determines if the given tool is supported by this designer.

Просмотреть файл

@ -8,12 +8,12 @@ public partial class FolderNameEditor
[Flags]
protected enum FolderBrowserStyles
{
BrowseForComputer = (int)PInvoke.BIF_BROWSEFORCOMPUTER,
BrowseForEverything = (int)PInvoke.BIF_BROWSEINCLUDEFILES,
BrowseForPrinter = (int)PInvoke.BIF_BROWSEFORPRINTER,
RestrictToDomain = (int)PInvoke.BIF_DONTGOBELOWDOMAIN,
RestrictToFilesystem = (int)PInvoke.BIF_RETURNONLYFSDIRS,
RestrictToSubfolders = (int)PInvoke.BIF_RETURNFSANCESTORS,
ShowTextBox = (int)PInvoke.BIF_EDITBOX
BrowseForComputer = (int)PInvoke.BIF_BROWSEFORCOMPUTER,
BrowseForEverything = (int)PInvoke.BIF_BROWSEINCLUDEFILES,
BrowseForPrinter = (int)PInvoke.BIF_BROWSEFORPRINTER,
RestrictToDomain = (int)PInvoke.BIF_DONTGOBELOWDOMAIN,
RestrictToFilesystem = (int)PInvoke.BIF_RETURNONLYFSDIRS,
RestrictToSubfolders = (int)PInvoke.BIF_RETURNFSANCESTORS,
ShowTextBox = (int)PInvoke.BIF_EDITBOX
}
}

Просмотреть файл

@ -69,7 +69,7 @@ internal partial class ImageListDesigner
object? IList.this[int index]
{
get => this[index];
set => this[index] = value is ImageListImage image ? image : throw new ArgumentException();
set => this[index] = value is ImageListImage image ? image : throw new ArgumentException(null, nameof(index));
}
public void SetKeyName(int index, string name)
@ -110,7 +110,7 @@ internal partial class ImageListDesigner
}
}
int IList.Add(object? value) => value is ImageListImage image ? Add(image) : throw new ArgumentException();
int IList.Add(object? value) => value is ImageListImage image ? Add(image) : throw new ArgumentException(null, nameof(value));
// Called when reloading the form. In this case, we have no "originals" list,
// so we make one out of the image list.

Просмотреть файл

@ -67,7 +67,7 @@ public static class CodeDomHelpers
return $"new CodeObjectCreateExpression({GetType(coce.CreateType)})";
}
string parameters = string.Join(", ", coce.Parameters.Cast<CodeObject>().Select(o => GetConstructionString(o)));
string parameters = string.Join(", ", coce.Parameters.Cast<CodeObject>().Select(GetConstructionString));
return $"new CodeObjectCreateExpression({GetType(coce.CreateType)}, {parameters})";
}

Просмотреть файл

@ -19,7 +19,7 @@ public class ControlDesignerTests
Assert.True(controlDesigner.ControlSupportsSnaplines);
Assert.Throws<InvalidOperationException>(() => controlDesigner.Component);
Assert.True(controlDesigner.ForceVisible);
Assert.Throws<InvalidOperationException>(() => controlDesigner.GetParentComponentProperty());
Assert.Throws<InvalidOperationException>(controlDesigner.GetParentComponentProperty);
Assert.False(controlDesigner.SerializePerformLayout);
}
@ -164,7 +164,7 @@ public class ControlDesignerTests
using TestControlDesigner controlDesigner = new();
using Button button = new();
controlDesigner.Initialize(button);
Assert.False(controlDesigner.GetHitTestMethod(new Drawing.Point()));
Assert.False(controlDesigner.GetHitTestMethod(default));
}
[Fact]
@ -273,6 +273,6 @@ public class ControlDesignerTests
childControl.Site = mockSite.Object;
control.Controls.Add(childControl);
Assert.Equal(1, controlDesigner.AssociatedComponents.Count);
Assert.Single(controlDesigner.AssociatedComponents);
}
}

Просмотреть файл

@ -1,7 +1,5 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics.CodeAnalysis;

Просмотреть файл

@ -1,4 +1,7 @@
using System.ComponentModel.Design;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.ComponentModel.Design;
using System.ComponentModel;
using Moq;

Просмотреть файл

@ -24,7 +24,7 @@ public class SplitContainerDesignerTests
.Setup(s => s.GetService(typeof(IComponentChangeService)))
.Returns(mockComponentChangeService.Object);
return MockSite.CreateMockSiteWithDesignerHost(mockDesignerHost.Object);
return MockSite.CreateMockSiteWithDesignerHost(mockDesignerHost.Object);
}
[WinFormsFact]
@ -43,7 +43,7 @@ public class SplitContainerDesignerTests
using Control control = new();
control.Parent = splitContainer.Panel1;
Assert.Equal(1, splitContainerDesigner.AssociatedComponents.Count);
Assert.Single(splitContainerDesigner.AssociatedComponents);
}
// Regression test for https://github.com/dotnet/winforms/issues/11793

Просмотреть файл

@ -246,6 +246,7 @@ public class ArrayEditorTests
}
#pragma warning disable IDE0051 // Remove unused private members
#pragma warning disable CA1052 // Static holder types should be Static or NotInheritable
private class ClassWithPrivateItem
{
private int Item { get; set; }
@ -317,5 +318,5 @@ public class ArrayEditorTests
}
#pragma warning restore IDE0051
#pragma warning restore CA1052
}

Просмотреть файл

@ -110,7 +110,7 @@ public class CollectionEditorTests
public void CollectionEditor_CreateCollectionForm_NullCollectionType_ThrowsArgumentNullException()
{
SubCollectionEditor editor = new(null);
Assert.Throws<ArgumentNullException>("type", () => editor.CreateCollectionForm());
Assert.Throws<ArgumentNullException>("type", editor.CreateCollectionForm);
}
[Theory]
@ -135,7 +135,7 @@ public class CollectionEditorTests
public void CollectionEditor_CreateCollectionItemType_NullType_ThrowsArgumentNullException()
{
SubCollectionEditor editor = new(null);
Assert.Throws<ArgumentNullException>("type", () => editor.CreateCollectionItemType());
Assert.Throws<ArgumentNullException>("type", editor.CreateCollectionItemType);
}
public static IEnumerable<object[]> InvalidDesignerHost_TestData()
@ -383,7 +383,7 @@ public class CollectionEditorTests
public void CollectionEditor_CreateNewItemTypes_NullType_ThrowsArgumentNullException()
{
SubCollectionEditor editor = new(null);
Assert.Throws<ArgumentNullException>("type", () => editor.CreateNewItemTypes());
Assert.Throws<ArgumentNullException>("type", editor.CreateNewItemTypes);
}
public static IEnumerable<object[]> DestroyInstance_NormalObject_TestData()
@ -1072,7 +1072,9 @@ public class CollectionEditorTests
#pragma warning restore IDE0051
}
#pragma warning disable CA1052 // Static holder types should be Static or NotInheritable
private class ClassWithStaticItem
#pragma warning restore CA1052 // Static holder types should be Static or NotInheritable
{
public static int Item { get; set; }
}
@ -1089,7 +1091,9 @@ public class CollectionEditorTests
#pragma warning restore IDE0051
}
#pragma warning disable CA1052 // Static holder types should be Static or NotInheritable
private class ClassWithStaticItems
#pragma warning restore CA1052 // Static holder types should be Static or NotInheritable
{
public static int Items { get; set; }
}

Просмотреть файл

@ -1262,7 +1262,7 @@ public class ComponentDesignerTests
designer.Initialize(rootComponent);
component.StringPropertySetCount = 0;
Assert.Throws(exception.GetType(), () => designer.DoDefaultAction());
Assert.Throws(exception.GetType(), designer.DoDefaultAction);
mockSite.Verify(s => s.GetService(typeof(IEventBindingService)), Times.Once());
mockSite.Verify(s => s.GetService(typeof(ISelectionService)), Times.Once());
mockSite.Verify(s => s.GetService(typeof(IDesignerHost)), Times.Exactly(2));
@ -1273,7 +1273,7 @@ public class ComponentDesignerTests
Assert.Equal(0, component.StringPropertySetCount);
// Call again.
Assert.Throws(exception.GetType(), () => designer.DoDefaultAction());
Assert.Throws(exception.GetType(), designer.DoDefaultAction);
mockSite.Verify(s => s.GetService(typeof(IEventBindingService)), Times.Exactly(2));
mockSite.Verify(s => s.GetService(typeof(ISelectionService)), Times.Exactly(2));
mockSite.Verify(s => s.GetService(typeof(IDesignerHost)), Times.Exactly(3));
@ -1554,7 +1554,7 @@ public class ComponentDesignerTests
designer.Initialize(rootComponent);
component.StringPropertySetCount = 0;
Assert.Throws(exception.GetType(), () => designer.DoDefaultAction());
Assert.Throws(exception.GetType(), designer.DoDefaultAction);
mockSite.Verify(s => s.GetService(typeof(IEventBindingService)), Times.Once());
mockSite.Verify(s => s.GetService(typeof(ISelectionService)), Times.Once());
mockSite.Verify(s => s.GetService(typeof(IDesignerHost)), Times.Exactly(2));
@ -1567,7 +1567,7 @@ public class ComponentDesignerTests
Assert.Equal(0, component.StringPropertySetCount);
// Call again.
Assert.Throws(exception.GetType(), () => designer.DoDefaultAction());
Assert.Throws(exception.GetType(), designer.DoDefaultAction);
mockSite.Verify(s => s.GetService(typeof(IEventBindingService)), Times.Exactly(2));
mockSite.Verify(s => s.GetService(typeof(ISelectionService)), Times.Exactly(2));
mockSite.Verify(s => s.GetService(typeof(IDesignerHost)), Times.Exactly(3));

Просмотреть файл

@ -1190,7 +1190,7 @@ public class DesignSurfaceTests
mockLoader
.Setup(l => l.BeginLoad(host));
surface.BeginLoad(mockLoader.Object);
Assert.Throws<InvalidOperationException>(() => surface.Dispose());
Assert.Throws<InvalidOperationException>(surface.Dispose);
Assert.True(host.Loading);
// Should not throw again.
@ -1211,7 +1211,7 @@ public class DesignSurfaceTests
Assert.True(host.Loading);
Assert.True(host.InTransaction);
Assert.Equal("Transaction1", host.TransactionDescription);
Assert.Throws<InvalidOperationException>(() => surface.Dispose());
Assert.Throws<InvalidOperationException>(surface.Dispose);
Assert.True(host.Loading);
Assert.True(host.InTransaction);
Assert.Equal("Transaction1", host.TransactionDescription);

Просмотреть файл

@ -205,7 +205,7 @@ public class DesignerActionMethodItemTests
public void Invoke_NullActionList_ThrowsInvalidOperationException()
{
DesignerActionMethodItem item = new(null, "memberName", "displayName", "category", "description");
Assert.Throws<InvalidOperationException>(() => item.Invoke());
Assert.Throws<InvalidOperationException>(item.Invoke);
}
[Theory]
@ -216,7 +216,7 @@ public class DesignerActionMethodItemTests
{
SubDesignerActionList list = new();
DesignerActionMethodItem item = new(list, memberName, "displayName", "category", "description");
Assert.Throws<InvalidOperationException>(() => item.Invoke());
Assert.Throws<InvalidOperationException>(item.Invoke);
}
[Fact]
@ -224,7 +224,7 @@ public class DesignerActionMethodItemTests
{
SubDesignerActionList list = new();
DesignerActionMethodItem item = new(list, null, "displayName", "category", "description");
Assert.Throws<ArgumentNullException>("name", () => item.Invoke());
Assert.Throws<ArgumentNullException>("name", item.Invoke);
}
[Fact]
@ -232,7 +232,7 @@ public class DesignerActionMethodItemTests
{
SubDesignerActionList list = new();
DesignerActionMethodItem item = new(list, nameof(SubDesignerActionList.MethodWithParameters), "displayName", "category", "description");
Assert.Throws<TargetParameterCountException>(() => item.Invoke());
Assert.Throws<TargetParameterCountException>(item.Invoke);
}
private class SubDesignerActionList : DesignerActionList

Просмотреть файл

@ -1797,7 +1797,7 @@ public class DesignerHostTests
SubDesignSurface surface = new();
IDesignerLoaderHost2 host = surface.Host;
IDisposable disposable = Assert.IsAssignableFrom<IDisposable>(host);
Assert.Throws<InvalidOperationException>(() => disposable.Dispose());
Assert.Throws<InvalidOperationException>(disposable.Dispose);
}
[WinFormsFact(Skip = "Unstable test, see: https://github.com/dotnet/winforms/issues/1460")]
@ -1809,7 +1809,7 @@ public class DesignerHostTests
using ThrowingDesignerDisposeComponent component = new();
host.Container.Add(component);
Assert.Throws<InvalidOperationException>(() => surface.Dispose());
Assert.Throws<InvalidOperationException>(surface.Dispose);
Assert.False(surface.IsLoaded);
Assert.Empty(surface.LoadErrors);
Assert.False(host.Loading);
@ -1824,7 +1824,7 @@ public class DesignerHostTests
using ThrowingDisposeDesignerComponent component = new();
host.Container.Add(component);
Assert.Throws<InvalidOperationException>(() => surface.Dispose());
Assert.Throws<InvalidOperationException>(surface.Dispose);
Assert.False(surface.IsLoaded);
Assert.Empty(surface.LoadErrors);
Assert.False(host.Loading);
@ -1837,7 +1837,7 @@ public class DesignerHostTests
IDesignerLoaderHost2 host = surface.Host;
surface.BeginLoad(typeof(ThrowingRootDesignerDisposeComponent));
Assert.Throws<InvalidOperationException>(() => surface.Dispose());
Assert.Throws<InvalidOperationException>(surface.Dispose);
Assert.False(surface.IsLoaded);
Assert.Empty(surface.LoadErrors);
Assert.False(host.Loading);
@ -1849,7 +1849,7 @@ public class DesignerHostTests
SubDesignSurface surface = new();
IDesignerLoaderHost2 host = surface.Host;
surface.BeginLoad(typeof(ThrowingDisposeRootDesignerComponent));
Assert.Throws<InvalidOperationException>(() => surface.Dispose());
Assert.Throws<InvalidOperationException>(surface.Dispose);
Assert.False(surface.IsLoaded);
Assert.Empty(surface.LoadErrors);
Assert.False(host.Loading);
@ -2066,7 +2066,7 @@ public class DesignerHostTests
IDesignerLoaderHost2 host = surface.Host;
DesignerTransaction transaction1 = host.CreateTransaction("Description1");
DesignerTransaction transaction2 = host.CreateTransaction("Description2");
Assert.Throws<InvalidOperationException>(() => transaction1.Cancel());
Assert.Throws<InvalidOperationException>(transaction1.Cancel);
}
[WinFormsFact]
@ -2179,7 +2179,7 @@ public class DesignerHostTests
IDesignerLoaderHost2 host = surface.Host;
DesignerTransaction transaction1 = host.CreateTransaction("Description1");
DesignerTransaction transaction2 = host.CreateTransaction("Description2");
Assert.Throws<InvalidOperationException>(() => transaction1.Commit());
Assert.Throws<InvalidOperationException>(transaction1.Commit);
}
public static IEnumerable<object[]> DesignerHost_EndLoad_TestData()

Просмотреть файл

@ -13,7 +13,7 @@ public class ExceptionCollectionTests
{
yield return new object[] { null };
yield return new object[] { new ArrayList() };
yield return new object[] { new ArrayList { new InvalidOperationException(), new InvalidOperationException(), new InvalidOperationException()} };
yield return new object[] { new ArrayList { new InvalidOperationException(), new InvalidOperationException(), new InvalidOperationException() } };
}
[Theory]
@ -63,6 +63,6 @@ public class ExceptionCollectionTests
public void ExceptionCollection_GetObjectData_ThrowsPlatformNotSupportedException()
{
ExceptionCollection collection = new(new ArrayList());
Assert.Throws<PlatformNotSupportedException>(() => collection.GetObjectData(null, new StreamingContext()));
Assert.Throws<PlatformNotSupportedException>(() => collection.GetObjectData(null, default));
}
}

Просмотреть файл

@ -133,7 +133,7 @@ public class CodeDomComponentSerializationServiceTests
Assert.Empty(store.Errors);
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
Dictionary<string, CodeDomComponentSerializationState> state = GetState(info);
Assert.Equal(2, state.Count);
@ -236,7 +236,7 @@ public class CodeDomComponentSerializationServiceTests
mockServiceProvider.Verify(p => p.GetService(typeof(MemberRelationshipService)), Times.Exactly(3));
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
Dictionary<string, CodeDomComponentSerializationState> state = GetState(info);
CodeDomComponentSerializationState valueState = state["name"];
@ -338,7 +338,7 @@ public class CodeDomComponentSerializationServiceTests
mockServiceProvider.Verify(p => p.GetService(typeof(DesignerOptionService)), Times.Once());
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
Dictionary<string, CodeDomComponentSerializationState> state = GetState(info);
CodeDomComponentSerializationState valueState = state["name"];
@ -383,7 +383,7 @@ public class CodeDomComponentSerializationServiceTests
Assert.Empty(store.Errors);
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
Dictionary<string, CodeDomComponentSerializationState> state = GetState(info);
CodeDomComponentSerializationState valueState = state["name"];
@ -434,7 +434,7 @@ public class CodeDomComponentSerializationServiceTests
Assert.Empty(store.Errors);
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
Dictionary<string, CodeDomComponentSerializationState> state = GetState(info);
CodeDomComponentSerializationState valueState = state["name"];
@ -480,7 +480,7 @@ public class CodeDomComponentSerializationServiceTests
Assert.Empty(store.Errors);
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
Dictionary<string, CodeDomComponentSerializationState> state = GetState(info);
CodeDomComponentSerializationState valueState = state["name"];
@ -524,7 +524,7 @@ public class CodeDomComponentSerializationServiceTests
Assert.Empty(store.Errors);
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
Dictionary<string, CodeDomComponentSerializationState> state = GetState(info);
CodeDomComponentSerializationState valueState = state["name"];
@ -573,7 +573,7 @@ public class CodeDomComponentSerializationServiceTests
Assert.Empty(store.Errors);
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
Dictionary<string, CodeDomComponentSerializationState> state = GetState(info);
CodeDomComponentSerializationState valueState = state["name"];
@ -620,7 +620,7 @@ public class CodeDomComponentSerializationServiceTests
Site = mockSite.Object
};
service.Serialize(store, value);
Assert.Throws<DivideByZeroException>(() => store.Close());
Assert.Throws<DivideByZeroException>(store.Close);
Assert.Empty(store.Errors);
}
@ -643,7 +643,7 @@ public class CodeDomComponentSerializationServiceTests
SerializationStore store = service.CreateStore();
ISerializable serializable = Assert.IsAssignableFrom<ISerializable>(store);
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
Assert.Empty(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>))));
@ -662,7 +662,7 @@ public class CodeDomComponentSerializationServiceTests
service.Serialize(store, value);
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
Assert.NotEmpty(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>))));
Assert.Null(info.GetValue("Assemblies", typeof(AssemblyName[])));
@ -676,7 +676,7 @@ public class CodeDomComponentSerializationServiceTests
CodeDomComponentSerializationService service = new();
SerializationStore store = service.CreateStore();
ISerializable serializable = Assert.IsAssignableFrom<ISerializable>(store);
Assert.Throws<ArgumentNullException>("info", () => serializable.GetObjectData(null, new StreamingContext()));
Assert.Throws<ArgumentNullException>("info", () => serializable.GetObjectData(null, default));
}
[Theory]
@ -715,7 +715,7 @@ public class CodeDomComponentSerializationServiceTests
object value = new();
service.Serialize(store, value);
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
string nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches("^object_........_...._...._...._............$", nameResult);
@ -726,7 +726,7 @@ public class CodeDomComponentSerializationServiceTests
// Serialize again.
service.Serialize(store, value);
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches("^object_........_...._...._...._............$", nameResult);
@ -752,7 +752,7 @@ public class CodeDomComponentSerializationServiceTests
mockComponent.Verify(c => c.Site, Times.Once());
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
string nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches("^object_........_...._...._...._............$", nameResult);
@ -765,7 +765,7 @@ public class CodeDomComponentSerializationServiceTests
mockComponent.Verify(c => c.Site, Times.Once());
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches("^object_........_...._...._...._............$", nameResult);
@ -800,7 +800,7 @@ public class CodeDomComponentSerializationServiceTests
mockSite.Verify(s => s.Name, Times.Exactly(expectedCallCount));
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
string nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches(expectedPattern, nameResult);
@ -814,7 +814,7 @@ public class CodeDomComponentSerializationServiceTests
mockSite.Verify(s => s.Name, Times.Exactly(expectedCallCount));
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches(expectedPattern, nameResult);
@ -860,7 +860,7 @@ public class CodeDomComponentSerializationServiceTests
mockNestedSite.Verify(s => s.FullName, Times.Exactly(expectedFullNameCallCount));
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
string nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches(expectedPattern, nameResult);
Assert.Null(info.GetValue("Assemblies", typeof(AssemblyName[])));
@ -873,7 +873,7 @@ public class CodeDomComponentSerializationServiceTests
mockNestedSite.Verify(s => s.FullName, Times.Exactly(expectedFullNameCallCount));
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches(expectedPattern, nameResult);
Assert.Null(info.GetValue("Assemblies", typeof(AssemblyName[])));
@ -923,7 +923,7 @@ public class CodeDomComponentSerializationServiceTests
object value = new();
service.SerializeAbsolute(store, value);
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
string nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches("^object_........_...._...._...._............$", nameResult);
@ -934,7 +934,7 @@ public class CodeDomComponentSerializationServiceTests
// Serialize again.
service.SerializeAbsolute(store, value);
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches("^object_........_...._...._...._............$", nameResult);
@ -960,7 +960,7 @@ public class CodeDomComponentSerializationServiceTests
mockComponent.Verify(c => c.Site, Times.Once());
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
string nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches("^object_........_...._...._...._............$", nameResult);
@ -973,7 +973,7 @@ public class CodeDomComponentSerializationServiceTests
mockComponent.Verify(c => c.Site, Times.Once());
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches("^object_........_...._...._...._............$", nameResult);
@ -1008,7 +1008,7 @@ public class CodeDomComponentSerializationServiceTests
mockSite.Verify(s => s.Name, Times.Exactly(expectedCallCount));
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
string nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches(expectedPattern, nameResult);
@ -1022,7 +1022,7 @@ public class CodeDomComponentSerializationServiceTests
mockSite.Verify(s => s.Name, Times.Exactly(expectedCallCount));
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches(expectedPattern, nameResult);
@ -1068,7 +1068,7 @@ public class CodeDomComponentSerializationServiceTests
mockNestedSite.Verify(s => s.FullName, Times.Exactly(expectedFullNameCallCount));
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
string nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches(expectedPattern, nameResult);
Assert.Null(info.GetValue("Assemblies", typeof(AssemblyName[])));
@ -1081,7 +1081,7 @@ public class CodeDomComponentSerializationServiceTests
mockNestedSite.Verify(s => s.FullName, Times.Exactly(expectedFullNameCallCount));
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches(expectedPattern, nameResult);
Assert.Null(info.GetValue("Assemblies", typeof(AssemblyName[])));
@ -1133,7 +1133,7 @@ public class CodeDomComponentSerializationServiceTests
object value = new();
service.SerializeMember(store, value, member1);
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
string nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches("^object_........_...._...._...._............$", nameResult);
@ -1144,7 +1144,7 @@ public class CodeDomComponentSerializationServiceTests
// Serialize again.
service.SerializeMember(store, value, member1);
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches("^object_........_...._...._...._............$", nameResult);
@ -1155,7 +1155,7 @@ public class CodeDomComponentSerializationServiceTests
// Serialize another.
service.SerializeMember(store, value, member2);
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches("^object_........_...._...._...._............$", nameResult);
@ -1183,7 +1183,7 @@ public class CodeDomComponentSerializationServiceTests
mockComponent.Verify(c => c.Site, Times.Once());
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
string nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches("^object_........_...._...._...._............$", nameResult);
@ -1196,7 +1196,7 @@ public class CodeDomComponentSerializationServiceTests
mockComponent.Verify(c => c.Site, Times.Once());
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches("^object_........_...._...._...._............$", nameResult);
@ -1209,7 +1209,7 @@ public class CodeDomComponentSerializationServiceTests
mockComponent.Verify(c => c.Site, Times.Once());
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches("^object_........_...._...._...._............$", nameResult);
@ -1246,7 +1246,7 @@ public class CodeDomComponentSerializationServiceTests
mockSite.Verify(s => s.Name, Times.Exactly(expectedCallCount));
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
string nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches(expectedPattern, nameResult);
@ -1260,7 +1260,7 @@ public class CodeDomComponentSerializationServiceTests
mockSite.Verify(s => s.Name, Times.Exactly(expectedCallCount));
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches(expectedPattern, nameResult);
@ -1274,7 +1274,7 @@ public class CodeDomComponentSerializationServiceTests
mockSite.Verify(s => s.Name, Times.Exactly(expectedCallCount));
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches(expectedPattern, nameResult);
@ -1322,7 +1322,7 @@ public class CodeDomComponentSerializationServiceTests
mockNestedSite.Verify(s => s.FullName, Times.Exactly(expectedFullNameCallCount));
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
string nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches(expectedPattern, nameResult);
Assert.Null(info.GetValue("Assemblies", typeof(AssemblyName[])));
@ -1335,7 +1335,7 @@ public class CodeDomComponentSerializationServiceTests
mockNestedSite.Verify(s => s.FullName, Times.Exactly(expectedFullNameCallCount));
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches(expectedPattern, nameResult);
Assert.Null(info.GetValue("Assemblies", typeof(AssemblyName[])));
@ -1348,7 +1348,7 @@ public class CodeDomComponentSerializationServiceTests
mockNestedSite.Verify(s => s.FullName, Times.Exactly(expectedFullNameCallCount));
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches(expectedPattern, nameResult);
Assert.Null(info.GetValue("Assemblies", typeof(AssemblyName[])));
@ -1412,7 +1412,7 @@ public class CodeDomComponentSerializationServiceTests
object value = new();
service.SerializeMemberAbsolute(store, value, member1);
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
string nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches("^object_........_...._...._...._............$", nameResult);
@ -1423,7 +1423,7 @@ public class CodeDomComponentSerializationServiceTests
// Serialize again.
service.SerializeMemberAbsolute(store, value, member1);
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches("^object_........_...._...._...._............$", nameResult);
@ -1434,7 +1434,7 @@ public class CodeDomComponentSerializationServiceTests
// Serialize another.
service.SerializeMemberAbsolute(store, value, member2);
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches("^object_........_...._...._...._............$", nameResult);
@ -1462,7 +1462,7 @@ public class CodeDomComponentSerializationServiceTests
mockComponent.Verify(c => c.Site, Times.Once());
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
string nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches("^object_........_...._...._...._............$", nameResult);
@ -1475,7 +1475,7 @@ public class CodeDomComponentSerializationServiceTests
mockComponent.Verify(c => c.Site, Times.Once());
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches("^object_........_...._...._...._............$", nameResult);
@ -1488,7 +1488,7 @@ public class CodeDomComponentSerializationServiceTests
mockComponent.Verify(c => c.Site, Times.Once());
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches("^object_........_...._...._...._............$", nameResult);
@ -1525,7 +1525,7 @@ public class CodeDomComponentSerializationServiceTests
mockSite.Verify(s => s.Name, Times.Exactly(expectedCallCount));
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
string nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches(expectedPattern, nameResult);
@ -1539,7 +1539,7 @@ public class CodeDomComponentSerializationServiceTests
mockSite.Verify(s => s.Name, Times.Exactly(expectedCallCount));
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches(expectedPattern, nameResult);
@ -1553,7 +1553,7 @@ public class CodeDomComponentSerializationServiceTests
mockSite.Verify(s => s.Name, Times.Exactly(expectedCallCount));
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
AssertNullState(info);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches(expectedPattern, nameResult);
@ -1601,7 +1601,7 @@ public class CodeDomComponentSerializationServiceTests
mockNestedSite.Verify(s => s.FullName, Times.Exactly(expectedFullNameCallCount));
SerializationInfo info = new(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
string nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches(expectedPattern, nameResult);
Assert.Null(info.GetValue("Assemblies", typeof(AssemblyName[])));
@ -1614,7 +1614,7 @@ public class CodeDomComponentSerializationServiceTests
mockNestedSite.Verify(s => s.FullName, Times.Exactly(expectedFullNameCallCount));
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches(expectedPattern, nameResult);
Assert.Null(info.GetValue("Assemblies", typeof(AssemblyName[])));
@ -1627,7 +1627,7 @@ public class CodeDomComponentSerializationServiceTests
mockNestedSite.Verify(s => s.FullName, Times.Exactly(expectedFullNameCallCount));
info = new SerializationInfo(store.GetType(), new FormatterConverter());
serializable.GetObjectData(info, new StreamingContext());
serializable.GetObjectData(info, default);
nameResult = Assert.IsType<string>(Assert.Single(Assert.IsType<List<string>>(info.GetValue("Names", typeof(List<string>)))));
Assert.Matches(expectedPattern, nameResult);
Assert.Null(info.GetValue("Assemblies", typeof(AssemblyName[])));

Просмотреть файл

@ -106,6 +106,6 @@ public class CodeDomSerializerExceptionTests
public void CodeDomSerializerException_GetObjectData_ThrowsPlatformNotSupportedException()
{
CodeDomSerializerException exception = new("message", new CodeLinePragma("fileName.cs", 11));
Assert.Throws<PlatformNotSupportedException>(() => exception.GetObjectData(null, new StreamingContext()));
Assert.Throws<PlatformNotSupportedException>(() => exception.GetObjectData(null, default));
}
}

Просмотреть файл

@ -705,7 +705,7 @@ public class DesignerSerializationManagerTests
{
DesignerSerializationManager manager = new();
manager.CreateSession();
Assert.Throws<InvalidOperationException>(() => manager.CreateSession());
Assert.Throws<InvalidOperationException>(manager.CreateSession);
}
public static IEnumerable<object[]> GetInstance_NoSuchInstance_TestData()

Просмотреть файл

@ -973,7 +973,7 @@ public class ToolboxItemTests
{
SubToolboxItem item = new();
item.Lock();
Assert.Throws<InvalidOperationException>(() => item.CheckUnlocked());
Assert.Throws<InvalidOperationException>(item.CheckUnlocked);
}
public static IEnumerable<object[]> Equals_TestData()

Просмотреть файл

@ -20,4 +20,3 @@ public class AxImporterTests
.WithMessage(SR.NotImplementedByDesign);
}
}

Просмотреть файл

@ -30,6 +30,6 @@ public sealed class BaseContextMenuStripTests
foreach (var item in contextMenuStrip.Items.OfType<ToolStripMenuItem>())
{
item.Font.Should().Be(expectedFont);
}
}
}
}

Просмотреть файл

@ -35,4 +35,3 @@ public class CollectionEditVerbManagerTests
editor.EditItemsVerb.CommandID.Should().Be(new CommandID(new Guid("74d21313-2aee-11d1-8bfb-00a0c90f26f7"), 8192));
}
}

Просмотреть файл

@ -30,14 +30,14 @@ public sealed class DesignBindingTests
[Fact]
public void IsNull_ReturnsTrueWhenDataSourceIsNull()
{
DesignBinding binding = new (null, "TestMember");
DesignBinding binding = new(null, "TestMember");
binding.IsNull.Should().BeTrue();
}
[Fact]
public void IsNull_ReturnsFalseWhenDataSourceIsNotNull()
{
DesignBinding binding = new (new object(), "TestMember");
DesignBinding binding = new(new object(), "TestMember");
binding.IsNull.Should().BeFalse();
}
@ -54,7 +54,7 @@ public sealed class DesignBindingTests
[MemberData(nameof(DataFieldTestData))]
public void DataField_ReturnsExpected(string dataMember, string expectedField)
{
DesignBinding binding = new (new object(), dataMember);
DesignBinding binding = new(new object(), dataMember);
binding.DataField.Should().Be(expectedField);
}
@ -63,7 +63,7 @@ public sealed class DesignBindingTests
{
object dataSource = new();
string dataMember = "TestMember";
DesignBinding binding = new (dataSource, dataMember);
DesignBinding binding = new(dataSource, dataMember);
binding.Equals(dataSource, dataMember).Should().BeTrue();
}
@ -72,7 +72,7 @@ public sealed class DesignBindingTests
{
object dataSource = new();
string dataMember = "TestMember";
DesignBinding binding = new (dataSource, dataMember);
DesignBinding binding = new(dataSource, dataMember);
binding.Equals(new object(), dataMember).Should().BeFalse();
}
@ -81,7 +81,7 @@ public sealed class DesignBindingTests
{
object dataSource = new();
string dataMember = "TestMember";
DesignBinding binding = new (dataSource, dataMember);
DesignBinding binding = new(dataSource, dataMember);
binding.Equals(dataSource, "DifferentMember").Should().BeFalse();
}
}

Просмотреть файл

@ -18,7 +18,7 @@ public class DesignerExtendersTests
DesignerExtenders designerExtenders = new(extenderServiceMock.Object);
IExtenderProvider[] providers = designerExtenders.TestAccessor().Dynamic._providers;
IExtenderProviderService extenderService= designerExtenders.TestAccessor().Dynamic._extenderService;
IExtenderProviderService extenderService = designerExtenders.TestAccessor().Dynamic._extenderService;
providers.Should().NotBeNull();
extenderService.Should().NotBeNull();

Просмотреть файл

@ -23,7 +23,7 @@ public class FormatStringDialogTests : IDisposable
{
Action action = () =>
{
FormatStringDialog dialog = new (_context.Object);
FormatStringDialog dialog = new(_context.Object);
dialog.Dispose();
};
@ -85,7 +85,7 @@ public class FormatStringDialogTests : IDisposable
int okButtonLeftOriginalState = okButtonField.Left;
int cancelButtonLeftOriginalState = cancelButtonField.Left;
int GetRightSideOffset(Control ctl)
static int GetRightSideOffset(Control ctl)
{
int result = ctl.Width;
Control? control = ctl;

Просмотреть файл

@ -1,4 +1,7 @@
namespace System.Windows.Forms.Design.Tests;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Windows.Forms.Design.Tests;
public class GroupedContextMenuStripTests
{
@ -42,4 +45,3 @@ public class GroupedContextMenuStripTests
groupedContextMenuStrip.Items[1].Should().BeOfType<ToolStripSeparator>();
}
}

Просмотреть файл

@ -42,7 +42,7 @@ public sealed class ListBoxDesignerTests
designer.IntegralHeight.Should().BeTrue();
DockStyle dockStyle= (DockStyle)value[0];
DockStyle dockStyle = (DockStyle)value[0];
bool integralHeight = (bool)value[1];
listBox.Dock = dockStyle;
designer.IntegralHeight = integralHeight;

Просмотреть файл

@ -48,7 +48,7 @@ public class MaskDescriptorComparerTests
[WinFormsTheory]
[InlineData("Name", "Sample", typeof(int), "NameA", "SampleA", typeof(int), true)]
[InlineData("NameA", "SampleA", typeof(int), "NameB", "SampleB", typeof(string), false)]
[InlineData("NameA", "SampleA", typeof(int), "NameB", "SampleB", typeof(string), false)]
public void GetHashCode_TestCases(string nameA, string sampleA, Type typeA, string nameB, string sampleB, Type typeB, bool expectSameHashCode)
{
TestMaskDescriptor maskDescriptorA = new(nameA, sampleA, typeA);

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше