diff --git a/src/Common/tests/TestUtilities/AppContextSwitchScope.cs b/src/Common/tests/TestUtilities/AppContextSwitchScope.cs index 46a52e90a17..45dff57a733 100644 --- a/src/Common/tests/TestUtilities/AppContextSwitchScope.cs +++ b/src/Common/tests/TestUtilities/AppContextSwitchScope.cs @@ -63,6 +63,6 @@ public static bool GetDefaultValueForSwitchInAssembly(string switchName, string Type type = Type.GetType($"{typeName}, {assemblyName}") ?? throw new InvalidOperationException($"Could not find {typeName} type in {assemblyName} assembly."); - return type.TestAccessor().Dynamic.GetSwitchDefaultValue(switchName); + return type.TestAccessor.Dynamic.GetSwitchDefaultValue(switchName); } } diff --git a/src/Common/tests/TestUtilities/ITestAccessor.cs b/src/Common/tests/TestUtilities/ITestAccessor.cs index d9f706c29e6..6824dd86433 100644 --- a/src/Common/tests/TestUtilities/ITestAccessor.cs +++ b/src/Common/tests/TestUtilities/ITestAccessor.cs @@ -46,12 +46,12 @@ public interface ITestAccessor /// /// public int InternalGetDirectoryNameOffset(ReadOnlySpan path) /// { - /// var accessor = typeof(System.IO.Path).TestAccessor(); + /// var accessor = typeof(System.IO.Path).TestAccessor; /// return accessor.CreateDelegate()(@"C:\Foo"); /// } /// /// // Without ref structs you can just use Func/Action - /// var accessor = typeof(Color).TestAccessor(); + /// var accessor = typeof(Color).TestAccessor; /// bool result = accessor.CreateDelegate>("IsKnownColorSystem")(KnownColor.Window); /// ]]> /// diff --git a/src/Common/tests/TestUtilities/TestAccessor.cs b/src/Common/tests/TestUtilities/TestAccessor.cs index 0607ea8582c..8230ef9ee42 100644 --- a/src/Common/tests/TestUtilities/TestAccessor.cs +++ b/src/Common/tests/TestUtilities/TestAccessor.cs @@ -3,6 +3,7 @@ using System.Dynamic; using System.Reflection; +using System.Runtime.ExceptionServices; namespace System; @@ -63,7 +64,7 @@ public TDelegate CreateDelegate(string? methodName = null) { Type type = typeof(TDelegate); MethodInfo? invokeMethodInfo = type.GetMethod("Invoke"); - Type[] types = invokeMethodInfo is null ? [] : invokeMethodInfo.GetParameters().Select(pi => pi.ParameterType).ToArray(); + Type[] types = invokeMethodInfo is null ? [] : [.. invokeMethodInfo.GetParameters().Select(pi => pi.ParameterType)]; // To make it easier to write a class wrapper with a number of delegates, // we'll take the name from the delegate itself when unspecified. @@ -86,15 +87,15 @@ private sealed class DynamicWrapper : DynamicObject { private readonly object? _instance; - public DynamicWrapper(object? instance) - => _instance = instance; + public DynamicWrapper(object? instance) => _instance = instance; public override bool TryInvokeMember(InvokeMemberBinder binder, object?[]? args, out object? result) { - result = null; ArgumentNullException.ThrowIfNull(args); ArgumentNullException.ThrowIfNull(binder); + result = null; + MethodInfo? methodInfo = null; Type? type = s_type; @@ -115,7 +116,7 @@ public override bool TryInvokeMember(InvokeMemberBinder binder, object?[]? args, binder.Name, BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static, binder: null, - args.Select(a => a!.GetType()).ToArray(), + [.. args.Select(a => a!.GetType())], modifiers: null); } @@ -131,7 +132,9 @@ public override bool TryInvokeMember(InvokeMemberBinder binder, object?[]? args, while (true); if (methodInfo is null) + { return false; + } try { @@ -140,7 +143,7 @@ public override bool TryInvokeMember(InvokeMemberBinder binder, object?[]? args, catch (TargetInvocationException ex) when (ex.InnerException is not null) { // Unwrap the inner exception to make it easier for callers to handle. - throw ex.InnerException; + ExceptionDispatchInfo.Capture(ex.InnerException).Throw(); } return true; @@ -148,11 +151,32 @@ public override bool TryInvokeMember(InvokeMemberBinder binder, object?[]? args, public override bool TrySetMember(SetMemberBinder binder, object? value) { - MemberInfo? info = TestAccessor.DynamicWrapper.GetFieldOrPropertyInfo(binder.Name); - if (info is null) + MemberInfo? memberInfo = TestAccessor.DynamicWrapper.GetFieldOrPropertyInfo(binder.Name); + if (memberInfo is null) + { return false; + } + + try + { + switch (memberInfo) + { + case FieldInfo fieldInfo: + fieldInfo.SetValue(_instance, value); + break; + case PropertyInfo propertyInfo: + propertyInfo.SetValue(_instance, value); + break; + default: + throw new InvalidOperationException(); + } + } + catch (TargetInvocationException ex) when (ex.InnerException is not null) + { + // Unwrap the inner exception to make it easier for callers to handle. + ExceptionDispatchInfo.Capture(ex.InnerException).Throw(); + } - SetValue(info, value); return true; } @@ -160,11 +184,27 @@ public override bool TryGetMember(GetMemberBinder binder, out object? result) { result = null; - MemberInfo? info = TestAccessor.DynamicWrapper.GetFieldOrPropertyInfo(binder.Name); - if (info is null) + MemberInfo? memberInfo = TestAccessor.DynamicWrapper.GetFieldOrPropertyInfo(binder.Name); + if (memberInfo is null) + { return false; + } + + try + { + result = memberInfo switch + { + FieldInfo fieldInfo => fieldInfo.GetValue(_instance), + PropertyInfo propertyInfo => propertyInfo.GetValue(_instance), + _ => throw new InvalidOperationException() + }; + } + catch (TargetInvocationException ex) when (ex.InnerException is not null) + { + // Unwrap the inner exception to make it easier for callers to handle. + ExceptionDispatchInfo.Capture(ex.InnerException).Throw(); + } - result = GetValue(info); return true; } @@ -195,28 +235,5 @@ public override bool TryGetMember(GetMemberBinder binder, out object? result) return info; } - - private object? GetValue(MemberInfo memberInfo) - => memberInfo switch - { - FieldInfo fieldInfo => fieldInfo.GetValue(_instance), - PropertyInfo propertyInfo => propertyInfo.GetValue(_instance), - _ => throw new InvalidOperationException() - }; - - private void SetValue(MemberInfo memberInfo, object? value) - { - switch (memberInfo) - { - case FieldInfo fieldInfo: - fieldInfo.SetValue(_instance, value); - break; - case PropertyInfo propertyInfo: - propertyInfo.SetValue(_instance, value); - break; - default: - throw new InvalidOperationException(); - } - } } } diff --git a/src/Common/tests/TestUtilities/TestAccessors.cs b/src/Common/tests/TestUtilities/TestAccessors.cs index 1261c35211a..2ba3262ed33 100644 --- a/src/Common/tests/TestUtilities/TestAccessors.cs +++ b/src/Common/tests/TestUtilities/TestAccessors.cs @@ -17,53 +17,53 @@ public static partial class TestAccessors // the array here. private static readonly object?[] s_nullObjectParam = [null]; - /// - /// Extension that creates a generic internals test accessor for a - /// given instance or Type class (if only accessing statics). - /// /// /// Instance or Type class (if only accessing statics). /// - /// - /// - /// Use CreateDelegate to deal with methods that take spans or - /// other ref structs. For other members, use the dynamic accessor: - /// - /// - /// - /// - /// - /// When attempting to get nested private types that are generic (nested types in a generic type - /// are always generic, and inherit the type specifiers of the the parent type), use the extension - /// to get a fully - /// instantiated type for the nested type, then pass that Type to this method. - /// - /// - public static ITestAccessor TestAccessor(this object instanceOrType) + extension(object instanceOrType) { - ITestAccessor? testAccessor = instanceOrType is Type type - ? (ITestAccessor?)Activator.CreateInstance( - typeof(TestAccessor<>).MakeGenericType(type), - s_nullObjectParam) - : (ITestAccessor?)Activator.CreateInstance( - typeof(TestAccessor<>).MakeGenericType(instanceOrType.GetType()), - instanceOrType); + /// + /// Extension that creates a generic internals test accessor for a + /// given instance or Type class (if only accessing statics). + /// + /// + /// + /// Use CreateDelegate to deal with methods that take spans or + /// other ref structs. For other members, use the dynamic accessor: + /// + /// + /// + /// + /// + public ITestAccessor TestAccessor + { + get + { + ITestAccessor? testAccessor = instanceOrType is Type type + ? (ITestAccessor?)Activator.CreateInstance( + typeof(TestAccessor<>).MakeGenericType(type), + s_nullObjectParam) + : (ITestAccessor?)Activator.CreateInstance( + typeof(TestAccessor<>).MakeGenericType(instanceOrType.GetType()), + instanceOrType); - return testAccessor - ?? throw new ArgumentException("Cannot create TestAccessor for Nullable instances with no value."); + return testAccessor + ?? throw new ArgumentException("Cannot create TestAccessor for Nullable instances with no value."); + } + } } } diff --git a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/FileLogTraceListenerTests.vb b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/FileLogTraceListenerTests.vb index 07401583f68..ace59b2d924 100644 --- a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/FileLogTraceListenerTests.vb +++ b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/FileLogTraceListenerTests.vb @@ -73,9 +73,9 @@ Namespace Microsoft.VisualBasic.Forms.Tests listener.TraceOutputOptions = TraceOptions.Callstack listener.TraceOutputOptions.Should.Be(TraceOptions.Callstack) - CStr(listener.TestAccessor().Dynamic.HostName).Should.NotBeEmpty() + CStr(TestAccessors.get_TestAccessor(listener).Dynamic.HostName).Should.NotBeEmpty() - Dim listenerStream As FileLogTraceListener.ReferencedStream = CType(listener.TestAccessor().Dynamic.ListenerStream, FileLogTraceListener.ReferencedStream) + Dim listenerStream As FileLogTraceListener.ReferencedStream = CType(TestAccessors.get_TestAccessor(listener).Dynamic.ListenerStream, FileLogTraceListener.ReferencedStream) listenerStream.Should.NotBeNull() listenerStream.IsInUse.Should.BeTrue() listenerStream.FileSize.Should.Be(0) diff --git a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/InteractionTests.vb b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/InteractionTests.vb index de95203d6cc..2d4f2e25347 100644 --- a/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/InteractionTests.vb +++ b/src/Microsoft.VisualBasic.Forms/tests/UnitTests/System/Windows/Forms/InteractionTests.vb @@ -19,12 +19,12 @@ Namespace Microsoft.VisualBasic.Forms.Tests Dim xPos As Integer = -1 Dim yPos As Integer = -1 Dim inputHandler As New InputBoxHandler(prompt, title, defaultResponse, xPos, yPos, ParentWindow:=Nothing) - CType(inputHandler.TestAccessor.Dynamic()._prompt, String).Should.Be(prompt) - CType(inputHandler.TestAccessor.Dynamic()._title, String).Should.Be(title) - CType(inputHandler.TestAccessor.Dynamic()._defaultResponse, String).Should.Be(defaultResponse) - CType(inputHandler.TestAccessor.Dynamic()._xPos, String).Should.Be(xPos) - CType(inputHandler.TestAccessor.Dynamic()._yPos, String).Should.Be(yPos) - CType(inputHandler.TestAccessor.Dynamic()._parentWindow, IWin32Window).Should.Be(Nothing) + CType(TestAccessors.get_TestAccessor(inputHandler).Dynamic()._prompt, String).Should.Be(prompt) + CType(TestAccessors.get_TestAccessor(inputHandler).Dynamic()._title, String).Should.Be(title) + CType(TestAccessors.get_TestAccessor(inputHandler).Dynamic()._defaultResponse, String).Should.Be(defaultResponse) + CType(TestAccessors.get_TestAccessor(inputHandler).Dynamic()._xPos, String).Should.Be(xPos) + CType(TestAccessors.get_TestAccessor(inputHandler).Dynamic()._yPos, String).Should.Be(yPos) + CType(TestAccessors.get_TestAccessor(inputHandler).Dynamic()._parentWindow, IWin32Window).Should.Be(Nothing) inputHandler.Exception.Should.BeNull() inputHandler.Result.Should.BeNull() End Sub diff --git a/src/Microsoft.VisualBasic/tests/UnitTests/Microsoft/VisualBasic/ApplicationServices/SingleInstanceTests.cs b/src/Microsoft.VisualBasic/tests/UnitTests/Microsoft/VisualBasic/ApplicationServices/SingleInstanceTests.cs index 99d82b382cf..4d5874e0d8b 100644 --- a/src/Microsoft.VisualBasic/tests/UnitTests/Microsoft/VisualBasic/ApplicationServices/SingleInstanceTests.cs +++ b/src/Microsoft.VisualBasic/tests/UnitTests/Microsoft/VisualBasic/ApplicationServices/SingleInstanceTests.cs @@ -35,7 +35,7 @@ private static dynamic GetTestHelper() { var assembly = typeof(WindowsFormsApplicationBase).Assembly; var type = assembly.GetType("Microsoft.VisualBasic.ApplicationServices.SingleInstanceHelpers"); - return type.TestAccessor().Dynamic; + return type.TestAccessor.Dynamic; } private bool TryCreatePipeServer(string pipeName, out NamedPipeServerStream pipeServer) diff --git a/src/Microsoft.VisualBasic/tests/UnitTests/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBaseTests.cs b/src/Microsoft.VisualBasic/tests/UnitTests/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBaseTests.cs index 8ee2c982c4f..aa76dec8ec4 100644 --- a/src/Microsoft.VisualBasic/tests/UnitTests/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBaseTests.cs +++ b/src/Microsoft.VisualBasic/tests/UnitTests/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBaseTests.cs @@ -11,7 +11,7 @@ public class WindowsFormsApplicationBaseTests { private static string GetAppID(Assembly assembly) { - var testAccessor = typeof(WindowsFormsApplicationBase).TestAccessor(); + var testAccessor = typeof(WindowsFormsApplicationBase).TestAccessor; return testAccessor.Dynamic.GetApplicationInstanceID(assembly); } diff --git a/src/System.Private.Windows.Core/tests/System.Private.Windows.Core.Tests/System/Private/Windows/Ole/NativeToManagedAdapterTests.cs b/src/System.Private.Windows.Core/tests/System.Private.Windows.Core.Tests/System/Private/Windows/Ole/NativeToManagedAdapterTests.cs index 6da568dee95..5c7b9db140d 100644 --- a/src/System.Private.Windows.Core/tests/System.Private.Windows.Core.Tests/System/Private/Windows/Ole/NativeToManagedAdapterTests.cs +++ b/src/System.Private.Windows.Core/tests/System.Private.Windows.Core.Tests/System/Private/Windows/Ole/NativeToManagedAdapterTests.cs @@ -120,7 +120,7 @@ public void ReadStringFromHGLOBAL_InvalidHGLOBAL_Throws(bool unicode) Action action = () => { - string result = type.TestAccessor().Dynamic.ReadStringFromHGLOBAL(HGLOBAL.Null, unicode); + string result = type.TestAccessor.Dynamic.ReadStringFromHGLOBAL(HGLOBAL.Null, unicode); }; action.Should().Throw().And.HResult.Should().Be((int)HRESULT.E_FAIL); @@ -145,7 +145,7 @@ public void ReadStringFromHGLOBAL_NoTerminator_ReturnsEmptyString(bool unicode) span.Fill(0x20); } - string result = type.TestAccessor().Dynamic.ReadStringFromHGLOBAL(global, unicode); + string result = type.TestAccessor.Dynamic.ReadStringFromHGLOBAL(global, unicode); result.Should().BeEmpty(); } finally @@ -173,7 +173,7 @@ public void ReadStringFromHGLOBAL_Terminator_ReturnsString(bool unicode) span[..^2].Fill(0x20); } - string result = type.TestAccessor().Dynamic.ReadStringFromHGLOBAL(global, unicode); + string result = type.TestAccessor.Dynamic.ReadStringFromHGLOBAL(global, unicode); result.Should().NotBeEmpty(); } finally diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/ProjectFileReaderTests.cs b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/ProjectFileReaderTests.cs index 72ad9df0ffa..c60a036a646 100644 --- a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/ProjectFileReaderTests.cs +++ b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/ProjectFileReaderTests.cs @@ -14,7 +14,7 @@ namespace System.Windows.Forms.Analyzers.Tests; public class ProjectFileReaderTests { public static readonly char s_separator = CultureInfo.CurrentCulture.TextInfo.ListSeparator[0]; - private static readonly dynamic s_static = typeof(ProjectFileReader).TestAccessor().Dynamic; + private static readonly dynamic s_static = typeof(ProjectFileReader).TestAccessor.Dynamic; private readonly ITestOutputHelper _output; private static bool TryReadBool(AnalyzerConfigOptionsProvider configOptions, string propertyName, bool defaultValue, out bool value, out Diagnostic? diagnostic) diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/ControlDesignerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/ControlDesignerTests.cs index 907955ed872..670446abfea 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/ControlDesignerTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/ControlDesignerTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -187,7 +187,7 @@ public void ControlDesigner_WndProc_InvokePaint_DoesNotThrow() Action action = () => { Message m = new Message { Msg = (int)PInvokeCore.WM_PAINT }; - _designer.TestAccessor().Dynamic.WndProc(ref m); + _designer.TestAccessor.Dynamic.WndProc(ref m); }; action.Should().NotThrow(); @@ -229,8 +229,8 @@ public void GetGlyphs_Locked_ReturnsLockedGlyphs() Mock mockDesignerFrame = new(_designer._control.Site!) { CallBase = true }; BehaviorService behaviorService = new(mockServiceProvider.Object, mockDesignerFrame.Object); - _designer.TestAccessor().Dynamic._behaviorService = behaviorService; - _designer.TestAccessor().Dynamic.Locked = true; + _designer.TestAccessor.Dynamic._behaviorService = behaviorService; + _designer.TestAccessor.Dynamic.Locked = true; GlyphCollection glyphs = _designer.GetGlyphs(GlyphSelectionType.SelectedPrimary); @@ -250,7 +250,7 @@ public void GetGlyphs_GlyphSelectionTypeNotSelected_ReturnsEmptyCollection() [Fact] public void GetGlyphs_WithNullBehaviorService_ThrowsException() { - _designer.TestAccessor().Dynamic._behaviorService = null; + _designer.TestAccessor.Dynamic._behaviorService = null; Action action = () => _designer.GetGlyphs(GlyphSelectionType.SelectedPrimary); action.Should().Throw(); @@ -267,20 +267,20 @@ public void GetGlyphs_NonSizeableControl_ReturnsNoResizeHandleGlyphs() BehaviorService behaviorService = new(mockServiceProvider.Object, mockDesignerFrame.Object); _designer._mockSite.Setup(s => s.GetService(typeof(BehaviorService))).Returns(behaviorService); - _designer.TestAccessor().Dynamic._behaviorService = behaviorService; + _designer.TestAccessor.Dynamic._behaviorService = behaviorService; GlyphCollection glyphs = _designer.GetGlyphs(GlyphSelectionType.SelectedPrimary); glyphs[0].Should().BeOfType(); - ((SelectionRules)glyphs[0].TestAccessor().Dynamic.rules).Should().Be(SelectionRules.None); + ((SelectionRules)glyphs[0].TestAccessor.Dynamic.rules).Should().Be(SelectionRules.None); glyphs[1].Should().BeOfType(); - ((SelectionRules)glyphs[1].TestAccessor().Dynamic.rules).Should().Be(SelectionRules.None); + ((SelectionRules)glyphs[1].TestAccessor.Dynamic.rules).Should().Be(SelectionRules.None); glyphs[2].Should().BeOfType(); - ((SelectionRules)glyphs[2].TestAccessor().Dynamic.rules).Should().Be(SelectionRules.None); + ((SelectionRules)glyphs[2].TestAccessor.Dynamic.rules).Should().Be(SelectionRules.None); glyphs[3].Should().BeOfType(); - ((SelectionRules)glyphs[3].TestAccessor().Dynamic.rules).Should().Be(SelectionRules.None); + ((SelectionRules)glyphs[3].TestAccessor.Dynamic.rules).Should().Be(SelectionRules.None); glyphs[4].Should().BeOfType(); - ((SelectionRules)glyphs[4].TestAccessor().Dynamic.rules).Should().Be(SelectionRules.None); + ((SelectionRules)glyphs[4].TestAccessor.Dynamic.rules).Should().Be(SelectionRules.None); } [Fact] @@ -296,7 +296,7 @@ public void GetGlyphs_ResizableGlyphs_ReturnsExpected() Mock mockDesignerFrame = new(_designer._mockSite.Object) { CallBase = true }; BehaviorService behaviorService = new(mockServiceProvider.Object, mockDesignerFrame.Object); - _designer.TestAccessor().Dynamic._behaviorService = behaviorService; + _designer.TestAccessor.Dynamic._behaviorService = behaviorService; GlyphCollection glyphs = _designer.GetGlyphs(GlyphSelectionType.SelectedPrimary); @@ -319,7 +319,7 @@ public void GetGlyphs_ResizableGlyphs_ReturnsExpected() for (int i = 0; i < expectedGlyphs.Length; i++) { glyphs[i].Should().BeOfType(expectedGlyphs[i].glyphType); - ((SelectionRules)glyphs[i].TestAccessor().Dynamic.rules).Should().Be(expectedGlyphs[i].rules); + ((SelectionRules)glyphs[i].TestAccessor.Dynamic.rules).Should().Be(expectedGlyphs[i].rules); } } @@ -372,7 +372,7 @@ public void WndProc_CallsOnMouseDragEnd_WhenLeftMouseButtonReleased() _designer.OnMouseDragEndCalled.Should().BeTrue(); - bool _ctrlSelect = (bool)_designer.TestAccessor().Dynamic._ctrlSelect; + bool _ctrlSelect = (bool)_designer.TestAccessor.Dynamic._ctrlSelect; _ctrlSelect.Should().BeFalse(); } } diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/AnchorEditorTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/AnchorEditorTests.cs index 56d6e1599bb..38fe0eee4de 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/AnchorEditorTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/AnchorEditorTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. #nullable disable @@ -90,7 +90,7 @@ public void AnchorEditor_AnchorUI_ControlType_IsCheckButton(string fieldName) var item = (Control)anchorUI.GetType() .GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance).GetValue(anchorUI); - var actual = (UIA_CONTROLTYPE_ID)(int)item.AccessibilityObject.TestAccessor().Dynamic + var actual = (UIA_CONTROLTYPE_ID)(int)item.AccessibilityObject.TestAccessor.Dynamic .GetPropertyValue(UIA_PROPERTY_ID.UIA_ControlTypePropertyId); Assert.Equal(UIA_CONTROLTYPE_ID.UIA_CheckBoxControlTypeId, actual); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/BindingNavigatorDesignerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/BindingNavigatorDesignerTests.cs index 437797c9360..cbba70a2309 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/BindingNavigatorDesignerTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/BindingNavigatorDesignerTests.cs @@ -130,7 +130,7 @@ public void ComponentChangeService_ComponentRemoved_ShouldSetNavigationItemToNul getter(_bindingNavigator).Should().Be(item); ComponentEventArgs args = new(item); - _designer.TestAccessor().Dynamic.ComponentChangeService_ComponentRemoved(null, args); + _designer.TestAccessor.Dynamic.ComponentChangeService_ComponentRemoved(null, args); getter(_bindingNavigator).Should().BeNull(); } @@ -143,7 +143,7 @@ public void ComponentChangeService_ComponentRemovedOtherComponent_ShouldNotChang _bindingNavigator.DeleteItem = deleteItem; ComponentEventArgs args = new(otherItem); - _designer.TestAccessor().Dynamic.ComponentChangeService_ComponentRemoved(null, args); + _designer.TestAccessor.Dynamic.ComponentChangeService_ComponentRemoved(null, args); _bindingNavigator.DeleteItem.Should().Be(deleteItem); } @@ -159,7 +159,7 @@ public void ComponentChangeService_ComponentChangedDifferentComponent_ShouldIgno PropertyDescriptor? textProperty = TypeDescriptor.GetProperties(otherItem)["Text"]; ComponentChangedEventArgs args = new(otherItem, textProperty, "old text", "Other text"); - _designer.TestAccessor().Dynamic.ComponentChangeService_ComponentChanged(null, args); + _designer.TestAccessor.Dynamic.ComponentChangeService_ComponentChanged(null, args); _bindingNavigator.CountItemFormat.Should().Be("Original format"); } @@ -174,7 +174,7 @@ public void ComponentChangeService_ComponentChangedDifferentProperty_ShouldIgnor PropertyDescriptor? visibleProperty = TypeDescriptor.GetProperties(countItem)["Visible"]; ComponentChangedEventArgs args = new(countItem, visibleProperty, false, true); - _designer.TestAccessor().Dynamic.ComponentChangeService_ComponentChanged(null, args); + _designer.TestAccessor.Dynamic.ComponentChangeService_ComponentChanged(null, args); _bindingNavigator.CountItemFormat.Should().Be("Original format"); } diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/BindingSourceDesignerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/BindingSourceDesignerTests.cs index bb58796261e..676577741cd 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/BindingSourceDesignerTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/BindingSourceDesignerTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -14,11 +14,11 @@ public void BindingUpdatedByUser_SetValue_ShouldUpdateField() { using BindingSourceDesigner designer = new(); - bool originalValue = designer.TestAccessor().Dynamic._bindingUpdatedByUser; + bool originalValue = designer.TestAccessor.Dynamic._bindingUpdatedByUser; originalValue.Should().BeFalse(); designer.BindingUpdatedByUser = true; - bool updatedValue = designer.TestAccessor().Dynamic._bindingUpdatedByUser; + bool updatedValue = designer.TestAccessor.Dynamic._bindingUpdatedByUser; updatedValue.Should().BeTrue(); } @@ -40,6 +40,6 @@ public void Initialize_ShouldSubscribeToComponentChangeServiceEvents() ComponentEventArgs args = new(componentMock.Object); - designer.TestAccessor().Dynamic.OnComponentRemoving(null, args); + designer.TestAccessor.Dynamic.OnComponentRemoving(null, args); } } diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/CommandSetTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/CommandSetTests.cs index de7844f9c8c..8f713ba6e52 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/CommandSetTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/CommandSetTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -28,7 +28,7 @@ public void Dispose_DisposesResourcesCorrectly() dynamic accessor; using (CommandSet commandSet = new(mockSite.Object)) { - accessor = commandSet.TestAccessor().Dynamic; + accessor = commandSet.TestAccessor.Dynamic; } mockMenuCommandService.Verify(m => m.RemoveCommand(It.IsAny()), Times.AtLeastOnce); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ContentAlignmentEditorTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ContentAlignmentEditorTests.cs index 830b33c4de3..ad78e12af3d 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ContentAlignmentEditorTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ContentAlignmentEditorTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. #nullable disable @@ -30,7 +30,7 @@ public void ContentAlignmentEditor_ContentAlignmentEditor_ContentUI_IsRadioButto var item = (Control)contentUI.GetType() .GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance).GetValue(contentUI); - var actual = (UIA_CONTROLTYPE_ID)(int)item.AccessibilityObject.TestAccessor().Dynamic + var actual = (UIA_CONTROLTYPE_ID)(int)item.AccessibilityObject.TestAccessor.Dynamic .GetPropertyValue(UIA_PROPERTY_ID.UIA_ControlTypePropertyId); Assert.Equal(UIA_CONTROLTYPE_ID.UIA_RadioButtonControlTypeId, actual); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ContextMenuStripActionListTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ContextMenuStripActionListTests.cs index 85bd54935f9..a699e5d524d 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ContextMenuStripActionListTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ContextMenuStripActionListTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -55,7 +55,7 @@ public void Constructor_InitializesFields() _actionList.Should().NotBeNull(); _actionList.Should().BeOfType(); - ToolStripDropDown toolStripDropDownValue = (ToolStripDropDown)_actionList.TestAccessor().Dynamic._toolStripDropDown; + ToolStripDropDown toolStripDropDownValue = (ToolStripDropDown)_actionList.TestAccessor.Dynamic._toolStripDropDown; ((ToolStripDropDownMenu)toolStripDropDownValue).Should().Be(_toolStripDropDownMenu); } @@ -140,7 +140,7 @@ public void GetSortedActionItems_WithToolStripDropDown_OnlyIncludesRenderMode() { _toolStripDropDown.Site = _toolStripDropDownMenu.Site; _designer.Initialize(_toolStripDropDown); - _actionList.TestAccessor().Dynamic._toolStripDropDown = _toolStripDropDown; + _actionList.TestAccessor.Dynamic._toolStripDropDown = _toolStripDropDown; var items = _actionList.GetSortedActionItems().Cast().ToList(); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ControlCommandSetTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ControlCommandSetTests.cs index 7dda3aa8689..f0b20eb4765 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ControlCommandSetTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ControlCommandSetTests.cs @@ -50,14 +50,14 @@ public void Constructor_ShouldInitializeCommandSet() { _controlCommandSet.Should().NotBeNull(); - StatusCommandUI statusCommandUI = _controlCommandSet.TestAccessor().Dynamic._statusCommandUI; + StatusCommandUI statusCommandUI = _controlCommandSet.TestAccessor.Dynamic._statusCommandUI; statusCommandUI.Should().NotBeNull(); - MenuCommand[] commandSet = _controlCommandSet.TestAccessor().Dynamic._commandSet; + MenuCommand[] commandSet = _controlCommandSet.TestAccessor.Dynamic._commandSet; commandSet.Should().NotBeNull(); commandSet.Should().NotBeEmpty(); - TabOrder tabOrder = _controlCommandSet.TestAccessor().Dynamic._tabOrder; + TabOrder tabOrder = _controlCommandSet.TestAccessor.Dynamic._tabOrder; tabOrder.Should().BeNull(); } @@ -83,7 +83,7 @@ public void OnMenuLockControls_ShouldToggleLockControls() CommandID commandID = new(Guid.NewGuid(), 0); MenuCommand menuCommand = new(null, commandID) { Checked = false }; - _controlCommandSet.TestAccessor().Dynamic.OnMenuLockControls(menuCommand, EventArgs.Empty); + _controlCommandSet.TestAccessor.Dynamic.OnMenuLockControls(menuCommand, EventArgs.Empty); menuCommand.Checked.Should().BeTrue(); } @@ -118,7 +118,7 @@ public void GetSnapInformation_WithSnapToGridPropertyInParent_ShouldReturnThatPr try { - _controlCommandSet.TestAccessor().Dynamic.GetSnapInformation( + _controlCommandSet.TestAccessor.Dynamic.GetSnapInformation( _designerHostMock.Object, childComponent, out Size snapSize, diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ControlDesigner.TransparentBehaviorTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ControlDesigner.TransparentBehaviorTests.cs index 67478d48200..1324ba0b055 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ControlDesigner.TransparentBehaviorTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ControlDesigner.TransparentBehaviorTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Drawing; @@ -38,7 +38,7 @@ private class TestControl : Control { } private Rectangle GetControlRect(ControlDesigner.TransparentBehavior behavior) { - dynamic accessor = behavior.TestAccessor().Dynamic; + dynamic accessor = behavior.TestAccessor.Dynamic; return accessor._controlRect; } diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ControlDesignerAccessibleObjectTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ControlDesignerAccessibleObjectTests.cs index ed04de3cb3d..1d080d357e8 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ControlDesignerAccessibleObjectTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ControlDesignerAccessibleObjectTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -101,7 +101,7 @@ public void ControlDesignerAccessibleObject_State_ReturnsExpectedValue(Accessibl Control control = new(); var accessibleObject = new ControlDesigner.ControlDesignerAccessibleObject(_designer, control); - dynamic accessor = accessibleObject.TestAccessor().Dynamic; + dynamic accessor = accessibleObject.TestAccessor.Dynamic; accessor._selectionService = Mock.Of(s => s.GetComponentSelected(control) == isSelected && s.PrimarySelection == (isPrimarySelection ? control : null)); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewAddColumnDialogTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewAddColumnDialogTests.cs index 4da1e0829ce..dde42ff535f 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewAddColumnDialogTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewAddColumnDialogTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -36,8 +36,8 @@ public void Constructor_ShouldInitializeFields() using DataGridViewAddColumnDialog dialog = new(columns, _dataGridView); - DataGridViewColumnCollection dataGridViewColumns = (DataGridViewColumnCollection)dialog.TestAccessor().Dynamic._dataGridViewColumns; - using DataGridView liveDataGridView = (DataGridView)dialog.TestAccessor().Dynamic._liveDataGridView; + DataGridViewColumnCollection dataGridViewColumns = (DataGridViewColumnCollection)dialog.TestAccessor.Dynamic._dataGridViewColumns; + using DataGridView liveDataGridView = (DataGridView)dialog.TestAccessor.Dynamic._liveDataGridView; dialog.Should().NotBeNull(); dataGridViewColumns.Should().BeSameAs(columns); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewCellStyleBuilderTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewCellStyleBuilderTests.cs index fc046ecf88f..0e148f427cb 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewCellStyleBuilderTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewCellStyleBuilderTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -32,7 +32,7 @@ public void Context_Set_ReturnsCorrectValue() Mock context = new(); builder.Context = context.Object; - ITypeDescriptorContext result = builder.TestAccessor().Dynamic._context; + ITypeDescriptorContext result = builder.TestAccessor.Dynamic._context; result.Should().Be(context.Object); } diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewColumnDesignerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewColumnDesignerTests.cs index 338979b9a2d..4de0087b625 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewColumnDesignerTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewColumnDesignerTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -42,7 +42,7 @@ public void NameProperty_GetAndSet() designer.Initialize(column); column.Site = siteMock.Object; - designer.TestAccessor().Dynamic.Name = "NewColumnName"; + designer.TestAccessor.Dynamic.Name = "NewColumnName"; column.Name.Should().Be("NewColumnName"); } @@ -54,7 +54,7 @@ public void WidthProperty_GetAndSet() using DataGridViewColumnDesigner designer = new(); designer.Initialize(column); - designer.TestAccessor().Dynamic.Width = 150; + designer.TestAccessor.Dynamic.Width = 150; column.Width.Should().Be(150); } @@ -67,6 +67,6 @@ public void LiveDataGridView_Set() designer.LiveDataGridView = dataGridView; - ((DataGridView)designer.TestAccessor().Dynamic._liveDataGridView).Should().Be(dataGridView); + ((DataGridView)designer.TestAccessor.Dynamic._liveDataGridView).Should().Be(dataGridView); } } diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewColumnTypePickerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewColumnTypePickerTests.cs index db4859cee5b..b14adc689fd 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewColumnTypePickerTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewColumnTypePickerTests.cs @@ -49,7 +49,7 @@ public void Start_ShouldPopulateListBoxItems() _picker.Start(editorServiceMock.Object, discoveryServiceMock.Object, typeof(DataGridViewTextBoxColumn)); - var listBox = _picker.TestAccessor().Dynamic._typesListBox; + var listBox = _picker.TestAccessor.Dynamic._typesListBox; object count = listBox.Items.Count; count.Should().Be(2); } @@ -57,7 +57,7 @@ public void Start_ShouldPopulateListBoxItems() [Fact] public void SetBoundsCore_ShouldSetMinimumWidthAndHeight() { - var accessor = _picker.TestAccessor().Dynamic; + var accessor = _picker.TestAccessor.Dynamic; accessor.SetBoundsCore(0, 0, 50, 50, BoundsSpecified.All); _picker.Width.Should().BeGreaterThanOrEqualTo(100); @@ -73,10 +73,10 @@ public void typesListBox_SelectedIndexChanged_ShouldSetSelectedType() discoveryServiceMock.Setup(ds => ds.GetTypes(It.IsAny(), It.IsAny())).Returns(types); _picker.Start(editorServiceMock.Object, discoveryServiceMock.Object, typeof(DataGridViewTextBoxColumn)); - var listBox = _picker.TestAccessor().Dynamic._typesListBox; + var listBox = _picker.TestAccessor.Dynamic._typesListBox; listBox.SelectedIndex = 1; - _picker.TestAccessor().Dynamic.typesListBox_SelectedIndexChanged(listBox, EventArgs.Empty); + _picker.TestAccessor.Dynamic.typesListBox_SelectedIndexChanged(listBox, EventArgs.Empty); _picker.SelectedType.Should().Be(typeof(DataGridViewTextBoxColumn)); } diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewComponentPropertyGridSiteTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewComponentPropertyGridSiteTests.cs index 4b8b73eb3fd..2bd41648020 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewComponentPropertyGridSiteTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewComponentPropertyGridSiteTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -36,7 +36,7 @@ public void GetService_ShouldReturnNull_WhenInGetServiceIsTrue() Mock serviceProviderMock = new(); DataGridViewComponentPropertyGridSite site = new(serviceProviderMock.Object, component); - site.TestAccessor().Dynamic._inGetService = true; + site.TestAccessor.Dynamic._inGetService = true; var service = site.GetService(typeof(object)); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewDesignerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewDesignerTests.cs index a2022a98bae..f416dfab4ae 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewDesignerTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataGridViewDesignerTests.cs @@ -148,7 +148,7 @@ public void PreFilterProperties_ShadowsPropertiesCorrectly() { "DataSource", TypeDescriptor.GetProperties(typeof(DataGridView))["DataSource"]!} }; - _designer.TestAccessor().Dynamic.PreFilterProperties(properties); + _designer.TestAccessor.Dynamic.PreFilterProperties(properties); properties["AutoSizeColumnsMode"].ComponentType.Should().Be(typeof(DataGridViewDesigner)); properties["DataSource"].ComponentType.Should().Be(typeof(DataGridViewDesigner)); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DesignBindingPickerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DesignBindingPickerTests.cs index 50ab9082f8b..65462449507 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DesignBindingPickerTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DesignBindingPickerTests.cs @@ -18,11 +18,11 @@ public class DesignBindingPickerTests : IDisposable public DesignBindingPickerTests() { _picker = new DesignBindingPicker(); - _treeViewCtrl = _picker.TestAccessor().Dynamic._treeViewCtrl; - _addNewCtrl = _picker.TestAccessor().Dynamic._addNewCtrl; - _addNewPanel = _picker.TestAccessor().Dynamic._addNewPanel; - _helpTextCtrl = _picker.TestAccessor().Dynamic._helpTextCtrl; - _helpTextPanel = _picker.TestAccessor().Dynamic._helpTextPanel; + _treeViewCtrl = _picker.TestAccessor.Dynamic._treeViewCtrl; + _addNewCtrl = _picker.TestAccessor.Dynamic._addNewCtrl; + _addNewPanel = _picker.TestAccessor.Dynamic._addNewPanel; + _helpTextCtrl = _picker.TestAccessor.Dynamic._helpTextCtrl; + _helpTextPanel = _picker.TestAccessor.Dynamic._helpTextPanel; } public void Dispose() => _picker.Dispose(); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DesignBindingValueUIHandlerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DesignBindingValueUIHandlerTests.cs index cdaff4be66f..71273e8cd56 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DesignBindingValueUIHandlerTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DesignBindingValueUIHandlerTests.cs @@ -18,7 +18,7 @@ public DesignBindingValueUIHandlerTests() public void Dispose_DisposesDataBitmap_WhenDataBitmapIsNotNull() { using Bitmap bitmap = new(10, 10); - _handler.TestAccessor().Dynamic._dataBitmap = bitmap; + _handler.TestAccessor.Dynamic._dataBitmap = bitmap; _handler.Dispose(); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DesignerExtendersTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DesignerExtendersTests.cs index ea9f3962569..75c51403f9c 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DesignerExtendersTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DesignerExtendersTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -15,8 +15,8 @@ public void Dispose_RemovesExtenderProviders() Mock extenderServiceMock = new(); DesignerExtenders designerExtenders = new(extenderServiceMock.Object); - IExtenderProvider[] providers = designerExtenders.TestAccessor().Dynamic._providers; - IExtenderProviderService extenderService = designerExtenders.TestAccessor().Dynamic._extenderService; + IExtenderProvider[] providers = designerExtenders.TestAccessor.Dynamic._providers; + IExtenderProviderService extenderService = designerExtenders.TestAccessor.Dynamic._extenderService; providers.Should().NotBeNull(); extenderService.Should().NotBeNull(); @@ -25,8 +25,8 @@ public void Dispose_RemovesExtenderProviders() extenderServiceMock.Verify(s => s.RemoveExtenderProvider(It.IsAny()), Times.Exactly(2)); designerExtenders.Invoking(d => d.Dispose()).Should().NotThrow(); - providers = designerExtenders.TestAccessor().Dynamic._providers; - extenderService = designerExtenders.TestAccessor().Dynamic._extenderService; + providers = designerExtenders.TestAccessor.Dynamic._providers; + extenderService = designerExtenders.TestAccessor.Dynamic._extenderService; providers.Should().BeNull(); extenderService.Should().BeNull(); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/FlowLayoutPanelDesignerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/FlowLayoutPanelDesignerTests.cs index e7c83d96d2a..c6e2bf06252 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/FlowLayoutPanelDesignerTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/FlowLayoutPanelDesignerTests.cs @@ -67,7 +67,7 @@ public void PreFilterProperties_ShouldModifyFlowDirectionProperty() { nameof(FlowLayoutPanel.FlowDirection), TypeDescriptor.CreateProperty(typeof(FlowLayoutPanel), nameof(FlowLayoutPanel.FlowDirection), typeof(FlowDirection)) } }; - _designer.TestAccessor().Dynamic.PreFilterProperties(properties); + _designer.TestAccessor.Dynamic.PreFilterProperties(properties); properties[nameof(FlowLayoutPanel.FlowDirection)].Should().NotBeNull(); properties[nameof(FlowLayoutPanel.FlowDirection)].Should().BeAssignableTo(); @@ -80,7 +80,7 @@ public void AllowSetChildIndexOnDrop_ShouldReturnFalse() => [Fact] public void AllowGenericDragBox_ShouldReturnFalse() { - bool result = _designer.TestAccessor().Dynamic.AllowGenericDragBox; + bool result = _designer.TestAccessor.Dynamic.AllowGenericDragBox; result.Should().BeFalse(); } @@ -94,7 +94,7 @@ public void HorizontalFlow_ShouldReturnCorrectValueBasedOnFlowDirection(FlowDire { _flowLayoutPanel.FlowDirection = flowDirection; - bool result = _designer.TestAccessor().Dynamic.HorizontalFlow; + bool result = _designer.TestAccessor.Dynamic.HorizontalFlow; result.Should().Be(expected); } @@ -108,7 +108,7 @@ public void RTLTranslateFlowDirection_ShouldTranslateCorrectly(FlowDirection inp { _flowLayoutPanel.RightToLeft = RightToLeft.Yes; - FlowDirection result = _designer.TestAccessor().Dynamic.RTLTranslateFlowDirection(input); + FlowDirection result = _designer.TestAccessor.Dynamic.RTLTranslateFlowDirection(input); result.Should().Be(expected); } @@ -120,7 +120,7 @@ public void IsRtl_ShouldReturnCorrectValueBasedOnRightToLeft(RightToLeft rightTo { _flowLayoutPanel.RightToLeft = rightToLeft; - bool result = _designer.TestAccessor().Dynamic.IsRtl; + bool result = _designer.TestAccessor.Dynamic.IsRtl; result.Should().Be(expected); } @@ -134,7 +134,7 @@ public void GetMarginBounds_ShouldReturnCorrectRectangle() Margin = new Padding(5, 6, 7, 8) }; - Rectangle result = _designer.TestAccessor().Dynamic.GetMarginBounds(control); + Rectangle result = _designer.TestAccessor.Dynamic.GetMarginBounds(control); result.Should().Be(new Rectangle(5, 14, 42, 54)); } @@ -150,21 +150,21 @@ public void OnDragEnter_ShouldInitializeDragState() DragDropEffects.Copy, DragDropEffects.Copy); - _designer.TestAccessor().Dynamic.OnDragEnter(dragEventArgs); + _designer.TestAccessor.Dynamic.OnDragEnter(dragEventArgs); - int insertionIndex = _designer.TestAccessor().Dynamic._insertionIndex; + int insertionIndex = _designer.TestAccessor.Dynamic._insertionIndex; insertionIndex.Should().Be(-1); - Point lastMouseLocation = _designer.TestAccessor().Dynamic._lastMouseLocation; + Point lastMouseLocation = _designer.TestAccessor.Dynamic._lastMouseLocation; lastMouseLocation.Should().Be(Point.Empty); } [Fact] public void OnDragLeave_ShouldClearDragState() { - _designer.TestAccessor().Dynamic.OnDragLeave(EventArgs.Empty); + _designer.TestAccessor.Dynamic.OnDragLeave(EventArgs.Empty); - int insertionIndex = _designer.TestAccessor().Dynamic._insertionIndex; + int insertionIndex = _designer.TestAccessor.Dynamic._insertionIndex; insertionIndex.Should().Be(-1); } @@ -179,9 +179,9 @@ public void OnDragOver_ShouldUpdateInsertionIndex() DragDropEffects.Copy, DragDropEffects.Copy); - _designer.TestAccessor().Dynamic.OnDragOver(dragEventArgs); + _designer.TestAccessor.Dynamic.OnDragOver(dragEventArgs); - int insertionIndex = _designer.TestAccessor().Dynamic._insertionIndex; + int insertionIndex = _designer.TestAccessor.Dynamic._insertionIndex; insertionIndex.Should().Be(-1); } @@ -200,7 +200,7 @@ public void OnDragDrop_ShouldReorderControls() DragDropEffects.Move, DragDropEffects.Move); - _designer.TestAccessor().Dynamic.OnDragDrop(dragEventArgs); + _designer.TestAccessor.Dynamic.OnDragDrop(dragEventArgs); _flowLayoutPanel.Controls[0].Should().Be(control1); _flowLayoutPanel.Controls[1].Should().Be(control2); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/FormatStringDialogTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/FormatStringDialogTests.cs index 3916d9ae373..9fafcab6727 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/FormatStringDialogTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/FormatStringDialogTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -76,9 +76,9 @@ public void End_DoesNotThrow() [Fact] public void FormatControlFinishedLoading_AdjustsButtonPositionsCorrectly() { - dynamic? okButtonField = _formatStringDialog.TestAccessor().Dynamic._okButton; - dynamic? cancelButtonField = _formatStringDialog.TestAccessor().Dynamic._cancelButton; - dynamic? formatControlField = _formatStringDialog.TestAccessor().Dynamic._formatControl1; + dynamic? okButtonField = _formatStringDialog.TestAccessor.Dynamic._okButton; + dynamic? cancelButtonField = _formatStringDialog.TestAccessor.Dynamic._cancelButton; + dynamic? formatControlField = _formatStringDialog.TestAccessor.Dynamic._formatControl1; int okButtonLeftOriginalState = okButtonField.Left; int cancelButtonLeftOriginalState = cancelButtonField.Left; diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/FormatStringEditorTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/FormatStringEditorTests.cs index be06cd71885..20588654ddb 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/FormatStringEditorTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/FormatStringEditorTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -78,8 +78,8 @@ public void EditValue_WithDirtyDialog_CallsOnComponentChanged_Once() { using FormatStringDialog dialog = new(_context.Object); - _editor.TestAccessor().Dynamic._formatStringDialog = dialog; - dialog.TestAccessor().Dynamic._dirty = true; + _editor.TestAccessor.Dynamic._formatStringDialog = dialog; + dialog.TestAccessor.Dynamic._dirty = true; _editor.EditValue(_context.Object, _provider.Object, "NewValue"); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ImageListImageEditorTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ImageListImageEditorTests.cs index cb73790b874..eb7b830c08d 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ImageListImageEditorTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ImageListImageEditorTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. #nullable disable @@ -14,7 +14,7 @@ public class ImageListImageEditorTests public void ImageListImageEditor_LoadImageFromStream_BitmapStream_ReturnsExpected() { ImageListImageEditor editor = new(); - var editor_LoadImageFromStream = editor.TestAccessor().CreateDelegate>("LoadImageFromStream"); + var editor_LoadImageFromStream = editor.TestAccessor.CreateDelegate>("LoadImageFromStream"); using MemoryStream stream = new(); using Bitmap image = new(10, 10); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/InheritanceUITests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/InheritanceUITests.cs index 46ec6ee3278..453bae28ad0 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/InheritanceUITests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/InheritanceUITests.cs @@ -57,7 +57,7 @@ public void AddInheritedControl_ShouldSetToolTipText(InheritanceLevel inheritanc _inheritanceUI.AddInheritedControl(trayControl, inheritanceLevel); } - ToolTip toolTip = _inheritanceUI.TestAccessor().Dynamic._toolTip; + ToolTip toolTip = _inheritanceUI.TestAccessor.Dynamic._toolTip; string? text = toolTip.GetToolTip(trayControl); text.Should().Be(expectedText); } @@ -82,7 +82,7 @@ public void RemoveInheritedControl_ShouldUnsetToolTipText() _inheritanceUI.RemoveInheritedControl(trayControl); - ToolTip toolTip = _inheritanceUI.TestAccessor().Dynamic._toolTip; + ToolTip toolTip = _inheritanceUI.TestAccessor.Dynamic._toolTip; string? text = toolTip.GetToolTip(trayControl); text.Should().BeEmpty(); } @@ -104,7 +104,7 @@ public void InheritanceGlyph_And_InheritanceGlyphRectangle_ShouldReturnExpectedV public void AddInheritedControl_ShouldSetToolTipText_And_InitializeToolTip(InheritanceLevel inheritanceLevel, string expectedText) { _inheritanceUI.AddInheritedControl(_control, inheritanceLevel); - ToolTip toolTip = _inheritanceUI.TestAccessor().Dynamic._toolTip; + ToolTip toolTip = _inheritanceUI.TestAccessor.Dynamic._toolTip; toolTip.Should().NotBeNull().And.BeOfType(); toolTip.ShowAlways.Should().BeTrue(); @@ -116,7 +116,7 @@ public void AddInheritedControl_ShouldSetToolTipText_And_InitializeToolTip(Inher public void AddAndRemoveInheritedControl_ShouldSetAndUnsetToolTipText_ForNonSitedChildren() { _inheritanceUI.AddInheritedControl(_control, InheritanceLevel.Inherited); - ToolTip toolTip = _inheritanceUI.TestAccessor().Dynamic._toolTip; + ToolTip toolTip = _inheritanceUI.TestAccessor.Dynamic._toolTip; toolTip.Should().NotBeNull().And.BeOfType(); toolTip.GetToolTip(_control).Should().Be("Inherited control"); @@ -136,7 +136,7 @@ public void Dispose_ShouldDisposeToolTip_And_NotThrowIfToolTipIsNull() Mock mockToolTip = new(); mockToolTip.Protected().Setup("Dispose", ItExpr.IsAny()); - _inheritanceUI.TestAccessor().Dynamic._toolTip = mockToolTip.Object; + _inheritanceUI.TestAccessor.Dynamic._toolTip = mockToolTip.Object; _inheritanceUI.Invoking(ui => ui.Dispose()).Should().NotThrow(); mockToolTip.Protected().Verify("Dispose", Times.Once(), ItExpr.IsAny()); @@ -150,7 +150,7 @@ public void RemoveInheritedControl_ShouldUnsetToolTipText_And_NotThrowIfToolTipI _inheritanceUI.AddInheritedControl(_control, InheritanceLevel.Inherited); _inheritanceUI.RemoveInheritedControl(_control); - ToolTip toolTip = _inheritanceUI.TestAccessor().Dynamic._toolTip; + ToolTip toolTip = _inheritanceUI.TestAccessor.Dynamic._toolTip; toolTip.Should().NotBeNull().And.BeOfType(); toolTip.GetToolTip(_control).Should().BeEmpty(); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/LinkAreaEditor.LinkAreaUITests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/LinkAreaEditor.LinkAreaUITests.cs index 172c788cd00..0283b5876e9 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/LinkAreaEditor.LinkAreaUITests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/LinkAreaEditor.LinkAreaUITests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -28,7 +28,7 @@ public void LinkAreaUI_Constructor_InitializesCorrectly() _linkAreaUI.Should().NotBeNull(); _linkAreaUI.Should().BeOfType(); - IHelpService? helpServiceField = _linkAreaUI.TestAccessor().Dynamic._helpService; + IHelpService? helpServiceField = _linkAreaUI.TestAccessor.Dynamic._helpService; helpServiceField.Should().Be(_mockHelpService.Object); } @@ -53,7 +53,7 @@ public void SampleText_Set_UpdatesSelection() _linkAreaUI.SampleText.Should().Be(testText); - dynamic testAccessor = _linkAreaUI.TestAccessor().Dynamic; + dynamic testAccessor = _linkAreaUI.TestAccessor.Dynamic; int selectionStart = (int)testAccessor._sampleEdit.SelectionStart; int selectionLength = (int)testAccessor._sampleEdit.SelectionLength; @@ -90,7 +90,7 @@ public void Start_SetsValueAndUpdatesSelection() object? testValue = new LinkArea(3, 4); _linkAreaUI.Start(testValue); - dynamic dynamicAccessor = _linkAreaUI.TestAccessor().Dynamic; + dynamic dynamicAccessor = _linkAreaUI.TestAccessor.Dynamic; int selectionStart = (int)dynamicAccessor._sampleEdit.SelectionStart; int selectionLength = (int)dynamicAccessor._sampleEdit.SelectionLength; diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ListViewDesignerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ListViewDesignerTests.cs index fd2a0e52d18..28b6ade6183 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ListViewDesignerTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ListViewDesignerTests.cs @@ -38,7 +38,7 @@ public void ListViewDesigner_GetHitTest_ReturnsFalse_WhenViewIsNotDetails() { _listView.View = View.LargeIcon; - bool result = _listViewDesigner.TestAccessor().Dynamic.GetHitTest(new Point(10, 10)); + bool result = _listViewDesigner.TestAccessor.Dynamic.GetHitTest(new Point(10, 10)); result.Should().BeFalse(); } @@ -49,7 +49,7 @@ public void ListViewDesigner_GetHitTest_ReturnsFalse_WhenPointIsNotOnHeader() _listView.View = View.Details; _listView.Columns.Add("Column1"); - bool result = _listViewDesigner.TestAccessor().Dynamic.GetHitTest(new Point(10, 10)); + bool result = _listViewDesigner.TestAccessor.Dynamic.GetHitTest(new Point(10, 10)); result.Should().BeFalse(); } @@ -61,7 +61,7 @@ public void ListViewDesigner_GetHitTest_ReturnsFalse_WhenHeaderHandleIsNull() _listView.Columns.Add("Column1"); Point point = new(10, 5); - bool result = _listViewDesigner.TestAccessor().Dynamic.GetHitTest(point); + bool result = _listViewDesigner.TestAccessor.Dynamic.GetHitTest(point); result.Should().BeFalse(); } @@ -73,7 +73,7 @@ public void ListViewDesigner_GetHitTest_ReturnsFalse_WhenPointIsOutsideControl() _listView.Columns.Add("Column1"); Point outsidePoint = new(-10, -10); - bool result = _listViewDesigner.TestAccessor().Dynamic.GetHitTest(outsidePoint); + bool result = _listViewDesigner.TestAccessor.Dynamic.GetHitTest(outsidePoint); result.Should().BeFalse(); } diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ListViewGroupCollectionEditorTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ListViewGroupCollectionEditorTests.cs index 0675fdf8f06..dd917464330 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ListViewGroupCollectionEditorTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ListViewGroupCollectionEditorTests.cs @@ -20,7 +20,7 @@ public void Constructor_InitializesCollectionType() ListViewGroupCollectionEditor editor = new(expectedType); - Type actualType = editor.TestAccessor().Dynamic.CollectionType; + Type actualType = editor.TestAccessor.Dynamic.CollectionType; actualType.Should().Be(expectedType); } @@ -46,9 +46,9 @@ public void EditValue_SetsAndResetsEditValue() public void CreateInstance_CreatesListViewGroupWithUniqueName() { Mock mockCollection = new(new ListView()); - _mockEditor.Object.TestAccessor().Dynamic._editValue = mockCollection.Object; + _mockEditor.Object.TestAccessor.Dynamic._editValue = mockCollection.Object; - ListViewGroup? result = _mockEditor.Object.TestAccessor().Dynamic.CreateInstance(typeof(ListViewGroup)) as ListViewGroup; + ListViewGroup? result = _mockEditor.Object.TestAccessor.Dynamic.CreateInstance(typeof(ListViewGroup)) as ListViewGroup; result.Should().NotBeNull(); result?.Name.Should().BeOfType(); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/MaskDesignerDialogTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/MaskDesignerDialogTests.cs index 10048c4fbf1..27903a8202f 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/MaskDesignerDialogTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/MaskDesignerDialogTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -25,7 +25,7 @@ public void Dispose() [Fact] public void Constructor_ValidMaskedTextBox_UsesProvidedMaskedTextBox() { - using TextBox txtBoxMask = _dialog.TestAccessor().Dynamic._txtBoxMask; + using TextBox txtBoxMask = _dialog.TestAccessor.Dynamic._txtBoxMask; _dialog.Mask.Should().Be(_maskedTextBox.Mask); txtBoxMask.Text.Should().Be(_maskedTextBox.Mask); @@ -34,8 +34,8 @@ public void Constructor_ValidMaskedTextBox_UsesProvidedMaskedTextBox() [Fact] public void ValidatingTypeProperty_ShouldBeSetCorrectly() { - _dialog.TestAccessor().Dynamic._maskedTextBox.ValidatingType = typeof(DateTime); - _dialog.TestAccessor().Dynamic.btnOK_Click(null, EventArgs.Empty); + _dialog.TestAccessor.Dynamic._maskedTextBox.ValidatingType = typeof(DateTime); + _dialog.TestAccessor.Dynamic.btnOK_Click(null, EventArgs.Empty); _dialog.ValidatingType.Should().Be(typeof(DateTime)); } @@ -57,11 +57,11 @@ public void MaskDescriptorsEnumerator_ShouldReturnCorrectDescriptors() [Fact] public void DiscoverMaskDescriptors_ShouldHandleNullTypeDiscoveryService() { - List initialDescriptors = _dialog.TestAccessor().Dynamic._maskDescriptors; + List initialDescriptors = _dialog.TestAccessor.Dynamic._maskDescriptors; _dialog.DiscoverMaskDescriptors(null); - List maskDescriptors = _dialog.TestAccessor().Dynamic._maskDescriptors; + List maskDescriptors = _dialog.TestAccessor.Dynamic._maskDescriptors; maskDescriptors.Should().Equal(initialDescriptors); } @@ -78,7 +78,7 @@ public void DiscoverMaskDescriptors_ShouldHandleVariousDescriptorTypes(Type desc mockDiscoveryService.Setup(ds => ds.GetTypes(typeof(MaskDescriptor), false)).Returns(types); _dialog.DiscoverMaskDescriptors(mockDiscoveryService.Object); - List maskDescriptors = _dialog.TestAccessor().Dynamic._maskDescriptors; + List maskDescriptors = _dialog.TestAccessor.Dynamic._maskDescriptors; if (shouldBeAdded) { diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/MaskedTextBoxTextEditorDropDownTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/MaskedTextBoxTextEditorDropDownTests.cs index 91ab87b6e3e..617e9a797ba 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/MaskedTextBoxTextEditorDropDownTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/MaskedTextBoxTextEditorDropDownTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -10,7 +10,7 @@ public void Value_ReturnsNull_WhenCancelled() { using MaskedTextBox maskedTextBox = new(); using MaskedTextBoxTextEditorDropDown dropDown = new(maskedTextBox); - dropDown.TestAccessor().Dynamic._cancel = true; + dropDown.TestAccessor.Dynamic._cancel = true; dropDown.Value.Should().BeNull(); } @@ -21,7 +21,7 @@ public void Value_ReturnsText_WhenNotCancelled() using MaskedTextBox maskedTextBox = new("00000"); maskedTextBox.Text = "12345"; using MaskedTextBoxTextEditorDropDown dropDown = new(maskedTextBox); - dropDown.TestAccessor().Dynamic._cancel = false; + dropDown.TestAccessor.Dynamic._cancel = false; dropDown.Value.Should().Be("12345"); } @@ -31,8 +31,8 @@ public void ProcessDialogKey_SetsCancel_WhenEscapePressed() { using MaskedTextBox maskedTextBox = new(); using MaskedTextBoxTextEditorDropDown dropDown = new(maskedTextBox); - bool processDialogKey = dropDown.TestAccessor().Dynamic.ProcessDialogKey(Keys.Escape); - bool cancel = dropDown.TestAccessor().Dynamic._cancel; + bool processDialogKey = dropDown.TestAccessor.Dynamic.ProcessDialogKey(Keys.Escape); + bool cancel = dropDown.TestAccessor.Dynamic._cancel; cancel.Should().BeTrue(); processDialogKey.Should().BeFalse(); @@ -43,10 +43,10 @@ public void MaskInputRejected_SetsError_WhenInputRejected() { using MaskedTextBox maskedTextBox = new("00:00"); using MaskedTextBoxTextEditorDropDown dropDown = new(maskedTextBox); - using ErrorProvider errorProvider = dropDown.TestAccessor().Dynamic._errorProvider; + using ErrorProvider errorProvider = dropDown.TestAccessor.Dynamic._errorProvider; // No error when setting a correct format value. - using MaskedTextBox dropDownMaskedTextBox = dropDown.TestAccessor().Dynamic._cloneMtb; + using MaskedTextBox dropDownMaskedTextBox = dropDown.TestAccessor.Dynamic._cloneMtb; dropDownMaskedTextBox.Text = "12:20"; errorProvider.GetError(dropDownMaskedTextBox).Should().Be(string.Empty); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ParentControlDesignerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ParentControlDesignerTests.cs index b222377ec4c..aad54644c1f 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ParentControlDesignerTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ParentControlDesignerTests.cs @@ -5,7 +5,6 @@ using System.ComponentModel.Design; using System.Drawing; using System.Drawing.Design; -using System.Reflection; using System.Windows.Forms.Design.Behavior; using Moq; @@ -79,9 +78,9 @@ public void GetGlyphs_SelectionTypeSelected_AddsContainerSelectorGlyph() mockServiceProvider.Setup(sp => sp.GetService(typeof(BehaviorService))).Returns(() => behaviorService); mockSite.Setup(s => s.GetService(typeof(BehaviorService))).Returns(behaviorService); - _designer.TestAccessor().Dynamic._behaviorService = behaviorService; - _designer.TestAccessor().Dynamic._host = mockDesignerHost.Object; - _designer.TestAccessor().Dynamic._changeService = mockChangeService.Object; + _designer.TestAccessor.Dynamic._behaviorService = behaviorService; + _designer.TestAccessor.Dynamic._host = mockDesignerHost.Object; + _designer.TestAccessor.Dynamic._changeService = mockChangeService.Object; GlyphSelectionType selectionType = GlyphSelectionType.Selected; @@ -117,7 +116,7 @@ public void InitializeNewComponent_ShouldReparentControls_WhenAllowControlLassoI mockDesignerHost.Setup(h => h.GetDesigner(parentComponent)).Returns(_designer); _designer.Initialize(testComponent); - _designer.TestAccessor().Dynamic._changeService = mockChangeService.Object; + _designer.TestAccessor.Dynamic._changeService = mockChangeService.Object; Dictionary defaultValues = new() { @@ -174,14 +173,14 @@ public void CanAddComponent_ReturnsTrue() [Fact] public void EnableDragRect_ReturnsTrue() { - bool enableDragRect = _designer.TestAccessor().Dynamic.EnableDragRect; + bool enableDragRect = _designer.TestAccessor.Dynamic.EnableDragRect; enableDragRect.Should().BeTrue(); } [Fact] public void GridSize_DefaultValue_ReturnsExpected() { - Size gridSize = _designer.TestAccessor().Dynamic.GridSize; + Size gridSize = _designer.TestAccessor.Dynamic.GridSize; gridSize.Should().Be(new Size(8, 8)); } @@ -189,29 +188,27 @@ public void GridSize_DefaultValue_ReturnsExpected() public void GridSize_SetValue_UpdatesGridSize() { Size newSize = new Size(10, 10); - _designer.TestAccessor().Dynamic.GridSize = newSize; - Size gridSize = _designer.TestAccessor().Dynamic.GridSize; + _designer.TestAccessor.Dynamic.GridSize = newSize; + Size gridSize = _designer.TestAccessor.Dynamic.GridSize; gridSize.Should().Be(newSize); } [Fact] public void GridSize_SetValue_InvalidSize_ThrowsArgumentException() { - Action action = () => _designer.TestAccessor().Dynamic.GridSize = new Size(1, 1); - action.Should().Throw() - .WithInnerException() + Action action = () => _designer.TestAccessor.Dynamic.GridSize = new Size(1, 1); + action.Should().Throw() .WithMessage("*'GridSize'*"); - action = () => _designer.TestAccessor().Dynamic.GridSize = new Size(201, 201); - action.Should().Throw() - .WithInnerException() + action = () => _designer.TestAccessor.Dynamic.GridSize = new Size(201, 201); + action.Should().Throw() .WithMessage("*'GridSize'*"); } [Fact] public void MouseDragTool_DefaultValue_ReturnsNull() { - ToolboxItem mouseDragTool = _designer.TestAccessor().Dynamic.MouseDragTool; + ToolboxItem mouseDragTool = _designer.TestAccessor.Dynamic.MouseDragTool; mouseDragTool.Should().BeNull(); } @@ -219,8 +216,8 @@ public void MouseDragTool_DefaultValue_ReturnsNull() public void MouseDragTool_SetValue_ReturnsExpected() { ToolboxItem toolboxItem = new(typeof(Button)); - _designer.TestAccessor().Dynamic._mouseDragTool = toolboxItem; - ToolboxItem mouseDragTool = _designer.TestAccessor().Dynamic.MouseDragTool; + _designer.TestAccessor.Dynamic._mouseDragTool = toolboxItem; + ToolboxItem mouseDragTool = _designer.TestAccessor.Dynamic.MouseDragTool; mouseDragTool.Should().Be(toolboxItem); } @@ -228,7 +225,7 @@ public void MouseDragTool_SetValue_ReturnsExpected() public void GetParentForComponent_ReturnsControl() { Mock mockComponent = new(); - Control parentControl = _designer.TestAccessor().Dynamic.GetParentForComponent(mockComponent.Object); + Control parentControl = _designer.TestAccessor.Dynamic.GetParentForComponent(mockComponent.Object); parentControl.Should().Be(_control); } } diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/SelectionUIHandlerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/SelectionUIHandlerTests.cs index 19a7192549e..036556d453d 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/SelectionUIHandlerTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/SelectionUIHandlerTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -48,7 +48,7 @@ public void BeginDrag_ShouldReturnTrueAndInitializeDragState() result.Should().BeTrue(); - Control[] dragControls = _selectionUIHandlerMock.Object.TestAccessor().Dynamic._dragControls; + Control[] dragControls = _selectionUIHandlerMock.Object.TestAccessor.Dynamic._dragControls; dragControls.Should().NotBeNull(); dragControls.Should().HaveCount(1); @@ -66,7 +66,7 @@ public void DragMoved_ShouldUpdateDragOffset() _selectionUIHandlerMock.Object.DragMoved(components, offset); - Rectangle dragOffset = _selectionUIHandlerMock.Object.TestAccessor().Dynamic._dragOffset; + Rectangle dragOffset = _selectionUIHandlerMock.Object.TestAccessor.Dynamic._dragOffset; dragOffset.Should().Be(offset); } @@ -81,9 +81,9 @@ public void EndDrag_ShouldResetDragState() _selectionUIHandlerMock.Object.EndDrag(components, cancel: false); - Control[]? dragControls = _selectionUIHandlerMock.Object.TestAccessor().Dynamic._dragControls; - object? originalCoordinates = _selectionUIHandlerMock.Object.TestAccessor().Dynamic._originalCoordinates; - Rectangle dragOffset = _selectionUIHandlerMock.Object.TestAccessor().Dynamic._dragOffset; + Control[]? dragControls = _selectionUIHandlerMock.Object.TestAccessor.Dynamic._dragControls; + object? originalCoordinates = _selectionUIHandlerMock.Object.TestAccessor.Dynamic._originalCoordinates; + Rectangle dragOffset = _selectionUIHandlerMock.Object.TestAccessor.Dynamic._dragOffset; dragControls.Should().BeNull(); originalCoordinates.Should().BeNull(); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/SplitterPanelDesignerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/SplitterPanelDesignerTests.cs index 62e4fc286c4..8897bc8da91 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/SplitterPanelDesignerTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/SplitterPanelDesignerTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections; @@ -46,9 +46,9 @@ public void Initialize_CanBeParentedTo_ReturnsExpectedResults() splitterPanelDesigner.CanBeParentedTo(splitContainerDesigner).Should().Be(true); splitterPanelDesigner.CanBeParentedTo(toolStripContainerDesigner).Should().Be(false); - ((SplitterPanel)splitterPanelDesigner.TestAccessor().Dynamic._splitterPanel).Should().Be(splitterPanel); - ((IDesignerHost)splitterPanelDesigner.TestAccessor().Dynamic._designerHost).Should().Be(mockDesignerHost.Object); - ((SplitContainerDesigner)splitterPanelDesigner.TestAccessor().Dynamic._splitContainerDesigner).Should().Be(splitContainerDesigner); + ((SplitterPanel)splitterPanelDesigner.TestAccessor.Dynamic._splitterPanel).Should().Be(splitterPanel); + ((IDesignerHost)splitterPanelDesigner.TestAccessor.Dynamic._designerHost).Should().Be(mockDesignerHost.Object); + ((SplitContainerDesigner)splitterPanelDesigner.TestAccessor.Dynamic._splitContainerDesigner).Should().Be(splitContainerDesigner); IList snapLines = splitterPanelDesigner.SnapLines; snapLines.Should().NotBeNull(); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/StandardCommandToolStripMenuItemTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/StandardCommandToolStripMenuItemTests.cs index 99904ea56d2..e82a01d2cca 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/StandardCommandToolStripMenuItemTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/StandardCommandToolStripMenuItemTests.cs @@ -36,7 +36,7 @@ public StandardCommandToolStripMenuItemTests() public void Constructor_InitializesPropertiesCorrectly() { _item.MenuService?.FindCommand(_commandID)?.CommandID.Should().Be(_commandID); - string name = _item.TestAccessor().Dynamic._name; + string name = _item.TestAccessor.Dynamic._name; _item.Text.Should().Be("Test Text"); name.Should().BeSameAs("TestImage"); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/StandardMenuStripVerbTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/StandardMenuStripVerbTests.cs index d38ef325909..327844c1118 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/StandardMenuStripVerbTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/StandardMenuStripVerbTests.cs @@ -110,7 +110,7 @@ public void StandardMenuStripVerb_Ctor() { StandardMenuStripVerb standardMenuStripVerb = new(_designer); standardMenuStripVerb.Should().BeOfType(); - ToolStripDesigner toolStripDesigner = standardMenuStripVerb.TestAccessor().Dynamic._designer; + ToolStripDesigner toolStripDesigner = standardMenuStripVerb.TestAccessor.Dynamic._designer; toolStripDesigner.Should().Be(_designer); } @@ -139,8 +139,8 @@ public void Ctor_ThrowsIfComponentOrSiteIsNull() public void Ctor_AssignsHostAndChangeServiceIfAvailable() { StandardMenuStripVerb standardMenuStripVerb = new(_designer); - IDesignerHost host = standardMenuStripVerb.TestAccessor().Dynamic._host; - IComponentChangeService changeService = standardMenuStripVerb.TestAccessor().Dynamic._changeService; + IDesignerHost host = standardMenuStripVerb.TestAccessor.Dynamic._host; + IComponentChangeService changeService = standardMenuStripVerb.TestAccessor.Dynamic._changeService; host.Should().BeSameAs(_designerHostMock.Object); changeService.Should().BeSameAs(_componentChangeServiceMock.Object); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/TabControlDesignerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/TabControlDesignerTests.cs index 53952d928fd..b49ecfd42e3 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/TabControlDesignerTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/TabControlDesignerTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections; @@ -149,7 +149,7 @@ public void ParticipatesWithSnapLines_ReturnsTrueWhenForwardOnDragAndPageDesigne Mock pageDesignerMock = new(MockBehavior.Strict); pageDesignerMock.Setup(p => p.ParticipatesWithSnapLines).Returns(true); - designer.TestAccessor().Dynamic._forwardOnDrag = true; + designer.TestAccessor.Dynamic._forwardOnDrag = true; bool result = designer.ParticipatesWithSnapLines; @@ -168,7 +168,7 @@ public void ParticipatesWithSnapLines_ReturnsTrueWhenForwardOnDragAndPageDesigne Mock pageDesignerMock = new(MockBehavior.Strict); pageDesignerMock.Setup(p => p.ParticipatesWithSnapLines).Returns(false); - designer.TestAccessor().Dynamic._forwardOnDrag = true; + designer.TestAccessor.Dynamic._forwardOnDrag = true; bool result = designer.ParticipatesWithSnapLines; diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/TabOrderTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/TabOrderTests.cs index 6d507f89136..023038ce3c9 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/TabOrderTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/TabOrderTests.cs @@ -59,7 +59,7 @@ public void Dispose() [WinFormsFact] public void TabOrder_Constructor_InitializesFieldsCorrectly() { - dynamic accessor = _tabOrder.TestAccessor().Dynamic; + dynamic accessor = _tabOrder.TestAccessor.Dynamic; _tabOrder.Should().NotBeNull(); ((Font)accessor._tabFont).Should().Be(new Font(_dialogFont, FontStyle.Bold)); @@ -97,7 +97,7 @@ public void OnMouseDown_SetsNextTabIndex_WhenCtlHoverIsNotNull() _tabOrder.CreateControl(); _tabOrder.IsHandleCreated.Should().BeTrue(); - dynamic accessor = _tabOrder.TestAccessor().Dynamic; + dynamic accessor = _tabOrder.TestAccessor.Dynamic; accessor._ctlHover = ControlMock.Object; _tabOrder.OnMouseDown(ComponentMock.Object, MouseButtons.Left, 0, 0); @@ -122,7 +122,7 @@ public void OnMouseMove_SetsNewHoverControl() _tabOrder.IsHandleCreated.Should().BeTrue(); List tabControls = new() { ControlMock.Object }; - dynamic accessor = _tabOrder.TestAccessor().Dynamic; + dynamic accessor = _tabOrder.TestAccessor.Dynamic; accessor._tabControls = tabControls; _tabOrder.OnMouseMove(ComponentMock.Object, 10, 10); @@ -154,7 +154,7 @@ public void OnSetCursor_SetsAppropriateCursor() _tabOrder.CreateControl(); _tabOrder.IsHandleCreated.Should().BeTrue(); - dynamic accessor = _tabOrder.TestAccessor().Dynamic; + dynamic accessor = _tabOrder.TestAccessor.Dynamic; _tabOrder.OnSetCursor(ComponentMock.Object); @@ -173,7 +173,7 @@ public void OverrideInvoke_CommandExists_InvokesCommandAndReturnsTrue() CommandID commandID = new(Guid.NewGuid(), 1); MenuCommand menuCommand = new((sender, e) => { }, commandID); - dynamic accessor = _tabOrder.TestAccessor().Dynamic; + dynamic accessor = _tabOrder.TestAccessor.Dynamic; accessor._commands = new MenuCommand[] { menuCommand @@ -191,7 +191,7 @@ public void OverrideInvoke_CommandDoesNotExist_ReturnsFalse() CommandID commandID = new(Guid.NewGuid(), 1); Mock mockCommand = new(null!, commandID); - dynamic accessor = _tabOrder.TestAccessor().Dynamic; + dynamic accessor = _tabOrder.TestAccessor.Dynamic; accessor._commands = new MenuCommand[] { new MenuCommand((sender, e) => { }, new CommandID(Guid.NewGuid(), 2)) @@ -209,7 +209,7 @@ public void OverrideStatus_CommandDoesNotExist_DisablesCommandAndReturnsTrue() CommandID commandID = new(Guid.NewGuid(), 1); Mock mockCommand = new(null!, commandID); - dynamic accessor = _tabOrder.TestAccessor().Dynamic; + dynamic accessor = _tabOrder.TestAccessor.Dynamic; accessor._commands = new MenuCommand[] { new MenuCommand((sender, e) => { }, new CommandID(Guid.NewGuid(), 2)) { Enabled = true } @@ -227,7 +227,7 @@ public void OverrideStatus_TabOrderCommand_DisablesCommandAndReturnsTrue() CommandID commandID = StandardCommands.TabOrder; Mock mockCommand = new(null!, commandID); - dynamic accessor = _tabOrder.TestAccessor().Dynamic; + dynamic accessor = _tabOrder.TestAccessor.Dynamic; accessor._commands = new MenuCommand[] { new MenuCommand((sender, e) => { }, new CommandID(Guid.NewGuid(), 2)) { Enabled = true } diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/TableLayoutPanelDesignerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/TableLayoutPanelDesignerTests.cs index 34d121b7307..805a946e35d 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/TableLayoutPanelDesignerTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/TableLayoutPanelDesignerTests.cs @@ -54,7 +54,7 @@ public void ColumnCount_Property_Tests() Action columnCountAct = () => _designer.ColumnCount = 0; columnCountAct.Should().Throw(); - _designer.TestAccessor().Dynamic.Undoing = true; + _designer.TestAccessor.Dynamic.Undoing = true; _designer.ColumnCount = 0; _tableLayoutPanel.ColumnCount.Should().Be(0); } @@ -81,7 +81,7 @@ public void Verbs_Property_CheckVerbStatus() _tableLayoutPanel.ColumnCount = 1; _tableLayoutPanel.RowCount = 1; - _designer.TestAccessor().Dynamic.CheckVerbStatus(); + _designer.TestAccessor.Dynamic.CheckVerbStatus(); List verbs = _designer.Verbs.Cast().ToList(); verbs.Should().ContainSingle(v => v.Text == SR.TableLayoutPanelDesignerRemoveColumn && !v.Enabled); @@ -90,7 +90,7 @@ public void Verbs_Property_CheckVerbStatus() _tableLayoutPanel.ColumnCount = 2; _tableLayoutPanel.RowCount = 2; - _designer.TestAccessor().Dynamic.CheckVerbStatus(); + _designer.TestAccessor.Dynamic.CheckVerbStatus(); verbs = _designer.Verbs.Cast().ToList(); verbs.Should().ContainSingle(v => v.Text == SR.TableLayoutPanelDesignerRemoveColumn && v.Enabled); @@ -100,8 +100,8 @@ public void Verbs_Property_CheckVerbStatus() [Fact] public void ActionLists_Should_Be_Initialized_Correctly() { - _designer.TestAccessor().Dynamic._actionLists = null; - _designer.TestAccessor().Dynamic.BuildActionLists(); + _designer.TestAccessor.Dynamic._actionLists = null; + _designer.TestAccessor.Dynamic.BuildActionLists(); DesignerActionListCollection actionLists = _designer.ActionLists; @@ -144,13 +144,13 @@ public void Initialize_Should_Setup_Correctly() _tableLayoutPanel.ControlAdded += It.IsAny(); _tableLayoutPanel.ControlRemoved += It.IsAny(); - PropertyDescriptor rowStyleProp = (PropertyDescriptor)designer.TestAccessor().Dynamic._rowStyleProp; - PropertyDescriptor colStyleProp = (PropertyDescriptor)designer.TestAccessor().Dynamic._colStyleProp; + PropertyDescriptor rowStyleProp = (PropertyDescriptor)designer.TestAccessor.Dynamic._rowStyleProp; + PropertyDescriptor colStyleProp = (PropertyDescriptor)designer.TestAccessor.Dynamic._colStyleProp; rowStyleProp.Should().NotBeNull(); colStyleProp.Should().NotBeNull(); - InheritanceAttribute inheritanceAttribute = _designer.TestAccessor().Dynamic.InheritanceAttribute; + InheritanceAttribute inheritanceAttribute = _designer.TestAccessor.Dynamic.InheritanceAttribute; if (inheritanceAttribute == InheritanceAttribute.InheritedReadOnly) { diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripActionListTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripActionListTests.cs index bf962adc5db..5a1a359ca6a 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripActionListTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripActionListTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -151,7 +151,7 @@ public void GetSortedActionItems_ShouldNotIncludeGripStyle_WhenToolStripIsStatus Site = _toolStrip.Site }; _designer.Initialize(statusStrip); - _actionList.TestAccessor().Dynamic._toolStrip = statusStrip; + _actionList.TestAccessor.Dynamic._toolStrip = statusStrip; var (_, propertyItems) = GetSortedActionItems(); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripCollectionEditorTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripCollectionEditorTests.cs index f0b5ae8bede..f34a81c3781 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripCollectionEditorTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripCollectionEditorTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -18,14 +18,14 @@ public ToolStripCollectionEditorTests() [Fact] public void ToolStripCollectionEditor_CreateCollectionForm_DoesNotThrowException() { - Action act = () => _editor.TestAccessor().Dynamic.CreateCollectionForm(); + Action act = () => _editor.TestAccessor.Dynamic.CreateCollectionForm(); act.Should().NotThrow(); } [Fact] public void ToolStripCollectionEditor_HelpTopic_ReturnsExpectedValue() { - string helpTopic = _editor.TestAccessor().Dynamic.HelpTopic; + string helpTopic = _editor.TestAccessor.Dynamic.HelpTopic; helpTopic.Should().Be("net.ComponentModel.ToolStripCollectionEditor"); } diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripCustomTypeDescriptorTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripCustomTypeDescriptorTests.cs index 2861b9d8214..b1f6b939b16 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripCustomTypeDescriptorTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripCustomTypeDescriptorTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -21,7 +21,7 @@ public ToolStripCustomTypeDescriptorTests() [Fact] public void Constructor_InitializesInstance() { - ToolStrip instance = _descriptor.TestAccessor().Dynamic._instance; + ToolStrip instance = _descriptor.TestAccessor.Dynamic._instance; instance.Should().Be(_toolStrip); } diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripEditorManagerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripEditorManagerTests.cs index 7083a483ee3..04b0b3ce6b6 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripEditorManagerTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripEditorManagerTests.cs @@ -66,10 +66,10 @@ public void Constructor_InitializesBehaviorServiceAndDesignerHost() { _editorManager.Should().BeOfType(); - BehaviorService? behaviorService = _editorManager.TestAccessor().Dynamic._behaviorService; + BehaviorService? behaviorService = _editorManager.TestAccessor.Dynamic._behaviorService; behaviorService.Should().Be(_behaviorService); - IDesignerHost? designerHost = _editorManager.TestAccessor().Dynamic._designerHost; + IDesignerHost? designerHost = _editorManager.TestAccessor.Dynamic._designerHost; designerHost.Should().Be(_mockDesignerHost.Object); } @@ -83,38 +83,38 @@ public void ActivateEditor_ShouldNotAddNewEditor_WhenItemIsNull() [WinFormsFact] public void ActivateEditor_ShouldReturn_WhenItemIsSameAsCurrentItem() { - _editorManager.TestAccessor().Dynamic._behaviorService = _behaviorService; - _editorManager.TestAccessor().Dynamic._currentItem = _toolStripItem; + _editorManager.TestAccessor.Dynamic._behaviorService = _behaviorService; + _editorManager.TestAccessor.Dynamic._currentItem = _toolStripItem; Action action = () => _editorManager.ActivateEditor(_toolStripItem); action.Should().NotThrow(); - ToolStripItem currentItem = _editorManager.TestAccessor().Dynamic._currentItem; + ToolStripItem currentItem = _editorManager.TestAccessor.Dynamic._currentItem; currentItem.Should().Be(_toolStripItem); } [WinFormsFact] public void ActivateEditor_ShouldDeactivateCurrentEditor_WhenEditorIsNotNull() { - _editorManager.TestAccessor().Dynamic._behaviorService = _behaviorService; - _editorManager.TestAccessor().Dynamic._editor = _toolStripEditorControl; - _editorManager.TestAccessor().Dynamic._itemDesigner = new Mock().Object; - _editorManager.TestAccessor().Dynamic._currentItem = new ToolStripButton(); + _editorManager.TestAccessor.Dynamic._behaviorService = _behaviorService; + _editorManager.TestAccessor.Dynamic._editor = _toolStripEditorControl; + _editorManager.TestAccessor.Dynamic._itemDesigner = new Mock().Object; + _editorManager.TestAccessor.Dynamic._currentItem = new ToolStripButton(); _editorManager.ActivateEditor(null); _behaviorService.AdornerWindowControl.Controls.Cast().Should().NotContain((Control)_toolStripEditorControl); - ToolStripTemplateNode editorUI = _editorManager.TestAccessor().Dynamic._editorUI; + ToolStripTemplateNode editorUI = _editorManager.TestAccessor.Dynamic._editorUI; editorUI.Should().BeNull(); - object? editor = _editorManager.TestAccessor().Dynamic._editor; + object? editor = _editorManager.TestAccessor.Dynamic._editor; editor.Should().BeNull(); - ToolStripItem currentItem = _editorManager.TestAccessor().Dynamic._currentItem; + ToolStripItem currentItem = _editorManager.TestAccessor.Dynamic._currentItem; currentItem.Should().BeNull(); - bool? isEditorActive = _editorManager.TestAccessor().Dynamic._itemDesigner.IsEditorActive; + bool? isEditorActive = _editorManager.TestAccessor.Dynamic._itemDesigner.IsEditorActive; isEditorActive.Should().BeFalse(); } @@ -141,13 +141,13 @@ public void ActivateEditor_ShouldAddNewEditor_WhenItemIsNotNull() _editorManager.ActivateEditor(_toolStripItem); - ToolStripItem currentItem = _editorManager.TestAccessor().Dynamic._currentItem; + ToolStripItem currentItem = _editorManager.TestAccessor.Dynamic._currentItem; currentItem.Should().Be(_toolStripItem); - ToolStripTemplateNode editorUI = _editorManager.TestAccessor().Dynamic._editorUI; + ToolStripTemplateNode editorUI = _editorManager.TestAccessor.Dynamic._editorUI; editorUI.Should().Be(mockToolStripTemplateNode.Object); - ToolStripItemDesigner itemDesigner = _editorManager.TestAccessor().Dynamic._itemDesigner; + ToolStripItemDesigner itemDesigner = _editorManager.TestAccessor.Dynamic._itemDesigner; itemDesigner.Should().Be(mockToolStripItemDesigner.Object); _mockDesignerHost.Verify(dh => dh.GetDesigner(_toolStripItem), Times.Once); @@ -164,10 +164,10 @@ public void CloseManager_ShouldNotThrowException() [WinFormsFact] public void OnEditorResize_ShouldInvalidateAndUpdateBounds() { - _editorManager.TestAccessor().Dynamic._editor = _toolStripEditorControl; - _editorManager.TestAccessor().Dynamic.OnEditorResize(_editorManager, EventArgs.Empty); + _editorManager.TestAccessor.Dynamic._editor = _toolStripEditorControl; + _editorManager.TestAccessor.Dynamic.OnEditorResize(_editorManager, EventArgs.Empty); - Rectangle _editorManagerBounds = _editorManager.TestAccessor().Dynamic._lastKnownEditorBounds; + Rectangle _editorManagerBounds = _editorManager.TestAccessor.Dynamic._lastKnownEditorBounds; _editorManagerBounds.X.Should().Be(_bounds.X); _editorManagerBounds.Y.Should().Be(_bounds.Y); } @@ -184,7 +184,7 @@ public void ToolStripEditorControl_Constructor_InitializesProperties() private void VerifyProperty(string propertyName, object targetObject, T expectedValue) { - PropertyInfo? propertyInfo = targetObject.TestAccessor().Dynamic.GetType().GetProperty(propertyName); + PropertyInfo? propertyInfo = targetObject.TestAccessor.Dynamic.GetType().GetProperty(propertyName); object? propertyValue = propertyInfo?.GetValue(targetObject); propertyValue?.Should().Be(expectedValue); } diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripInSituServiceTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripInSituServiceTests.cs index 5158943da36..b555ecae779 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripInSituServiceTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripInSituServiceTests.cs @@ -35,9 +35,9 @@ public ToolStripInSituServiceTests() _mockServiceProvider.Setup(sp => sp.GetService(typeof(ToolStripKeyboardHandlingService))).Returns(_mockToolStripKeyboardHandlingService.Object); _inSituService = new(_mockServiceProvider.Object); - _inSituService.TestAccessor().Dynamic._toolDesigner = _mockToolStripDesigner.Object; - _inSituService.TestAccessor().Dynamic._toolItemDesigner = _mockToolStripItemDesigner.Object; - _inSituService.TestAccessor().Dynamic._componentChangeService = _mockComponentChangeService.Object; + _inSituService.TestAccessor.Dynamic._toolDesigner = _mockToolStripDesigner.Object; + _inSituService.TestAccessor.Dynamic._toolItemDesigner = _mockToolStripItemDesigner.Object; + _inSituService.TestAccessor.Dynamic._componentChangeService = _mockComponentChangeService.Object; } public void Dispose() @@ -51,46 +51,46 @@ public void Dispose() [Fact] public void Dispose_DisposesToolDesigner() { - object toolDesignerValue = _inSituService.TestAccessor().Dynamic._toolDesigner; + object toolDesignerValue = _inSituService.TestAccessor.Dynamic._toolDesigner; toolDesignerValue.Should().NotBeNull(); _inSituService.Dispose(); _isInSituServiceDisposed = true; - toolDesignerValue = _inSituService.TestAccessor().Dynamic._toolDesigner; + toolDesignerValue = _inSituService.TestAccessor.Dynamic._toolDesigner; toolDesignerValue.Should().BeNull(); } [Fact] public void Dispose_DisposesToolItemDesigner() { - object toolItemDesignerValue = _inSituService.TestAccessor().Dynamic._toolItemDesigner; + object toolItemDesignerValue = _inSituService.TestAccessor.Dynamic._toolItemDesigner; toolItemDesignerValue.Should().NotBeNull(); _inSituService.Dispose(); _isInSituServiceDisposed = true; - toolItemDesignerValue = _inSituService.TestAccessor().Dynamic._toolItemDesigner; + toolItemDesignerValue = _inSituService.TestAccessor.Dynamic._toolItemDesigner; toolItemDesignerValue.Should().BeNull(); } [Fact] public void Dispose_UnsubscribesFromComponentChangeService() { - object componentChangeServiceValue = _inSituService.TestAccessor().Dynamic._componentChangeService; + object componentChangeServiceValue = _inSituService.TestAccessor.Dynamic._componentChangeService; componentChangeServiceValue.Should().NotBeNull(); _inSituService.Dispose(); _isInSituServiceDisposed = true; - componentChangeServiceValue = _inSituService.TestAccessor().Dynamic._componentChangeService; + componentChangeServiceValue = _inSituService.TestAccessor.Dynamic._componentChangeService; componentChangeServiceValue.Should().BeNull(); } [Fact] public void ToolStripKeyBoardService_ReturnsServiceInstance() { - object toolStripKeyBoardService = _inSituService.TestAccessor().Dynamic.ToolStripKeyBoardService; + object toolStripKeyBoardService = _inSituService.TestAccessor.Dynamic.ToolStripKeyBoardService; toolStripKeyBoardService.Should().BeAssignableTo(); toolStripKeyBoardService.Should().Be(_mockToolStripKeyboardHandlingService.Object); @@ -114,7 +114,7 @@ public void OnComponentRemoved_RemovesService_WhenNoToolStripPresent() _mockServiceProvider.Setup(sp => sp.GetService(typeof(ISupportInSituService))).Returns(_inSituService); using Component component = new(); - _inSituService.TestAccessor().Dynamic.OnComponentRemoved(null, new ComponentEventArgs(component)); + _inSituService.TestAccessor.Dynamic.OnComponentRemoved(null, new ComponentEventArgs(component)); _mockDesignerHost.Verify(dh => dh.RemoveService(typeof(ISupportInSituService)), Times.Once); } @@ -131,7 +131,7 @@ public void OnComponentRemoved_DoesNotRemoveService_WhenToolStripPresent() _mockServiceProvider.Setup(sp => sp.GetService(typeof(ISupportInSituService))).Returns(_inSituService); using Component component = new(); - _inSituService.TestAccessor().Dynamic.OnComponentRemoved(null, new ComponentEventArgs(component)); + _inSituService.TestAccessor.Dynamic.OnComponentRemoved(null, new ComponentEventArgs(component)); _mockDesignerHost.Verify(dh => dh.RemoveService(typeof(ISupportInSituService)), Times.Never); } @@ -155,7 +155,7 @@ public void IgnoreMessages_ReturnsFalse_WhenDesignerHostIsNull() [Fact] public void IgnoreMessages_WhenPrimarySelectionIsNotIComponentAndSelectedDesignerControlIsNull_ReturnsFalse() { - _inSituService.TestAccessor().Dynamic._toolDesigner = _mockToolStripDesigner.Object; + _inSituService.TestAccessor.Dynamic._toolDesigner = _mockToolStripDesigner.Object; bool result = _inSituService.IgnoreMessages; result.Should().BeFalse(); } @@ -185,7 +185,7 @@ public void IgnoreMessages_WhenComponentIsToolStripMenuItem_ReturnsTrue() [Fact] public void HandleKeyChar_WhenToolItemDesignerIsNotMenuDesigner_CallsShowEditNode() { - _inSituService.TestAccessor().Dynamic._toolDesigner = null; + _inSituService.TestAccessor.Dynamic._toolDesigner = null; _inSituService.HandleKeyChar(); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripMenuItemCodeDomSerializerTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripMenuItemCodeDomSerializerTests.cs index 475b2e1fbb5..b230eb1ba13 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripMenuItemCodeDomSerializerTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ToolStripMenuItemCodeDomSerializerTests.cs @@ -43,7 +43,7 @@ public void Serialize_DoesNotSerializeDummyItem() using ToolStripMenuItem dummyItem = new(); Mock mockParent = new(); mockParent.Setup(p => p.Site).Returns((ISite?)null); - dummyItem.TestAccessor().Dynamic.Parent = mockParent.Object; + dummyItem.TestAccessor.Dynamic.Parent = mockParent.Object; object? result = _serializer.Serialize(_mockManager.Object, dummyItem); diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/TreeNodeCollectionEditorTests.cs b/src/System.Windows.Forms.Design/tests/UnitTests/TreeNodeCollectionEditorTests.cs index 8ceeae7d0cd..4b5b9fff91e 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/TreeNodeCollectionEditorTests.cs +++ b/src/System.Windows.Forms.Design/tests/UnitTests/TreeNodeCollectionEditorTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. #nullable disable @@ -20,7 +20,7 @@ public void TreeNodeCollectionEditor_Property_HelpTopic() { Type type = typeof(TreeNode); TreeNodeCollectionEditor collectionEditor = new(type); - string helpTopic = collectionEditor.TestAccessor().Dynamic.HelpTopic; + string helpTopic = collectionEditor.TestAccessor.Dynamic.HelpTopic; helpTopic.Should().Be("net.ComponentModel.TreeNodeCollectionEditor"); } @@ -32,7 +32,7 @@ public void TreeNodeCollectionEditor_CreateCollectionForm_returnExpectedValue() Form colletionForm; using (new NoAssertContext()) { - colletionForm = collectionEditor.TestAccessor().Dynamic.CreateCollectionForm(); + colletionForm = collectionEditor.TestAccessor.Dynamic.CreateCollectionForm(); } colletionForm.Should().NotBeNull(); diff --git a/src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/Automation/TestAccessors.UiaTextRangeTestAccessor.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/Automation/TestAccessors.UiaTextRangeTestAccessor.cs index 69bc731e676..1e701b3ff38 100644 --- a/src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/Automation/TestAccessors.UiaTextRangeTestAccessor.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/Automation/TestAccessors.UiaTextRangeTestAccessor.cs @@ -10,7 +10,7 @@ public static partial class TestAccessors internal class UiaTextRangeTestAccessor : TestAccessor { // Accessor for static members - private static readonly dynamic s_static = typeof(UiaTextRange).TestAccessor().Dynamic; + private static readonly dynamic s_static = typeof(UiaTextRange).TestAccessor.Dynamic; public UiaTextRangeTestAccessor(UiaTextRange instance) : base(instance) { } @@ -63,6 +63,8 @@ public HorizontalTextAlignment GetHorizontalTextAlignment(WINDOW_STYLE windowSty public TextDecorationLineStyle GetUnderlineStyle(LOGFONTW logfont) => (TextDecorationLineStyle)s_static.GetUnderlineStyle(logfont); } - internal static UiaTextRangeTestAccessor TestAccessor(this UiaTextRange textRange) - => new(textRange); + extension(UiaTextRange textRange) + { + internal UiaTextRangeTestAccessor TestAccessor => new(textRange); + } } diff --git a/src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/Automation/UiaTextRangeTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/Automation/UiaTextRangeTests.cs index 054767eceb5..9a7c45898a7 100644 --- a/src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/Automation/UiaTextRangeTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/Automation/UiaTextRangeTests.cs @@ -32,7 +32,7 @@ public void UiaTextRange_Constructor_InitializesProvider_And_CorrectEndpoints(in Assert.True(((ITextRangeProvider.Interface)textRange).GetEnclosingElement(elementProviderScope).Succeeded); Assert.Equal(enclosingElement, ComHelpers.GetObjectForIUnknown(elementProviderScope)); - object actual = textRange.TestAccessor()._provider; + object actual = textRange.TestAccessor._provider; Assert.Equal(provider, actual); } @@ -156,7 +156,7 @@ public void UiaTextRange_Length_ReturnsCorrectValue_IfIncorrectStartEnd(int star UiaTextProvider provider = new Mock(MockBehavior.Strict).Object; UiaTextRange textRange = new(enclosingElement, provider, 3, 10); - var testAccessor = textRange.TestAccessor(); + var testAccessor = textRange.TestAccessor; testAccessor._start = start; testAccessor._end = end; @@ -173,7 +173,7 @@ public void UiaTextRange_Start_Get_ReturnsCorrectValue(int start) UiaTextProvider provider = new Mock(MockBehavior.Strict).Object; UiaTextRange textRange = new(enclosingElement, provider, start: 0, end: 0); - textRange.TestAccessor()._start = start; + textRange.TestAccessor._start = start; Assert.Equal(start, textRange.Start); } @@ -1079,7 +1079,7 @@ public void UiaTextRange_ITextRangeProvider_GetChildren_ReturnsCorrectValue() [InlineData("1d??sf'21gj", 6, false)] public void UiaTextRange_private_AtParagraphBoundary_ReturnsCorrectValue(string text, int index, bool expected) { - bool actual = StaticNullTextRange.TestAccessor().AtParagraphBoundary(text, index); + bool actual = StaticNullTextRange.TestAccessor.AtParagraphBoundary(text, index); Assert.Equal(expected, actual); } @@ -1100,7 +1100,7 @@ public void UiaTextRange_private_AtParagraphBoundary_ReturnsCorrectValue(string [InlineData("1d??sf'21gj", 6, false)] public void UiaTextRange_private_AtWordBoundary_ReturnsCorrectValue(string text, int index, bool expected) { - bool actual = StaticNullTextRange.TestAccessor().AtWordBoundary(text, index); + bool actual = StaticNullTextRange.TestAccessor.AtWordBoundary(text, index); Assert.Equal(expected, actual); } @@ -1111,7 +1111,7 @@ public void UiaTextRange_private_AtWordBoundary_ReturnsCorrectValue(string text, [InlineData('t', false)] public void UiaTextRange_private_IsApostrophe_ReturnsCorrectValue(char ch, bool expected) { - bool actual = StaticNullTextRange.TestAccessor().IsApostrophe(ch); + bool actual = StaticNullTextRange.TestAccessor.IsApostrophe(ch); Assert.Equal(expected, actual); } @@ -1125,7 +1125,7 @@ public void UiaTextRange_private_GetHorizontalTextAlignment_ReturnsCorrectValue( UiaTextProvider provider = new Mock(MockBehavior.Strict).Object; UiaTextRange textRange = new(enclosingElement, provider, 0, 0); - HorizontalTextAlignment actual = textRange.TestAccessor().GetHorizontalTextAlignment((WINDOW_STYLE)style); + HorizontalTextAlignment actual = textRange.TestAccessor.GetHorizontalTextAlignment((WINDOW_STYLE)style); Assert.Equal((HorizontalTextAlignment)expected, actual); } @@ -1139,7 +1139,7 @@ public void UiaTextRange_private_GetCapStyle_ReturnsExpectedValue(int editStyle, UiaTextProvider provider = new Mock(MockBehavior.Strict).Object; UiaTextRange textRange = new(enclosingElement, provider, 0, 0); - CapStyle actual = textRange.TestAccessor().GetCapStyle((WINDOW_STYLE)editStyle); + CapStyle actual = textRange.TestAccessor.GetCapStyle((WINDOW_STYLE)editStyle); Assert.Equal((CapStyle)expected, actual); } @@ -1155,7 +1155,7 @@ public void UiaTextRange_private_GetReadOnly_ReturnsCorrectValue(bool readOnly) UiaTextProvider provider = providerMock.Object; UiaTextRange textRange = new(enclosingElement, provider, 0, 0); - bool actual = textRange.TestAccessor().GetReadOnly(); + bool actual = textRange.TestAccessor.GetReadOnly(); Assert.Equal(readOnly, actual); } @@ -1163,7 +1163,7 @@ public void UiaTextRange_private_GetReadOnly_ReturnsCorrectValue(bool readOnly) [StaFact] public void UiaTextRange_private_GetBackgroundColor_ReturnsExpectedValue() { - COLORREF actual = StaticNullTextRange.TestAccessor().GetBackgroundColor(); + COLORREF actual = StaticNullTextRange.TestAccessor.GetBackgroundColor(); uint expected = 0x00ffffff; // WINDOW system color Assert.Equal(expected, actual); } @@ -1180,7 +1180,7 @@ public void UiaTextRange_private_GetFontName_ReturnsExpectedValue(string? faceNa FaceName = faceName }; - string actual = StaticNullTextRange.TestAccessor().GetFontName(logfont); + string actual = StaticNullTextRange.TestAccessor.GetFontName(logfont); Assert.Equal(faceName ?? "", actual); } @@ -1202,7 +1202,7 @@ public void UiaTextRange_private_GetFontSize_ReturnsCorrectValue(float fontSize, UiaTextProvider provider = providerMock.Object; UiaTextRange textRange = new(enclosingElement, provider, 5, 20); - double actual = textRange.TestAccessor().GetFontSize(provider.Logfont); + double actual = textRange.TestAccessor.GetFontSize(provider.Logfont); Assert.Equal(expected, actual); } @@ -1221,14 +1221,14 @@ public void UiaTextRange_private_GetFontSize_ReturnsCorrectValue(float fontSize, public void UiaTextRange_private_GetFontWeight_ReturnsCorrectValue(object fontWeight) { LOGFONTW logfont = new() { lfWeight = (int)fontWeight }; - FW actual = StaticNullTextRange.TestAccessor().GetFontWeight(logfont); + FW actual = StaticNullTextRange.TestAccessor.GetFontWeight(logfont); Assert.Equal(fontWeight, actual); } [StaFact] public void UiaTextRange_private_GetForegroundColor_ReturnsCorrectValue() { - COLORREF actual = StaticNullTextRange.TestAccessor().GetForegroundColor(); + COLORREF actual = StaticNullTextRange.TestAccessor.GetForegroundColor(); Assert.Equal(default, actual); } @@ -1239,7 +1239,7 @@ public void UiaTextRange_private_GetItalic_ReturnsCorrectValue(byte ifItalic, bo { LOGFONTW logfont = new() { lfItalic = ifItalic }; - bool actual = StaticNullTextRange.TestAccessor().GetItalic(logfont); + bool actual = StaticNullTextRange.TestAccessor.GetItalic(logfont); Assert.Equal(expected, actual); } @@ -1250,7 +1250,7 @@ public void UiaTextRange_private_GetItalic_ReturnsCorrectValue(byte ifItalic, bo public void UiaTextRange_private_GetStrikethroughStyle_ReturnsCorrectValue(byte ifStrikeOut, int expected) { LOGFONTW logfont = new() { lfStrikeOut = ifStrikeOut }; - TextDecorationLineStyle actual = StaticNullTextRange.TestAccessor().GetStrikethroughStyle(logfont); + TextDecorationLineStyle actual = StaticNullTextRange.TestAccessor.GetStrikethroughStyle(logfont); Assert.Equal((TextDecorationLineStyle)expected, actual); } @@ -1261,7 +1261,7 @@ public void UiaTextRange_private_GetStrikethroughStyle_ReturnsCorrectValue(byte public void UiaTextRange_private_GetUnderlineStyle_ReturnsCorrectValue(byte ifUnderline, int expected) { LOGFONTW logfont = new() { lfUnderline = ifUnderline }; - TextDecorationLineStyle actual = StaticNullTextRange.TestAccessor().GetUnderlineStyle(logfont); + TextDecorationLineStyle actual = StaticNullTextRange.TestAccessor.GetUnderlineStyle(logfont); Assert.Equal((TextDecorationLineStyle)expected, actual); } @@ -1279,7 +1279,7 @@ public void UiaTextRange_private_MoveTo_SetValuesCorrectly(int start, int end) UiaTextProvider provider = new Mock(MockBehavior.Strict).Object; UiaTextRange textRange = new(enclosingElement, provider, 0, 0); - textRange.TestAccessor().MoveTo(start, end); + textRange.TestAccessor.MoveTo(start, end); Assert.Equal(start, textRange.Start); Assert.Equal(end, textRange.End); @@ -1296,7 +1296,7 @@ public void UiaTextRange_private_MoveTo_ThrowsException_IfIncorrectParameters(in UiaTextProvider provider = new Mock(MockBehavior.Strict).Object; UiaTextRange textRange = new(enclosingElement, provider, 0, 0); - Assert.ThrowsAny(() => textRange.TestAccessor().MoveTo(start, end)); + Assert.ThrowsAny(() => textRange.TestAccessor.MoveTo(start, end)); } [StaTheory] @@ -1315,7 +1315,7 @@ public void UiaTextRange_private_ValidateEndpoints_SetValuesCorrectly(int start, UiaTextProvider provider = providerMock.Object; UiaTextRange textRange = new(enclosingElement, provider, start, end); - textRange.TestAccessor().ValidateEndpoints(); + textRange.TestAccessor.ValidateEndpoints(); Assert.Equal(expectedStart, textRange.Start); Assert.Equal(expectedEnd, textRange.End); diff --git a/src/test/integration/UIIntegrationTests/DataGridViewTests.cs b/src/test/integration/UIIntegrationTests/DataGridViewTests.cs index 14e68a1048b..8af569de01e 100644 --- a/src/test/integration/UIIntegrationTests/DataGridViewTests.cs +++ b/src/test/integration/UIIntegrationTests/DataGridViewTests.cs @@ -115,7 +115,7 @@ await InputSimulator.SendAsync( inputSimulator => inputSimulator.Mouse.MoveMouseTo(targetPoint.X, targetPoint.Y).Sleep(TimeSpan.FromMilliseconds(1000))); // DataGridViewToolTip is private so use the reflection - object toolTip = dataGridView.TestAccessor().Dynamic._toolTipControl; + object toolTip = dataGridView.TestAccessor.Dynamic._toolTipControl; object? actual = toolTip.GetType().GetProperty("Activated")?.GetValue(toolTip); Assert.Equal(expected, actual); diff --git a/src/test/integration/UIIntegrationTests/Dpi/FormDpiTests.cs b/src/test/integration/UIIntegrationTests/Dpi/FormDpiTests.cs index 03d3d834608..14dd28e8c1d 100644 --- a/src/test/integration/UIIntegrationTests/Dpi/FormDpiTests.cs +++ b/src/test/integration/UIIntegrationTests/Dpi/FormDpiTests.cs @@ -23,7 +23,7 @@ public void Form_DpiChanged_Bounds(int newDpi) } DPI_AWARENESS_CONTEXT originalAwarenessContext = PInvoke.SetThreadDpiAwarenessContextInternal(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); - typeof(ScaleHelper).TestAccessor().Dynamic.InitializeStatics(); + typeof(ScaleHelper).TestAccessor.Dynamic.InitializeStatics(); try { using Form form = new(); @@ -60,7 +60,7 @@ public void Form_DpiChanged_MinMaxSizeNotChanged_Default(int newDpi) } DPI_AWARENESS_CONTEXT originalAwarenessContext = PInvoke.SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); - typeof(ScaleHelper).TestAccessor().Dynamic.InitializeStatics(); + typeof(ScaleHelper).TestAccessor.Dynamic.InitializeStatics(); try { var minSize = new Drawing.Size(100, 100); @@ -94,7 +94,7 @@ public void Form_DpiChanged_MinMaxSizeChanged_WithRuntimeSetting(int newDpi) } DPI_AWARENESS_CONTEXT originalAwarenessContext = PInvoke.SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); - typeof(ScaleHelper).TestAccessor().Dynamic.InitializeStatics(); + typeof(ScaleHelper).TestAccessor.Dynamic.InitializeStatics(); try { var minSize = new Drawing.Size(100, 100); @@ -130,7 +130,7 @@ public void Form_DpiChanged_NonLinear_DesiredSize(int newDpi) } DPI_AWARENESS_CONTEXT originalAwarenessContext = PInvoke.SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); - typeof(ScaleHelper).TestAccessor().Dynamic.InitializeStatics(); + typeof(ScaleHelper).TestAccessor.Dynamic.InitializeStatics(); try { using Form form = new(); @@ -166,7 +166,7 @@ public void Form_DpiChanged_FormCacheSize(int newDpi) } DPI_AWARENESS_CONTEXT originalAwarenessContext = PInvoke.SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); - typeof(ScaleHelper).TestAccessor().Dynamic.InitializeStatics(); + typeof(ScaleHelper).TestAccessor.Dynamic.InitializeStatics(); try { using Form form = new(); @@ -175,7 +175,7 @@ public void Form_DpiChanged_FormCacheSize(int newDpi) DpiMessageHelper.TriggerDpiMessage(PInvokeCore.WM_DPICHANGED, form, newDpi); - dynamic fomrTestAccessor = form.TestAccessor().Dynamic; + dynamic fomrTestAccessor = form.TestAccessor.Dynamic; Assert.NotNull(fomrTestAccessor._dpiFormSizes); Assert.Equal(2, fomrTestAccessor._dpiFormSizes.Count); form.Close(); @@ -198,7 +198,7 @@ public void Form_DpiChanged_AutoScaleMode_Dpi_FormDoesNotCacheSize(int newDpi) } DPI_AWARENESS_CONTEXT originalAwarenessContext = PInvoke.SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); - typeof(ScaleHelper).TestAccessor().Dynamic.InitializeStatics(); + typeof(ScaleHelper).TestAccessor.Dynamic.InitializeStatics(); try { using Form form = new(); @@ -206,7 +206,7 @@ public void Form_DpiChanged_AutoScaleMode_Dpi_FormDoesNotCacheSize(int newDpi) form.Show(); DpiMessageHelper.TriggerDpiMessage(PInvokeCore.WM_DPICHANGED, form, newDpi); - Assert.Null(form.TestAccessor().Dynamic._dpiFormSizes); + Assert.Null(form.TestAccessor.Dynamic._dpiFormSizes); form.Close(); } finally @@ -226,14 +226,14 @@ public void Form_SizeNotCached_SystemAwareMode() } DPI_AWARENESS_CONTEXT originalAwarenessContext = PInvoke.SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_SYSTEM_AWARE); - typeof(ScaleHelper).TestAccessor().Dynamic.InitializeStatics(); + typeof(ScaleHelper).TestAccessor.Dynamic.InitializeStatics(); try { using Form form = new(); form.AutoScaleMode = AutoScaleMode.Font; form.Show(); - Assert.Null(form.TestAccessor().Dynamic._dpiFormSizes); + Assert.Null(form.TestAccessor.Dynamic._dpiFormSizes); form.Close(); } finally diff --git a/src/test/integration/UIIntegrationTests/Dpi/SplitContainerTests.cs b/src/test/integration/UIIntegrationTests/Dpi/SplitContainerTests.cs index 13f70649c58..38576f3fd99 100644 --- a/src/test/integration/UIIntegrationTests/Dpi/SplitContainerTests.cs +++ b/src/test/integration/UIIntegrationTests/Dpi/SplitContainerTests.cs @@ -38,7 +38,7 @@ public void SplitContainer_Properties_HorizontalSplitter_Scaling(int newDpi) DPI_AWARENESS_CONTEXT originalAwarenessContext = PInvoke.SetThreadDpiAwarenessContextInternal(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); - typeof(ScaleHelper).TestAccessor().Dynamic.InitializeStatics(); + typeof(ScaleHelper).TestAccessor.Dynamic.InitializeStatics(); try { using Form form = new(); diff --git a/src/test/integration/UIIntegrationTests/Dpi/ToolStripItemTests.Dpi.cs b/src/test/integration/UIIntegrationTests/Dpi/ToolStripItemTests.Dpi.cs index 2953bce8354..56af603ff43 100644 --- a/src/test/integration/UIIntegrationTests/Dpi/ToolStripItemTests.Dpi.cs +++ b/src/test/integration/UIIntegrationTests/Dpi/ToolStripItemTests.Dpi.cs @@ -26,7 +26,7 @@ public void ToolStripItems_FontScaling(int newDpi) // Set thread awareness context to PermonitorV2(PMv2). DPI_AWARENESS_CONTEXT originalAwarenessContext = PInvoke.SetThreadDpiAwarenessContextInternal(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); - typeof(ScaleHelper).TestAccessor().Dynamic.InitializeStatics(); + typeof(ScaleHelper).TestAccessor.Dynamic.InitializeStatics(); try { int clientWidth = 800; diff --git a/src/test/integration/UIIntegrationTests/MonthCalendarTests.cs b/src/test/integration/UIIntegrationTests/MonthCalendarTests.cs index 5f72b242ff0..e28a69fc1b7 100644 --- a/src/test/integration/UIIntegrationTests/MonthCalendarTests.cs +++ b/src/test/integration/UIIntegrationTests/MonthCalendarTests.cs @@ -173,7 +173,7 @@ static unsafe Rectangle GetCalendarGridRect(MonthCalendar control, MCGRIDINFO_PA private Point GetCellPositionByDate(MonthCalendar calendar, DateTime dateTime) { MonthCalendarAccessibleObject accessibleObject = (MonthCalendarAccessibleObject)calendar.AccessibilityObject; - CalendarCellAccessibleObject cell = accessibleObject.TestAccessor().Dynamic.GetCellByDate(dateTime.Date); + CalendarCellAccessibleObject cell = accessibleObject.TestAccessor.Dynamic.GetCellByDate(dateTime.Date); return cell.Bounds.Location + (cell.Bounds.Size / 2); } diff --git a/src/test/integration/UIIntegrationTests/PropertyGridTests.cs b/src/test/integration/UIIntegrationTests/PropertyGridTests.cs index 54c368a594d..3c09b4188ce 100644 --- a/src/test/integration/UIIntegrationTests/PropertyGridTests.cs +++ b/src/test/integration/UIIntegrationTests/PropertyGridTests.cs @@ -461,7 +461,7 @@ public void PropertyGrid_PropertyTabs_Get_ReturnsExpected() _propertyGrid.PropertyTabs.Should().NotBeNull(); PropertyTabCollection propertyTabCollection = _propertyGrid.PropertyTabs; - PropertyGrid propertyGrid = propertyTabCollection.TestAccessor().Dynamic._ownerPropertyGrid; + PropertyGrid propertyGrid = propertyTabCollection.TestAccessor.Dynamic._ownerPropertyGrid; propertyGrid.Should().Be(_propertyGrid); } diff --git a/src/test/unit/System.Windows.Forms/ComDisabled/DataObjectComTests.cs b/src/test/unit/System.Windows.Forms/ComDisabled/DataObjectComTests.cs index d354ff2df5c..f2fb3480385 100644 --- a/src/test/unit/System.Windows.Forms/ComDisabled/DataObjectComTests.cs +++ b/src/test/unit/System.Windows.Forms/ComDisabled/DataObjectComTests.cs @@ -15,8 +15,8 @@ public unsafe partial class DataObjectTests [WinFormsFact] public void DataObject_WithJson_MockRoundTrip() { - dynamic controlAccessor = typeof(Control).TestAccessor().Dynamic; - var dropTargetAccessor = typeof(DropTarget).TestAccessor(); + dynamic controlAccessor = typeof(Control).TestAccessor.Dynamic; + var dropTargetAccessor = typeof(DropTarget).TestAccessor; SimpleTestData testData = new() { X = 1, Y = 1 }; DataObject data = new(); @@ -37,8 +37,8 @@ public void DataObject_WithJson_MockRoundTrip() public void DataObject_CustomIDataObject_MockRoundTrip() { CustomIDataObject data = new(); - dynamic accessor = typeof(Control).TestAccessor().Dynamic; - var dropTargetAccessor = typeof(DropTarget).TestAccessor(); + dynamic accessor = typeof(Control).TestAccessor.Dynamic; + var dropTargetAccessor = typeof(DropTarget).TestAccessor; DataObject inData = accessor.CreateRuntimeDataObjectForDrag(data); inData.Should().NotBeSameAs(data); @@ -55,8 +55,8 @@ public void DataObject_CustomIDataObject_MockRoundTrip() public void DataObject_ComTypesIDataObject_MockRoundTrip() { CustomComTypesDataObject data = new(); - dynamic accessor = typeof(Control).TestAccessor().Dynamic; - var dropTargetAccessor = typeof(DropTarget).TestAccessor(); + dynamic accessor = typeof(Control).TestAccessor.Dynamic; + var dropTargetAccessor = typeof(DropTarget).TestAccessor; DataObject inData = accessor.CreateRuntimeDataObjectForDrag(data); inData.Should().NotBeSameAs(data); diff --git a/src/test/unit/System.Windows.Forms/KeyboardTooltipStateMachineTests.cs b/src/test/unit/System.Windows.Forms/KeyboardTooltipStateMachineTests.cs index 7b7a8327528..80451c49bb5 100644 --- a/src/test/unit/System.Windows.Forms/KeyboardTooltipStateMachineTests.cs +++ b/src/test/unit/System.Windows.Forms/KeyboardTooltipStateMachineTests.cs @@ -66,13 +66,13 @@ public void KeyboardTooltipStateMachine_DismissalKeyUp_NonPersistent_NotDismisse // Simulate that the toolTip is shown. KeyboardToolTipStateMachine instance = KeyboardToolTipStateMachine.Instance; - instance.TestAccessor().Dynamic._currentTool = control; - instance.TestAccessor().Dynamic._currentState = KeyboardToolTipStateMachine.SmState.Shown; + instance.TestAccessor.Dynamic._currentTool = control; + instance.TestAccessor.Dynamic._currentState = KeyboardToolTipStateMachine.SmState.Shown; control.SimulateKeyUp(keys); - IKeyboardToolTip currentTool = instance.TestAccessor().Dynamic._currentTool; - string currentState = instance.TestAccessor().Dynamic._currentState.ToString(); + IKeyboardToolTip currentTool = instance.TestAccessor.Dynamic._currentTool; + string currentState = instance.TestAccessor.Dynamic._currentState.ToString(); Assert.Equal(control, currentTool); Assert.Equal("Shown", currentState); @@ -98,13 +98,13 @@ public void KeyboardTooltipStateMachine_DismissalKeyUp(Keys keys, bool isPersist // Simulate that the toolTip is shown. KeyboardToolTipStateMachine instance = KeyboardToolTipStateMachine.Instance; - instance.TestAccessor().Dynamic._currentTool = control; - instance.TestAccessor().Dynamic._currentState = KeyboardToolTipStateMachine.SmState.Shown; + instance.TestAccessor.Dynamic._currentTool = control; + instance.TestAccessor.Dynamic._currentState = KeyboardToolTipStateMachine.SmState.Shown; control.SimulateKeyUp(keys); - IKeyboardToolTip currentTool = instance.TestAccessor().Dynamic._currentTool; - string currentState = instance.TestAccessor().Dynamic._currentState.ToString(); + IKeyboardToolTip currentTool = instance.TestAccessor.Dynamic._currentTool; + string currentState = instance.TestAccessor.Dynamic._currentState.ToString(); Assert.Equal(isPersistent && OsVersion.IsWindows11_OrGreater() ? "Hidden" : "Shown", currentState); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/AccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/AccessibleObjectTests.cs index 8ebda323841..f43f2dad595 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/AccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/AccessibleObjectTests.cs @@ -551,7 +551,7 @@ public void AccessibleObject_Navigate_FormChildren() AccessibleObject firstChild = form.AccessibilityObject.Navigate(AccessibleNavigation.FirstChild); Assert.NotNull(firstChild); - Assert.Equal((AccessibleObject)first.TestAccessor().Dynamic.NcAccessibilityObject, firstChild); + Assert.Equal((AccessibleObject)first.TestAccessor.Dynamic.NcAccessibilityObject, firstChild); AccessibleObject next = firstChild.Navigate(AccessibleNavigation.Next); Assert.NotNull(next); @@ -580,7 +580,7 @@ public void AccessibleObject_Navigate_FromForm_OneChild(AccessibleNavigation dir Assert.Equal(returnsObject, target is not null); if (target is not null) { - Assert.Equal(isSystemAccessible, (bool)target.TestAccessor().Dynamic._isSystemWrapper); + Assert.Equal(isSystemAccessible, (bool)target.TestAccessor.Dynamic._isSystemWrapper); } } @@ -599,7 +599,7 @@ public void AccessibleObject_Navigate_FromForm_NoChildren(AccessibleNavigation d Assert.Equal(returnsObject, target is not null); if (target is not null) { - Assert.True((bool)target.TestAccessor().Dynamic._isSystemWrapper); + Assert.True((bool)target.TestAccessor.Dynamic._isSystemWrapper); } } @@ -2163,7 +2163,7 @@ public void AccessibleObject_IAccessibleGet_accRole_InvokeDefaultSelfNotAClientO using Control control = new(); control.CreateControl(); - AccessibleObject accessibleObject = control.TestAccessor().Dynamic.NcAccessibilityObject; + AccessibleObject accessibleObject = control.TestAccessor.Dynamic.NcAccessibilityObject; IAccessible iAccessible = accessibleObject; Assert.Equal((int)AccessibleRole.Window, iAccessible.get_accRole((int)PInvoke.CHILDID_SELF)); @@ -2769,7 +2769,7 @@ public void AccessibleObject_SystemWrapper_RuntimeId_IsValid() AccessibleObject accessibleObject = (AccessibleObject)Activator.CreateInstance(typeof(AccessibleObject), BindingFlags.NonPublic | BindingFlags.Instance, null, [null], null); - Assert.NotEmpty(accessibleObject.TestAccessor().Dynamic.RuntimeId); + Assert.NotEmpty(accessibleObject.TestAccessor.Dynamic.RuntimeId); } private class SubAccessibleObject : AccessibleObject diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/CategoryGridEntryAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/CategoryGridEntryAccessibleObjectTests.cs index af73c89aece..912300ad5af 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/CategoryGridEntryAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/CategoryGridEntryAccessibleObjectTests.cs @@ -68,7 +68,7 @@ public void CategoryGridEntryAccessibleObject_FragmentNavigate_Parent_ReturnsExp using PropertyGrid control = new(); using Button button = new(); control.SelectedObject = button; - PropertyGridView gridView = control.TestAccessor().Dynamic._gridView; + PropertyGridView gridView = control.TestAccessor.Dynamic._gridView; AccessibleObject accessibilityObject = gridView.TopLevelGridEntries[0].AccessibilityObject; @@ -83,7 +83,7 @@ public void CategoryGridEntryAccessibleObject_FragmentNavigate_NextSibling_Retur using PropertyGrid control = new(); using Button button = new(); control.SelectedObject = button; - PropertyGridView gridView = control.TestAccessor().Dynamic._gridView; + PropertyGridView gridView = control.TestAccessor.Dynamic._gridView; AccessibleObject accessibilityObjectCategory1 = gridView.TopLevelGridEntries[0].AccessibilityObject; AccessibleObject accessibilityObjectCategory2 = gridView.TopLevelGridEntries[1].AccessibilityObject; @@ -101,7 +101,7 @@ public void CategoryGridEntryAccessibleObject_FragmentNavigate_PreviousSibling_R using PropertyGrid control = new(); using Button button = new(); control.SelectedObject = button; - PropertyGridView gridView = control.TestAccessor().Dynamic._gridView; + PropertyGridView gridView = control.TestAccessor.Dynamic._gridView; AccessibleObject accessibilityObjectCategory1 = gridView.TopLevelGridEntries[0].AccessibilityObject; AccessibleObject accessibilityObjectCategory2 = gridView.TopLevelGridEntries[1].AccessibilityObject; @@ -118,7 +118,7 @@ public void CategoryGridEntryAccessibleObject_FragmentNavigate_FirstChild_Return using PropertyGrid control = new(); using Button button = new(); control.SelectedObject = button; - PropertyGridView gridView = control.TestAccessor().Dynamic._gridView; + PropertyGridView gridView = control.TestAccessor.Dynamic._gridView; var category = (CategoryGridEntry)gridView.TopLevelGridEntries[0]; var gridViewAccessibilityObject = (PropertyGridViewAccessibleObject)gridView.AccessibilityObject; @@ -136,7 +136,7 @@ public void CategoryGridEntryAccessibleObject_FragmentNavigate_LastChild_Returns using PropertyGrid control = new(); using Button button = new(); control.SelectedObject = button; - PropertyGridView gridView = control.TestAccessor().Dynamic._gridView; + PropertyGridView gridView = control.TestAccessor.Dynamic._gridView; var category = (CategoryGridEntry)gridView.TopLevelGridEntries[0]; var gridViewAccessibilityObject = (PropertyGridViewAccessibleObject)gridView.AccessibilityObject; @@ -178,7 +178,7 @@ public void CategoryGridEntryAccessibleObjectWithControl_GetPropertyValue_Return using PropertyGrid control = new(); using Button button = new(); control.SelectedObject = button; - PropertyGridView gridView = control.TestAccessor().Dynamic._gridView; + PropertyGridView gridView = control.TestAccessor.Dynamic._gridView; var category = (CategoryGridEntry)gridView.TopLevelGridEntries[0]; var gridViewAccessibilityObject = (PropertyGridViewAccessibleObject)gridView.AccessibilityObject; AccessibleObject accessibilityObject = category.AccessibilityObject; diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/CheckedListBoxItemAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/CheckedListBoxItemAccessibleObjectTests.cs index cbe755502bb..cd7175dfa01 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/CheckedListBoxItemAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/CheckedListBoxItemAccessibleObjectTests.cs @@ -72,9 +72,9 @@ public void CheckedListBoxItemAccessibleObject_CurrentIndex_IsExpected() AccessibleObject accessibleObject = checkedListBox.AccessibilityObject; - Assert.Equal(0, accessibleObject.GetChild(0).TestAccessor().Dynamic.CurrentIndex); - Assert.Equal(1, accessibleObject.GetChild(1).TestAccessor().Dynamic.CurrentIndex); - Assert.Equal(2, accessibleObject.GetChild(2).TestAccessor().Dynamic.CurrentIndex); + Assert.Equal(0, accessibleObject.GetChild(0).TestAccessor.Dynamic.CurrentIndex); + Assert.Equal(1, accessibleObject.GetChild(1).TestAccessor.Dynamic.CurrentIndex); + Assert.Equal(2, accessibleObject.GetChild(2).TestAccessor.Dynamic.CurrentIndex); Assert.False(checkedListBox.IsHandleCreated); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ColumnHeader.ListViewColumnHeaderAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ColumnHeader.ListViewColumnHeaderAccessibleObjectTests.cs index d5deabddc9c..175c6c040a3 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ColumnHeader.ListViewColumnHeaderAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ColumnHeader.ListViewColumnHeaderAccessibleObjectTests.cs @@ -51,7 +51,7 @@ public void ListViewColumnHeaderAccessibleObject_IsDisconnected_WhenListViewRele listView.ReleaseUiaProvider(listView.HWND); - Assert.Null(columnHeader.TestAccessor().Dynamic._accessibilityObject); + Assert.Null(columnHeader.TestAccessor.Dynamic._accessibilityObject); Assert.True(listView.IsHandleCreated); } @@ -65,7 +65,7 @@ public void ListViewColumnHeaderAccessibleObject_IsDisconnected_WhenListViewIsCl listView.Clear(); - Assert.Null(columnHeader.TestAccessor().Dynamic._accessibilityObject); + Assert.Null(columnHeader.TestAccessor.Dynamic._accessibilityObject); Assert.False(listView.IsHandleCreated); } @@ -79,7 +79,7 @@ public void ListViewColumnHeaderAccessibleObject_IsDisconnected_WhenColumnsAreCl listView.Columns.Clear(); - Assert.Null(columnHeader.TestAccessor().Dynamic._accessibilityObject); + Assert.Null(columnHeader.TestAccessor.Dynamic._accessibilityObject); Assert.False(listView.IsHandleCreated); } @@ -93,13 +93,13 @@ public void ListViewColumnHeaderAccessibleObject_IsDisconnected_WhenColumnIsRemo listView.Columns.Remove(columnHeader); - Assert.Null(columnHeader.TestAccessor().Dynamic._accessibilityObject); + Assert.Null(columnHeader.TestAccessor.Dynamic._accessibilityObject); Assert.False(listView.IsHandleCreated); } private static void EnforceAccessibleObjectCreation(ColumnHeader columnHeader) { _ = columnHeader.AccessibilityObject; - Assert.NotNull(columnHeader.TestAccessor().Dynamic._accessibilityObject); + Assert.NotNull(columnHeader.TestAccessor.Dynamic._accessibilityObject); } } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ComboBox.ChildAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ComboBox.ChildAccessibleObjectTests.cs index b96bdc325f0..91d9c28d768 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ComboBox.ChildAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ComboBox.ChildAccessibleObjectTests.cs @@ -21,7 +21,7 @@ public void ChildAccessibleObject_Ctor_Default() var accessibleObject = new ComboBox.ChildAccessibleObject(control, IntPtr.Zero); - Assert.NotNull(accessibleObject.TestAccessor().Dynamic._owner); + Assert.NotNull(accessibleObject.TestAccessor.Dynamic._owner); Assert.True(control.IsHandleCreated); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/Control.ControlAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/Control.ControlAccessibleObjectTests.cs index 58f9bc265ec..3e7ed700efe 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/Control.ControlAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/Control.ControlAccessibleObjectTests.cs @@ -1526,7 +1526,7 @@ public void ControlAccessibleObject_FragmentNavigate_ParentIsToolStrip_IfControl } toolStrip.Items.Add(host); - host.TestAccessor().Dynamic._parent = toolStrip; + host.TestAccessor.Dynamic._parent = toolStrip; host.SetPlacement(ToolStripItemPlacement.Main); Assert.True(control.AccessibilityObject is Control.ControlAccessibleObject); @@ -1564,7 +1564,7 @@ public void ControlAccessibleObject_FragmentNavigate_NextSibling_IsNextItem_IfCo toolStrip.Items.Add(host); toolStrip.Items.Add(button); - host.TestAccessor().Dynamic._parent = toolStrip; + host.TestAccessor.Dynamic._parent = toolStrip; host.SetPlacement(ToolStripItemPlacement.Main); Assert.True(control.AccessibilityObject is Control.ControlAccessibleObject); @@ -1600,7 +1600,7 @@ public void ControlAccessibleObject_FragmentNavigate_PreviousSibling_IsPreviousI } toolStrip.Items.Add(host); - host.TestAccessor().Dynamic._parent = toolStrip; + host.TestAccessor.Dynamic._parent = toolStrip; host.SetPlacement(ToolStripItemPlacement.Main); Assert.True(control.AccessibilityObject is Control.ControlAccessibleObject); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewAccessibleObjectTests.cs index 5bdcdecb762..1101d59b1d8 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewAccessibleObjectTests.cs @@ -813,7 +813,7 @@ public void DataGridViewAccessibleObject_GetChild_ReturnExpected_IfFirstRowInvis dataGridView.Rows[0].Visible = false; - AccessibleObject topRowAccessibilityObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibilityObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; Assert.Null(dataGridView.AccessibilityObject.GetChild(-1)); Assert.Equal(topRowAccessibilityObject, dataGridView.AccessibilityObject.GetChild(0)); @@ -836,7 +836,7 @@ public void DataGridViewAccessibleObject_GetChild_ReturnExpected_IfSecondRowInvi dataGridView.Rows[1].Visible = false; - AccessibleObject topRowAccessibilityObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibilityObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; Assert.Null(dataGridView.AccessibilityObject.GetChild(-1)); Assert.Equal(topRowAccessibilityObject, dataGridView.AccessibilityObject.GetChild(0)); @@ -860,7 +860,7 @@ public void DataGridViewAccessibleObject_GetChild_ReturnExpected_IfRowsInvisible dataGridView.Rows[0].Visible = false; dataGridView.Rows[1].Visible = false; - AccessibleObject topRowAccessibilityObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibilityObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; Assert.Null(dataGridView.AccessibilityObject.GetChild(-1)); Assert.Equal(topRowAccessibilityObject, dataGridView.AccessibilityObject.GetChild(0)); @@ -940,7 +940,7 @@ public void DataGridViewAccessibleObject_FragmentNavigate_Child_RetrunExpected_I dataGridView.Columns.Add(new DataGridViewTextBoxColumn()); dataGridView.Rows.Add("Test 1"); dataGridView.Rows.Add("Test 2"); - AccessibleObject topRowAccessibilityObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibilityObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; dataGridView.Rows[0].Visible = false; @@ -960,7 +960,7 @@ public void DataGridViewAccessibleObject_FragmentNavigate_Child_RetrunExpected_I dataGridView.Columns.Add(new DataGridViewTextBoxColumn()); dataGridView.Rows.Add("Test 1"); dataGridView.Rows.Add("Test 2"); - AccessibleObject topRowAccessibilityObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibilityObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; dataGridView.Rows[1].Visible = false; @@ -980,7 +980,7 @@ public void DataGridViewAccessibleObject_FragmentNavigate_Child_RetrunExpected_I dataGridView.Columns.Add(new DataGridViewTextBoxColumn()); dataGridView.Rows.Add("Test 1"); dataGridView.Rows.Add("Test 2"); - AccessibleObject topRowAccessibilityObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibilityObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; dataGridView.Rows[0].Visible = false; dataGridView.Rows[1].Visible = false; @@ -1062,7 +1062,7 @@ public void DataGridViewAccessibleObject_Navigate_Child_RetrunExpected_IfFirstRo dataGridView.Columns.Add(new DataGridViewTextBoxColumn()); dataGridView.Rows.Add("Test 1"); dataGridView.Rows.Add("Test 2"); - AccessibleObject topRowAccessibilityObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibilityObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; dataGridView.Rows[0].Visible = false; @@ -1082,7 +1082,7 @@ public void DataGridViewAccessibleObject_Navigate_Child_RetrunExpected_IfSecondR dataGridView.Columns.Add(new DataGridViewTextBoxColumn()); dataGridView.Rows.Add("Test 1"); dataGridView.Rows.Add("Test 2"); - AccessibleObject topRowAccessibilityObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibilityObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; dataGridView.Rows[1].Visible = false; @@ -1102,7 +1102,7 @@ public void DataGridViewAccessibleObject_Navigate_Child_RetrunExpected_IfRowsInv dataGridView.Columns.Add(new DataGridViewTextBoxColumn()); dataGridView.Rows.Add("Test 1"); dataGridView.Rows.Add("Test 2"); - AccessibleObject topRowAccessibilityObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibilityObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; dataGridView.Rows[0].Visible = false; dataGridView.Rows[1].Visible = false; diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewColumnHeaderCellAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewColumnHeaderCellAccessibleObjectTests.cs index b5457b809b4..e8b94fdb1ca 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewColumnHeaderCellAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewColumnHeaderCellAccessibleObjectTests.cs @@ -157,7 +157,7 @@ public void DataGridViewColumnHeaderCellAccessibleObject_FragmentNavigate_Parent using DataGridView control = new(); control.Columns.Add("Column 1", "Header text 1"); var accessibleObject = control.Columns[0].HeaderCell.AccessibilityObject; - AccessibleObject topRowAccessibleObject = control.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = control.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; Assert.Equal(topRowAccessibleObject, accessibleObject.FragmentNavigate(NavigateDirection.NavigateDirection_Parent)); Assert.False(control.IsHandleCreated); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewRowAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewRowAccessibleObjectTests.cs index e14621a74f3..fd4c9794a21 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewRowAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewRowAccessibleObjectTests.cs @@ -413,7 +413,7 @@ public void DataGridViewRowAccessibleObject_FragmentNavigate_Sibling_ReturnExpec dataGridView.Rows.Add("2"); dataGridView.Rows.Add("3"); - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Rows[0].AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Rows[1].AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Rows[2].AccessibilityObject; @@ -443,7 +443,7 @@ public void DataGridViewRowAccessibleObject_FragmentNavigate_Sibling_ReturnExpec dataGridView.Rows.Add("3"); dataGridView.Rows[0].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Rows[1].AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Rows[2].AccessibilityObject; AccessibleObject accessibleObject4 = dataGridView.Rows[3].AccessibilityObject; @@ -470,7 +470,7 @@ public void DataGridViewRowAccessibleObject_FragmentNavigate_Sibling_ReturnExpec dataGridView.Rows.Add("3"); dataGridView.Rows[1].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Rows[0].AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Rows[2].AccessibilityObject; AccessibleObject accessibleObject4 = dataGridView.Rows[3].AccessibilityObject; @@ -497,7 +497,7 @@ public void DataGridViewRowAccessibleObject_FragmentNavigate_Sibling_ReturnExpec dataGridView.Rows.Add("3"); dataGridView.Rows[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Rows[0].AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Rows[1].AccessibilityObject; AccessibleObject accessibleObject4 = dataGridView.Rows[3].AccessibilityObject; @@ -710,7 +710,7 @@ public void DataGridViewRowAccessibleObject_FragmentNavigate_Sibling_ReturnExpec dataGridView.Rows.Add("2"); dataGridView.Rows.Add("3"); - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Rows[0].AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Rows[1].AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Rows[2].AccessibilityObject; @@ -737,7 +737,7 @@ public void DataGridViewRowAccessibleObject_FragmentNavigate_Sibling_ReturnExpec dataGridView.Rows.Add("3"); dataGridView.Rows[0].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Rows[1].AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Rows[2].AccessibilityObject; @@ -761,7 +761,7 @@ public void DataGridViewRowAccessibleObject_FragmentNavigate_Sibling_ReturnExpec dataGridView.Rows.Add("3"); dataGridView.Rows[1].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Rows[0].AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Rows[2].AccessibilityObject; @@ -785,7 +785,7 @@ public void DataGridViewRowAccessibleObject_FragmentNavigate_Sibling_ReturnExpec dataGridView.Rows.Add("3"); dataGridView.Rows[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Rows[0].AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Rows[1].AccessibilityObject; @@ -808,7 +808,7 @@ public void DataGridViewRowAccessibleObject_Navigate_Sibling_ReturnExpected() dataGridView.Rows.Add("2"); dataGridView.Rows.Add("3"); - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Rows[0].AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Rows[1].AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Rows[2].AccessibilityObject; @@ -838,7 +838,7 @@ public void DataGridViewRowAccessibleObject_Navigate_Sibling_ReturnExpected_IfFi dataGridView.Rows.Add("3"); dataGridView.Rows[0].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Rows[1].AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Rows[2].AccessibilityObject; AccessibleObject accessibleObject4 = dataGridView.Rows[3].AccessibilityObject; @@ -865,7 +865,7 @@ public void DataGridViewRowAccessibleObject_Navigate_Sibling_ReturnExpected_IfSe dataGridView.Rows.Add("3"); dataGridView.Rows[1].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Rows[0].AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Rows[2].AccessibilityObject; AccessibleObject accessibleObject4 = dataGridView.Rows[3].AccessibilityObject; @@ -892,7 +892,7 @@ public void DataGridViewRowAccessibleObject_Navigate_Sibling_ReturnExpected_IfLa dataGridView.Rows.Add("3"); dataGridView.Rows[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Rows[0].AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Rows[1].AccessibilityObject; AccessibleObject accessibleObject4 = dataGridView.Rows[3].AccessibilityObject; @@ -1105,7 +1105,7 @@ public void DataGridViewRowAccessibleObject_Navigate_Sibling_ReturnExpected_IfUs dataGridView.Rows.Add("2"); dataGridView.Rows.Add("3"); - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Rows[0].AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Rows[1].AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Rows[2].AccessibilityObject; @@ -1132,7 +1132,7 @@ public void DataGridViewRowAccessibleObject_Navigate_Sibling_ReturnExpected_IfFi dataGridView.Rows.Add("3"); dataGridView.Rows[0].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Rows[1].AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Rows[2].AccessibilityObject; @@ -1156,7 +1156,7 @@ public void DataGridViewRowAccessibleObject_Navigate_Sibling_ReturnExpected_IfSe dataGridView.Rows.Add("3"); dataGridView.Rows[1].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Rows[0].AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Rows[2].AccessibilityObject; @@ -1180,7 +1180,7 @@ public void DataGridViewRowAccessibleObject_Navigate_Sibling_ReturnExpected_IfLa dataGridView.Rows.Add("3"); dataGridView.Rows[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Rows[0].AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Rows[1].AccessibilityObject; diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewSelectedCellsAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewSelectedCellsAccessibleObjectTests.cs index 2b21fd67ef3..caaa0ab1940 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewSelectedCellsAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewSelectedCellsAccessibleObjectTests.cs @@ -17,7 +17,7 @@ public void DataGridViewSelectedCellsAccessibleObject_Ctor_Default() .GetNestedType("DataGridViewSelectedCellsAccessibleObject", BindingFlags.NonPublic | BindingFlags.Instance); var accessibleObject = (AccessibleObject)Activator.CreateInstance(type, [null]); - Assert.Null(accessibleObject.TestAccessor().Dynamic._parentAccessibleObject); + Assert.Null(accessibleObject.TestAccessor.Dynamic._parentAccessibleObject); Assert.Equal(AccessibleRole.Grouping, accessibleObject.Role); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewSelectedRowCellsAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewSelectedRowCellsAccessibleObjectTests.cs index d531ddc7f03..e741c7af6aa 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewSelectedRowCellsAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewSelectedRowCellsAccessibleObjectTests.cs @@ -17,7 +17,7 @@ public void DataGridViewSelectedRowCellsAccessibleObject_Ctor_Default() .GetNestedType("DataGridViewSelectedRowCellsAccessibleObject", BindingFlags.NonPublic | BindingFlags.Instance); var accessibleObject = (AccessibleObject)Activator.CreateInstance(type, BindingFlags.NonPublic | BindingFlags.Instance, null, [null], null); - Assert.Null(accessibleObject.TestAccessor().Dynamic._owningDataGridViewRow); + Assert.Null(accessibleObject.TestAccessor.Dynamic._owningDataGridViewRow); Assert.Equal(AccessibleRole.Grouping, accessibleObject.Role); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewTopRowAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewTopRowAccessibleObjectTests.cs index 5918263783e..6339a3e8a9d 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewTopRowAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DataGridViewTopRowAccessibleObjectTests.cs @@ -17,7 +17,7 @@ public void DataGridViewTopRowAccessibleObject_FragmentNavigate_ReturnsExpected_ dataGridView.Columns.Add(dataGridViewColumn); - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject expectedNextSibling = dataGridView.Rows[0].AccessibilityObject; AccessibleObject expectedFirstChild = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject expectedLastChild = dataGridView.Columns[0].HeaderCell.AccessibilityObject; @@ -38,7 +38,7 @@ public void DataGridViewTopRowAccessibleObject_FragmentNavigate_ReturnsExpected_ dataGridView.Columns.Add(dataGridViewColumn); - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject expectedFirstChild = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject expectedLastChild = dataGridView.Columns[0].HeaderCell.AccessibilityObject; @@ -55,7 +55,7 @@ public void DataGridViewTopRowAccessibleObject_FragmentNavigate_ReturnsExpected_ { using DataGridView dataGridView = new(); - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; Assert.Equal(dataGridView.AccessibilityObject, topRowAccessibleObject.FragmentNavigate(NavigateDirection.NavigateDirection_Parent)); @@ -74,7 +74,7 @@ public void DataGridViewTopRowAccessibleObject_FragmentNavigate_Child_ReturnsExp dataGridView.Columns.Add("Column 2", "Column 2"); dataGridView.Columns.Add("Column 3", "Column 3"); - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; @@ -92,7 +92,7 @@ public void DataGridViewTopRowAccessibleObject_FragmentNavigate_Child_ReturnsExp dataGridView.Columns.Add("Column 3", "Column 3"); dataGridView.Columns[0].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[1].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; @@ -110,7 +110,7 @@ public void DataGridViewTopRowAccessibleObject_FragmentNavigate_Child_ReturnsExp dataGridView.Columns.Add("Column 3", "Column 3"); dataGridView.Columns[1].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; @@ -128,7 +128,7 @@ public void DataGridViewTopRowAccessibleObject_FragmentNavigate_Child_ReturnsExp dataGridView.Columns.Add("Column 3", "Column 3"); dataGridView.Columns[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[1].HeaderCell.AccessibilityObject; @@ -148,7 +148,7 @@ public void DataGridViewTopRowAccessibleObject_FragmentNavigate_Child_ReturnsExp dataGridView.Columns[1].Visible = false; dataGridView.Columns[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; Assert.Null(topRowAccessibleObject.FragmentNavigate(NavigateDirection.NavigateDirection_FirstChild)); Assert.Null(topRowAccessibleObject.FragmentNavigate(NavigateDirection.NavigateDirection_LastChild)); @@ -164,7 +164,7 @@ public void DataGridViewTopRowAccessibleObject_FragmentNavigate_Child_ReturnsExp dataGridView.Columns.Add("Column 3", "Column 3"); dataGridView.Columns[0].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject = dataGridView.Columns[2].HeaderCell.AccessibilityObject; @@ -182,7 +182,7 @@ public void DataGridViewTopRowAccessibleObject_FragmentNavigate_Child_ReturnsExp dataGridView.Columns.Add("Column 3", "Column 3"); dataGridView.Columns[1].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject = dataGridView.Columns[2].HeaderCell.AccessibilityObject; @@ -200,7 +200,7 @@ public void DataGridViewTopRowAccessibleObject_FragmentNavigate_Child_ReturnsExp dataGridView.Columns.Add("Column 3", "Column 3"); dataGridView.Columns[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject = dataGridView.Columns[1].HeaderCell.AccessibilityObject; @@ -220,7 +220,7 @@ public void DataGridViewTopRowAccessibleObject_FragmentNavigate_Child_ReturnsExp dataGridView.Columns[1].Visible = false; dataGridView.Columns[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; Assert.Equal(topLeftAccessibilityObject, topRowAccessibleObject.FragmentNavigate(NavigateDirection.NavigateDirection_FirstChild)); @@ -239,7 +239,7 @@ public void DataGridViewTopRowAccessibleObject_FragmentNavigate_Child_ReturnsExp dataGridView.Columns[1].DisplayIndex = 1; dataGridView.Columns[2].DisplayIndex = 0; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; @@ -260,7 +260,7 @@ public void DataGridViewTopRowAccessibleObject_FragmentNavigate_Child_ReturnsExp dataGridView.Columns[2].DisplayIndex = 0; dataGridView.Columns[0].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[1].HeaderCell.AccessibilityObject; @@ -281,7 +281,7 @@ public void DataGridViewTopRowAccessibleObject_FragmentNavigate_Child_ReturnsExp dataGridView.Columns[2].DisplayIndex = 0; dataGridView.Columns[1].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; @@ -302,7 +302,7 @@ public void DataGridViewTopRowAccessibleObject_FragmentNavigate_Child_ReturnsExp dataGridView.Columns[2].DisplayIndex = 0; dataGridView.Columns[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[1].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; @@ -322,7 +322,7 @@ public void DataGridViewTopRowAccessibleObject_FragmentNavigate_Child_ReturnsExp dataGridView.Columns[1].DisplayIndex = 1; dataGridView.Columns[2].DisplayIndex = 0; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject = dataGridView.Columns[0].HeaderCell.AccessibilityObject; @@ -343,7 +343,7 @@ public void DataGridViewTopRowAccessibleObject_FragmentNavigate_Child_ReturnsExp dataGridView.Columns[2].DisplayIndex = 0; dataGridView.Columns[0].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject = dataGridView.Columns[1].HeaderCell.AccessibilityObject; @@ -364,7 +364,7 @@ public void DataGridViewTopRowAccessibleObject_FragmentNavigate_Child_ReturnsExp dataGridView.Columns[2].DisplayIndex = 0; dataGridView.Columns[1].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject = dataGridView.Columns[0].HeaderCell.AccessibilityObject; @@ -385,7 +385,7 @@ public void DataGridViewTopRowAccessibleObject_FragmentNavigate_Child_ReturnsExp dataGridView.Columns[2].DisplayIndex = 0; dataGridView.Columns[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject = dataGridView.Columns[0].HeaderCell.AccessibilityObject; @@ -402,7 +402,7 @@ public void DataGridViewTopRowAccessibleObject_Navigate_ReturnsExpected_IfRowHea dataGridView.Columns.Add("Column 2", "Column 2"); dataGridView.Columns.Add("Column 3", "Column 3"); - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; @@ -420,7 +420,7 @@ public void DataGridViewTopRowAccessibleObject_Navigate_ReturnsExpected_IfRowHea dataGridView.Columns.Add("Column 3", "Column 3"); dataGridView.Columns[0].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[1].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; @@ -438,7 +438,7 @@ public void DataGridViewTopRowAccessibleObject_Navigate_ReturnsExpected_IfRowHea dataGridView.Columns.Add("Column 3", "Column 3"); dataGridView.Columns[1].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; @@ -456,7 +456,7 @@ public void DataGridViewTopRowAccessibleObject_Navigate_ReturnsExpected_IfRowHea dataGridView.Columns.Add("Column 3", "Column 3"); dataGridView.Columns[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[1].HeaderCell.AccessibilityObject; @@ -476,7 +476,7 @@ public void DataGridViewTopRowAccessibleObject_Navigate_ReturnsExpected_IfRowHea dataGridView.Columns[1].Visible = false; dataGridView.Columns[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; Assert.Null(topRowAccessibleObject.Navigate(AccessibleNavigation.FirstChild)); Assert.Null(topRowAccessibleObject.Navigate(AccessibleNavigation.LastChild)); @@ -492,7 +492,7 @@ public void DataGridViewTopRowAccessibleObject_Navigate_ReturnsExpected_IfFirstC dataGridView.Columns.Add("Column 3", "Column 3"); dataGridView.Columns[0].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject = dataGridView.Columns[2].HeaderCell.AccessibilityObject; @@ -510,7 +510,7 @@ public void DataGridViewTopRowAccessibleObject_Navigate_ReturnsExpected_IfSecond dataGridView.Columns.Add("Column 3", "Column 3"); dataGridView.Columns[1].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject = dataGridView.Columns[2].HeaderCell.AccessibilityObject; @@ -528,7 +528,7 @@ public void DataGridViewTopRowAccessibleObject_Navigate_ReturnsExpected_IfLastCo dataGridView.Columns.Add("Column 3", "Column 3"); dataGridView.Columns[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject = dataGridView.Columns[1].HeaderCell.AccessibilityObject; @@ -548,7 +548,7 @@ public void DataGridViewTopRowAccessibleObject_Navigate_ReturnsExpected_IfAllCol dataGridView.Columns[1].Visible = false; dataGridView.Columns[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; Assert.Equal(topLeftAccessibilityObject, topRowAccessibleObject.Navigate(AccessibleNavigation.FirstChild)); @@ -567,7 +567,7 @@ public void DataGridViewTopRowAccessibleObject_Navigate_ReturnsExpected_IfCustom dataGridView.Columns[1].DisplayIndex = 1; dataGridView.Columns[2].DisplayIndex = 0; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; @@ -588,7 +588,7 @@ public void DataGridViewTopRowAccessibleObject_Navigate_ReturnsExpected_IfCustom dataGridView.Columns[2].DisplayIndex = 0; dataGridView.Columns[0].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[1].HeaderCell.AccessibilityObject; @@ -609,7 +609,7 @@ public void DataGridViewTopRowAccessibleObject_Navigate_ReturnsExpected_IfCustom dataGridView.Columns[2].DisplayIndex = 0; dataGridView.Columns[1].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; @@ -630,7 +630,7 @@ public void DataGridViewTopRowAccessibleObject_Navigate_ReturnsExpected_IfCustom dataGridView.Columns[2].DisplayIndex = 0; dataGridView.Columns[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[1].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; @@ -650,7 +650,7 @@ public void DataGridViewTopRowAccessibleObject_Navigate_ReturnsExpected_IfCustom dataGridView.Columns[1].DisplayIndex = 1; dataGridView.Columns[2].DisplayIndex = 0; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject = dataGridView.Columns[0].HeaderCell.AccessibilityObject; @@ -671,7 +671,7 @@ public void DataGridViewTopRowAccessibleObject_Navigate_ReturnsExpected_IfCustom dataGridView.Columns[2].DisplayIndex = 0; dataGridView.Columns[0].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject = dataGridView.Columns[1].HeaderCell.AccessibilityObject; @@ -692,7 +692,7 @@ public void DataGridViewTopRowAccessibleObject_Navigate_ReturnsExpected_IfCustom dataGridView.Columns[2].DisplayIndex = 0; dataGridView.Columns[1].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject = dataGridView.Columns[0].HeaderCell.AccessibilityObject; @@ -713,7 +713,7 @@ public void DataGridViewTopRowAccessibleObject_Navigate_ReturnsExpected_IfCustom dataGridView.Columns[2].DisplayIndex = 0; dataGridView.Columns[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject = dataGridView.Columns[0].HeaderCell.AccessibilityObject; @@ -733,7 +733,7 @@ public void DataGridViewTopRowAccessibleObject_GetChild_ReturnsExpected_IfRowHea dataGridView.Columns[1].Visible = false; dataGridView.Columns[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; Assert.Null(topRowAccessibleObject.GetChild(0)); Assert.Null(topRowAccessibleObject.GetChild(1)); @@ -749,7 +749,7 @@ public void DataGridViewTopRowAccessibleObject_GetChild_ReturnsExpected_IfRowHea dataGridView.Columns.Add("Column 2", "Column 2"); dataGridView.Columns.Add("Column 3", "Column 3"); - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[1].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; @@ -770,7 +770,7 @@ public void DataGridViewTopRowAccessibleObject_GetChild_ReturnsExpected_IfRowHea dataGridView.Columns.Add("Column 3", "Column 3"); dataGridView.Columns[0].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[1].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; @@ -789,7 +789,7 @@ public void DataGridViewTopRowAccessibleObject_GetChild_ReturnsExpected_IfRowHea dataGridView.Columns.Add("Column 3", "Column 3"); dataGridView.Columns[1].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; @@ -808,7 +808,7 @@ public void DataGridViewTopRowAccessibleObject_GetChild_ReturnsExpected_IfRowHea dataGridView.Columns.Add("Column 3", "Column 3"); dataGridView.Columns[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[1].HeaderCell.AccessibilityObject; @@ -826,7 +826,7 @@ public void DataGridViewTopRowAccessibleObject_GetChild_ReturnsExpected() dataGridView.Columns.Add("Column 2", "Column 2"); dataGridView.Columns.Add("Column 3", "Column 3"); - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[1].HeaderCell.AccessibilityObject; @@ -851,7 +851,7 @@ public void DataGridViewTopRowAccessibleObject_GetChild_ReturnsExpected_IfAllCol dataGridView.Columns[1].Visible = false; dataGridView.Columns[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; Assert.Equal(topLeftAccessibilityObject, topRowAccessibleObject.GetChild(0)); @@ -869,7 +869,7 @@ public void DataGridViewTopRowAccessibleObject_GetChild_ReturnsExpected_IfFirstC dataGridView.Columns.Add("Column 3", "Column 3"); dataGridView.Columns[0].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[1].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; @@ -890,7 +890,7 @@ public void DataGridViewTopRowAccessibleObject_GetChild_ReturnsExpected_IfSecond dataGridView.Columns.Add("Column 3", "Column 3"); dataGridView.Columns[1].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; @@ -911,7 +911,7 @@ public void DataGridViewTopRowAccessibleObject_GetChild_ReturnsExpected_IfThirdC dataGridView.Columns.Add("Column 3", "Column 3"); dataGridView.Columns[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[1].HeaderCell.AccessibilityObject; @@ -934,7 +934,7 @@ public void DataGridViewTopRowAccessibleObject_GetChild_ReturnsExpected_IfCustom dataGridView.Columns[1].DisplayIndex = 1; dataGridView.Columns[2].DisplayIndex = 0; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[1].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; @@ -958,7 +958,7 @@ public void DataGridViewTopRowAccessibleObject_GetChild_ReturnsExpected_IfCustom dataGridView.Columns[2].DisplayIndex = 0; dataGridView.Columns[0].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[1].HeaderCell.AccessibilityObject; @@ -980,7 +980,7 @@ public void DataGridViewTopRowAccessibleObject_GetChild_ReturnsExpected_IfCustom dataGridView.Columns[2].DisplayIndex = 0; dataGridView.Columns[1].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; @@ -1002,7 +1002,7 @@ public void DataGridViewTopRowAccessibleObject_GetChild_ReturnsExpected_IfCustom dataGridView.Columns[2].DisplayIndex = 0; dataGridView.Columns[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[1].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; @@ -1023,7 +1023,7 @@ public void DataGridViewTopRowAccessibleObject_GetChild_ReturnsExpected_IfCustom dataGridView.Columns[1].DisplayIndex = 1; dataGridView.Columns[2].DisplayIndex = 0; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[1].HeaderCell.AccessibilityObject; @@ -1049,7 +1049,7 @@ public void DataGridViewTopRowAccessibleObject_GetChild_ReturnsExpected_IfCustom dataGridView.Columns[2].DisplayIndex = 0; dataGridView.Columns[0].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[1].HeaderCell.AccessibilityObject; @@ -1073,7 +1073,7 @@ public void DataGridViewTopRowAccessibleObject_GetChild_ReturnsExpected_IfCustom dataGridView.Columns[2].DisplayIndex = 0; dataGridView.Columns[1].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject1 = dataGridView.Columns[2].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; @@ -1097,7 +1097,7 @@ public void DataGridViewTopRowAccessibleObject_GetChild_ReturnsExpected_IfCustom dataGridView.Columns[2].DisplayIndex = 0; dataGridView.Columns[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; AccessibleObject topLeftAccessibilityObject = dataGridView.TopLeftHeaderCell.AccessibilityObject; AccessibleObject accessibleObject2 = dataGridView.Columns[1].HeaderCell.AccessibilityObject; AccessibleObject accessibleObject3 = dataGridView.Columns[0].HeaderCell.AccessibilityObject; @@ -1117,7 +1117,7 @@ public void DataGridViewTopRowAccessibleObject_GetChildCount_ReturnsFour() dataGridView.Columns.Add("Column 2", "Column 2"); dataGridView.Columns.Add("Column 3", "Column 3"); - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; Assert.Equal(4, topRowAccessibleObject.GetChildCount()); Assert.False(dataGridView.IsHandleCreated); @@ -1132,7 +1132,7 @@ public void DataGridViewTopRowAccessibleObject_GetChildCount_ReturnsThree_IfOneC dataGridView.Columns.Add("Column 3", "Column 3"); dataGridView.Columns[0].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; Assert.Equal(3, topRowAccessibleObject.GetChildCount()); Assert.False(dataGridView.IsHandleCreated); @@ -1148,7 +1148,7 @@ public void DataGridViewTopRowAccessibleObject_GetChildCount_ReturnsTwo_IfTwoCol dataGridView.Columns[0].Visible = false; dataGridView.Columns[1].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; Assert.Equal(2, topRowAccessibleObject.GetChildCount()); Assert.False(dataGridView.IsHandleCreated); @@ -1165,7 +1165,7 @@ public void DataGridViewTopRowAccessibleObject_GetChildCount_ReturnsOne_IfAllCol dataGridView.Columns[1].Visible = false; dataGridView.Columns[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; Assert.Equal(1, topRowAccessibleObject.GetChildCount()); Assert.False(dataGridView.IsHandleCreated); @@ -1179,7 +1179,7 @@ public void DataGridViewTopRowAccessibleObject_GetChildCount_ReturnsThreeIfRowHe dataGridView.Columns.Add("Column 2", "Column 2"); dataGridView.Columns.Add("Column 3", "Column 3"); - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; Assert.Equal(3, topRowAccessibleObject.GetChildCount()); Assert.False(dataGridView.IsHandleCreated); @@ -1194,7 +1194,7 @@ public void DataGridViewTopRowAccessibleObject_GetChildCount_ReturnsTwo_IfRowHea dataGridView.Columns.Add("Column 3", "Column 3"); dataGridView.Columns[0].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; Assert.Equal(2, topRowAccessibleObject.GetChildCount()); Assert.False(dataGridView.IsHandleCreated); @@ -1210,7 +1210,7 @@ public void DataGridViewTopRowAccessibleObject_GetChildCount_ReturnsOne_IfRowHea dataGridView.Columns[0].Visible = false; dataGridView.Columns[1].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; Assert.Equal(1, topRowAccessibleObject.GetChildCount()); Assert.False(dataGridView.IsHandleCreated); @@ -1227,7 +1227,7 @@ public void DataGridViewTopRowAccessibleObject_GetChildCount_ReturnsZero_IfRowHe dataGridView.Columns[1].Visible = false; dataGridView.Columns[2].Visible = false; - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; Assert.Equal(0, topRowAccessibleObject.GetChildCount()); Assert.False(dataGridView.IsHandleCreated); @@ -1237,7 +1237,7 @@ public void DataGridViewTopRowAccessibleObject_GetChildCount_ReturnsZero_IfRowHe public void DataGridViewTopRowAccessibleObject_GetPropertyValue_ReturnsExpected() { using DataGridView dataGridView = new(); - AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor().Dynamic.TopRowAccessibilityObject; + AccessibleObject topRowAccessibleObject = dataGridView.AccessibilityObject.TestAccessor.Dynamic.TopRowAccessibilityObject; Assert.True((bool)topRowAccessibleObject.GetPropertyValue(UIA_PROPERTY_ID.UIA_IsLegacyIAccessiblePatternAvailablePropertyId)); Assert.Equal(string.Empty, ((BSTR)topRowAccessibleObject.GetPropertyValue(UIA_PROPERTY_ID.UIA_HelpTextPropertyId)).ToStringAndFree()); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DateTimePicker.DateTimePickerAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DateTimePicker.DateTimePickerAccessibleObjectTests.cs index 74de902db98..c8aa451a614 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DateTimePicker.DateTimePickerAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/DateTimePicker.DateTimePickerAccessibleObjectTests.cs @@ -126,7 +126,7 @@ public void DateTimePickerAccessibleObject_ExpandCollapseState_ReturnsExpected(i var expected = (ExpandCollapseState)expandCollapseState; var accessibleObject = (DateTimePickerAccessibleObject)dateTimePicker.AccessibilityObject; - dateTimePicker.TestAccessor().Dynamic._expandCollapseState = expected; + dateTimePicker.TestAccessor.Dynamic._expandCollapseState = expected; ExpandCollapseState actual = accessibleObject.ExpandCollapseState; @@ -160,7 +160,7 @@ public void DateTimePickerAccessibleObject_Collapse_IfHandleIsNotCreated_Nothing // ExpandCollapseState is Collapsed before some actions Assert.Equal(ExpandCollapseState.ExpandCollapseState_Collapsed, accessibleObject.ExpandCollapseState); - dateTimePicker.TestAccessor().Dynamic._expandCollapseState = ExpandCollapseState.ExpandCollapseState_Expanded; + dateTimePicker.TestAccessor.Dynamic._expandCollapseState = ExpandCollapseState.ExpandCollapseState_Expanded; Assert.Equal(ExpandCollapseState.ExpandCollapseState_Expanded, accessibleObject.ExpandCollapseState); @@ -181,7 +181,7 @@ public void DateTimePickerAccessibleObject_Expand_IfControlAlreadyIsExpanded_Not // ExpandCollapseState is Collapsed before some actions Assert.Equal(ExpandCollapseState.ExpandCollapseState_Collapsed, accessibleObject.ExpandCollapseState); - dateTimePicker.TestAccessor().Dynamic._expandCollapseState = ExpandCollapseState.ExpandCollapseState_Expanded; + dateTimePicker.TestAccessor.Dynamic._expandCollapseState = ExpandCollapseState.ExpandCollapseState_Expanded; Assert.Equal(ExpandCollapseState.ExpandCollapseState_Expanded, accessibleObject.ExpandCollapseState); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ErrorProvider.ControlItem.ControlItemAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ErrorProvider.ControlItem.ControlItemAccessibleObjectTests.cs index e521a4264ef..35b40ae6546 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ErrorProvider.ControlItem.ControlItemAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ErrorProvider.ControlItem.ControlItemAccessibleObjectTests.cs @@ -20,10 +20,10 @@ public void ControlItemAccessibleObjectTests_Ctor_Default() .GetNestedType("ControlItemAccessibleObject", BindingFlags.NonPublic | BindingFlags.Instance); var accessibleObject = (AccessibleObject)Activator.CreateInstance(type, [null, null, null, null]); - Assert.Null(accessibleObject.TestAccessor().Dynamic._controlItem); - Assert.Null(accessibleObject.TestAccessor().Dynamic._window); - Assert.Null(accessibleObject.TestAccessor().Dynamic._control); - Assert.Null(accessibleObject.TestAccessor().Dynamic._provider); + Assert.Null(accessibleObject.TestAccessor.Dynamic._controlItem); + Assert.Null(accessibleObject.TestAccessor.Dynamic._window); + Assert.Null(accessibleObject.TestAccessor.Dynamic._control); + Assert.Null(accessibleObject.TestAccessor.Dynamic._provider); Assert.Equal(AccessibleRole.Alert, accessibleObject.Role); } @@ -153,7 +153,7 @@ public void ControlItemAccessibleObjectTests_IsIAccessibleExSupported_ReturnsExp .GetNestedType("ControlItemAccessibleObject", BindingFlags.NonPublic | BindingFlags.Instance); var accessibleObject = (AccessibleObject)Activator.CreateInstance(type, [item, window, control, provider]); - Assert.NotNull(accessibleObject.TestAccessor().Dynamic._controlItem); + Assert.NotNull(accessibleObject.TestAccessor.Dynamic._controlItem); Assert.True(accessibleObject.IsIAccessibleExSupported()); Assert.False(control.IsHandleCreated); } @@ -240,14 +240,14 @@ public void ControlItemAccessibleObjectTests_FragmentNavigate_NextSibling_Return AccessibleObject accessibleObject3 = item3.AccessibilityObject; // Window is null while controlItem isn't added to window. - Assert.Null(accessibleObject1.TestAccessor().Dynamic._window); - Assert.Null(accessibleObject2.TestAccessor().Dynamic._window); - Assert.Null(accessibleObject3.TestAccessor().Dynamic._window); + Assert.Null(accessibleObject1.TestAccessor.Dynamic._window); + Assert.Null(accessibleObject2.TestAccessor.Dynamic._window); + Assert.Null(accessibleObject3.TestAccessor.Dynamic._window); // So add the reference manually. - accessibleObject1.TestAccessor().Dynamic._window = window; - accessibleObject2.TestAccessor().Dynamic._window = window; - accessibleObject3.TestAccessor().Dynamic._window = window; + accessibleObject1.TestAccessor.Dynamic._window = window; + accessibleObject2.TestAccessor.Dynamic._window = window; + accessibleObject3.TestAccessor.Dynamic._window = window; Assert.Equal(accessibleObject2, accessibleObject1.FragmentNavigate(NavigateDirection.NavigateDirection_NextSibling)); Assert.Equal(accessibleObject3, accessibleObject2.FragmentNavigate(NavigateDirection.NavigateDirection_NextSibling)); @@ -273,14 +273,14 @@ public void ControlItemAccessibleObjectTests_FragmentNavigate_PreviousSibling_Re AccessibleObject accessibleObject3 = item3.AccessibilityObject; // Window is null while controlItem isn't added to window. - Assert.Null(accessibleObject1.TestAccessor().Dynamic._window); - Assert.Null(accessibleObject2.TestAccessor().Dynamic._window); - Assert.Null(accessibleObject3.TestAccessor().Dynamic._window); + Assert.Null(accessibleObject1.TestAccessor.Dynamic._window); + Assert.Null(accessibleObject2.TestAccessor.Dynamic._window); + Assert.Null(accessibleObject3.TestAccessor.Dynamic._window); // So add the reference manually. - accessibleObject1.TestAccessor().Dynamic._window = window; - accessibleObject2.TestAccessor().Dynamic._window = window; - accessibleObject3.TestAccessor().Dynamic._window = window; + accessibleObject1.TestAccessor.Dynamic._window = window; + accessibleObject2.TestAccessor.Dynamic._window = window; + accessibleObject3.TestAccessor.Dynamic._window = window; Assert.Null(accessibleObject1.FragmentNavigate(NavigateDirection.NavigateDirection_PreviousSibling)); Assert.Equal(accessibleObject1, accessibleObject2.FragmentNavigate(NavigateDirection.NavigateDirection_PreviousSibling)); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ErrorProvider.ErrorWindow.ErrorWindowAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ErrorProvider.ErrorWindow.ErrorWindowAccessibleObjectTests.cs index 2ff157d9845..08b7cddfbf1 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ErrorProvider.ErrorWindow.ErrorWindowAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ErrorProvider.ErrorWindow.ErrorWindowAccessibleObjectTests.cs @@ -19,7 +19,7 @@ public void ErrorWindowAccessibleObject_Ctor_Default() .GetNestedType("ErrorWindowAccessibleObject", BindingFlags.NonPublic | BindingFlags.Instance); var accessibleObject = (AccessibleObject)Activator.CreateInstance(type, [null]); - Assert.Null(accessibleObject.TestAccessor().Dynamic._owner); + Assert.Null(accessibleObject.TestAccessor.Dynamic._owner); Assert.Equal(AccessibleRole.Grouping, accessibleObject.Role); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/LinkLabel.Link.LinkAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/LinkLabel.Link.LinkAccessibleObjectTests.cs index 54060e1b9bb..7a6dd8c75b8 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/LinkLabel.Link.LinkAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/LinkLabel.Link.LinkAccessibleObjectTests.cs @@ -39,7 +39,7 @@ public void LinkAccessibleObject_CurrentIndex_IsExpected() for (int index = 0; index < 4; index++) { LinkAccessibleObject linkAccessibleObject = linkLabel.Links[index].AccessibleObject; - int actual = linkAccessibleObject.TestAccessor().Dynamic.CurrentIndex; + int actual = linkAccessibleObject.TestAccessor.Dynamic.CurrentIndex; Assert.Equal(index, actual); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListBoxAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListBoxAccessibleObjectTests.cs index 58a21639cb9..25afeea0dbb 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListBoxAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListBoxAccessibleObjectTests.cs @@ -102,7 +102,7 @@ public void ListBox_ReleaseUiaProvider_ClearsItemsAccessibleObjects() listBox.ReleaseUiaProvider(listBox.HWND); - Assert.Equal(0, accessibleObject.TestAccessor().Dynamic._itemAccessibleObjects.Count); + Assert.Equal(0, accessibleObject.TestAccessor.Dynamic._itemAccessibleObjects.Count); } [WinFormsFact] @@ -113,7 +113,7 @@ public void ListBoxItems_Clear_ClearsItemsAccessibleObjects() listBox.Items.Clear(); - Assert.Equal(0, accessibleObject.TestAccessor().Dynamic._itemAccessibleObjects.Count); + Assert.Equal(0, accessibleObject.TestAccessor.Dynamic._itemAccessibleObjects.Count); } [WinFormsFact] @@ -122,11 +122,11 @@ public void ListBoxItems_Remove_RemovesItemAccessibleObject() using ListBox listBox = InitializeListBoxWithItems(); ListBoxAccessibleObject accessibleObject = InitListBoxItemsAccessibleObjects(listBox); ItemArray.Entry? item = listBox.Items.InnerArray.Entries[0]; - Assert.True(accessibleObject.TestAccessor().Dynamic._itemAccessibleObjects.ContainsKey(item)); + Assert.True(accessibleObject.TestAccessor.Dynamic._itemAccessibleObjects.ContainsKey(item)); listBox.Items.Remove(item!); - Assert.False(accessibleObject.TestAccessor().Dynamic._itemAccessibleObjects.ContainsKey(item)); + Assert.False(accessibleObject.TestAccessor.Dynamic._itemAccessibleObjects.ContainsKey(item)); } [WinFormsFact] @@ -243,7 +243,7 @@ private ListBoxAccessibleObject InitListBoxItemsAccessibleObjects(ListBox listBo accessibilityObject.GetChild(i); } - Assert.Equal(childCount, accessibilityObject.TestAccessor().Dynamic._itemAccessibleObjects.Count); + Assert.Equal(childCount, accessibilityObject.TestAccessor.Dynamic._itemAccessibleObjects.Count); return accessibilityObject; } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListVIew.ListViewAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListVIew.ListViewAccessibleObjectTests.cs index cd5f5fd3891..fc4f8de3011 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListVIew.ListViewAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListVIew.ListViewAccessibleObjectTests.cs @@ -1623,7 +1623,7 @@ public void ListViewAccessibleObject_GetChildCount_ReturnExpected_GroupWithInval AccessibleObject accessibleObject = listView.AccessibilityObject; Assert.Equal(2, accessibleObject.GetChildCount()); - listView.Groups[1].TestAccessor().Dynamic._accessibilityObject = new AccessibleObject(); + listView.Groups[1].TestAccessor.Dynamic._accessibilityObject = new AccessibleObject(); Assert.Equal(1, accessibleObject.GetChildCount()); Assert.True(listView.IsHandleCreated); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListViewGroup.ListViewGroupAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListViewGroup.ListViewGroupAccessibleObjectTests.cs index e60f8434e69..acb8902da01 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListViewGroup.ListViewGroupAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListViewGroup.ListViewGroupAccessibleObjectTests.cs @@ -1356,8 +1356,8 @@ public void ListViewGroupAccessibleObject_IsDisconnected_WhenListViewReleasesUia listView.ReleaseUiaProvider(listView.HWND); - Assert.Null(group.TestAccessor().Dynamic._accessibilityObject); - Assert.Null(listView.DefaultGroup.TestAccessor().Dynamic._accessibilityObject); + Assert.Null(group.TestAccessor.Dynamic._accessibilityObject); + Assert.Null(listView.DefaultGroup.TestAccessor.Dynamic._accessibilityObject); Assert.True(listView.IsHandleCreated); } @@ -1371,7 +1371,7 @@ public void ListViewGroupAccessibleObject_IsDisconnected_WhenGroupsAreCleared() listView.Groups.Clear(); - Assert.Null(group.TestAccessor().Dynamic._accessibilityObject); + Assert.Null(group.TestAccessor.Dynamic._accessibilityObject); Assert.False(listView.IsHandleCreated); } @@ -1385,14 +1385,14 @@ public void ListViewGroupAccessibleObject_IsDisconnected_WhenGroupIsRemoved() listView.Groups.Remove(group); - Assert.Null(group.TestAccessor().Dynamic._accessibilityObject); + Assert.Null(group.TestAccessor.Dynamic._accessibilityObject); Assert.False(listView.IsHandleCreated); } private static void EnforceAccessibleObjectCreation(ListViewGroup group) { _ = group.AccessibilityObject; - Assert.NotNull(group.TestAccessor().Dynamic._accessibilityObject); + Assert.NotNull(group.TestAccessor.Dynamic._accessibilityObject); } private ListView GetListViewItemWithInvisibleItems(View view) diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListViewItem.ListViewItemAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListViewItem.ListViewItemAccessibleObjectTests.cs index 7190db6c29c..d3f9c106a5d 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListViewItem.ListViewItemAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListViewItem.ListViewItemAccessibleObjectTests.cs @@ -1851,7 +1851,7 @@ public void ListViewItemAccessibleObject_IsDisconnected_WhenListViewReleasesUiaP listView.ReleaseUiaProvider(listView.HWND); - Assert.Null(item.TestAccessor().Dynamic._accessibilityObject); + Assert.Null(item.TestAccessor.Dynamic._accessibilityObject); Assert.True(listView.IsHandleCreated); } @@ -1865,7 +1865,7 @@ public void ListViewItemAccessibleObject_IsDisconnected_WhenListViewIsCleared() listView.Clear(); - Assert.Null(item.TestAccessor().Dynamic._accessibilityObject); + Assert.Null(item.TestAccessor.Dynamic._accessibilityObject); Assert.False(listView.IsHandleCreated); } @@ -1879,7 +1879,7 @@ public void ListViewItemAccessibleObject_IsDisconnected_WhenItemsAreCleared() listView.Items.Clear(); - Assert.Null(item.TestAccessor().Dynamic._accessibilityObject); + Assert.Null(item.TestAccessor.Dynamic._accessibilityObject); Assert.False(listView.IsHandleCreated); } @@ -1893,7 +1893,7 @@ public void ListViewItemAccessibleObject_IsDisconnected_WhenItemIsRemoved() listView.Items.Remove(item); - Assert.Null(item.TestAccessor().Dynamic._accessibilityObject); + Assert.Null(item.TestAccessor.Dynamic._accessibilityObject); Assert.False(listView.IsHandleCreated); } @@ -1907,14 +1907,14 @@ public void ListViewItemAccessibleObject_IsDisconnected_WhenItemIsReplaced() listView.Items[0] = new ListViewItem(); - Assert.Null(item.TestAccessor().Dynamic._accessibilityObject); + Assert.Null(item.TestAccessor.Dynamic._accessibilityObject); Assert.False(listView.IsHandleCreated); } private static void EnforceAccessibleObjectCreation(ListViewItem listViewItem) { _ = listViewItem.AccessibilityObject; - Assert.NotNull(listViewItem.TestAccessor().Dynamic._accessibilityObject); + Assert.NotNull(listViewItem.TestAccessor.Dynamic._accessibilityObject); } private ListView GetBoundsListView(View view, bool showGroups, bool virtualMode) diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListViewItem.ListViewItemDetailsAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListViewItem.ListViewItemDetailsAccessibleObjectTests.cs index e2ee1c06e5f..1cabcda2db6 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListViewItem.ListViewItemDetailsAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListViewItem.ListViewItemDetailsAccessibleObjectTests.cs @@ -122,11 +122,11 @@ public void ListViewItemDetailsAccessibleObject_SubItemAccessibleObjects_AreDisc Assert.NotNull(item.AccessibilityObject.GetChild(0)); Assert.NotNull(item.AccessibilityObject.GetChild(1)); Assert.NotNull(item.AccessibilityObject.GetChild(2)); - Assert.NotEmpty(item.AccessibilityObject.TestAccessor().Dynamic._listViewSubItemAccessibleObjects); + Assert.NotEmpty(item.AccessibilityObject.TestAccessor.Dynamic._listViewSubItemAccessibleObjects); item.ReleaseUiaProvider(); - Assert.Empty(item.AccessibilityObject.TestAccessor().Dynamic._listViewSubItemAccessibleObjects); + Assert.Empty(item.AccessibilityObject.TestAccessor.Dynamic._listViewSubItemAccessibleObjects); Assert.False(control.IsHandleCreated); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListViewItem.ListViewSubItem.ListViewSubItemAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListViewItem.ListViewSubItem.ListViewSubItemAccessibleObjectTests.cs index 995640cc0fd..6ae48718f31 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListViewItem.ListViewSubItem.ListViewSubItemAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListViewItem.ListViewSubItem.ListViewSubItemAccessibleObjectTests.cs @@ -1069,7 +1069,7 @@ public void ListViewSubItemAccessibleObject_IsDisconnected_WhenListViewReleasesU listView.ReleaseUiaProvider(listView.HWND); - Assert.Null(listViewSubItem.TestAccessor().Dynamic._accessibilityObject); + Assert.Null(listViewSubItem.TestAccessor.Dynamic._accessibilityObject); Assert.True(listView.IsHandleCreated); } @@ -1085,7 +1085,7 @@ public void ListViewSubItemAccessibleObject_IsDisconnected_WhenListViewIsCleared listView.Clear(); - Assert.Null(listViewSubItem.TestAccessor().Dynamic._accessibilityObject); + Assert.Null(listViewSubItem.TestAccessor.Dynamic._accessibilityObject); Assert.False(listView.IsHandleCreated); } @@ -1101,7 +1101,7 @@ public void ListViewSubItemAccessibleObject_IsDisconnected_WhenOwningItemIsRemov listView.Items.RemoveAt(0); - Assert.Null(listViewSubItem.TestAccessor().Dynamic._accessibilityObject); + Assert.Null(listViewSubItem.TestAccessor.Dynamic._accessibilityObject); Assert.False(listView.IsHandleCreated); } @@ -1117,7 +1117,7 @@ public void ListViewSubItemAccessibleObject_IsDisconnected_WhenSubItemIsRemoved( listView.Items[0].SubItems.Remove(listViewSubItem); - Assert.Null(listViewSubItem.TestAccessor().Dynamic._accessibilityObject); + Assert.Null(listViewSubItem.TestAccessor.Dynamic._accessibilityObject); Assert.False(listView.IsHandleCreated); } @@ -1133,7 +1133,7 @@ public void ListViewSubItemAccessibleObject_IsDisconnected_WhenSubItemsAreCleare listView.Items[0].SubItems.Clear(); - Assert.Null(listViewSubItem.TestAccessor().Dynamic._accessibilityObject); + Assert.Null(listViewSubItem.TestAccessor.Dynamic._accessibilityObject); Assert.False(listView.IsHandleCreated); } @@ -1149,7 +1149,7 @@ public void ListViewSubItemAccessibleObject_IsDisconnected_WhenSubItemIsReplaced listView.Items[0] = new ListViewItem(); - Assert.Null(listViewSubItem.TestAccessor().Dynamic._accessibilityObject); + Assert.Null(listViewSubItem.TestAccessor.Dynamic._accessibilityObject); Assert.False(listView.IsHandleCreated); } @@ -1166,18 +1166,18 @@ public void ListViewSubItemAccessibleObject_IsDisconnected_WhenOwningItemIsRepla int subItemIndex = listView.Items[0].SubItems.IndexOf(listViewSubItem); listView.Items[0].SubItems[subItemIndex] = new ListViewItem.ListViewSubItem(); - Assert.Null(listViewSubItem.TestAccessor().Dynamic._accessibilityObject); + Assert.Null(listViewSubItem.TestAccessor.Dynamic._accessibilityObject); Assert.False(listView.IsHandleCreated); } private static void EnforceAccessibleObjectCreation(ListViewItem item) { _ = item.AccessibilityObject; - Assert.NotNull(item.TestAccessor().Dynamic._accessibilityObject); + Assert.NotNull(item.TestAccessor.Dynamic._accessibilityObject); foreach (ListViewItem.ListViewSubItem subItem in item.SubItems) { _ = subItem.AccessibilityObject; - Assert.NotNull(subItem.TestAccessor().Dynamic._accessibilityObject); + Assert.NotNull(subItem.TestAccessor.Dynamic._accessibilityObject); } } } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListViewLabelEditAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListViewLabelEditAccessibleObjectTests.cs index be7d92553f5..359073043f4 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListViewLabelEditAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ListViewLabelEditAccessibleObjectTests.cs @@ -17,7 +17,7 @@ public unsafe void ListViewLabelEditAccessibleObject_GetPropertyValue_ReturnsExp { using ListView listView = CreateListViewAndStartEditing(); - ListViewLabelEditNativeWindow labelEdit = listView.TestAccessor().Dynamic._labelEdit; + ListViewLabelEditNativeWindow labelEdit = listView.TestAccessor.Dynamic._labelEdit; ListViewLabelEditAccessibleObject accessibilityObject = (ListViewLabelEditAccessibleObject)labelEdit.AccessibilityObject; using VARIANT runtimeId = accessibilityObject.GetPropertyValue(UIA_PROPERTY_ID.UIA_RuntimeIdPropertyId); Assert.Equal(accessibilityObject.RuntimeId, runtimeId.ToObject()); @@ -53,7 +53,7 @@ public void ListViewLabelEditAccessibleObject_FragmentNavigate_ReturnsExpected() { using ListView listView = CreateListViewAndStartEditing(); - ListViewLabelEditNativeWindow labelEdit = listView.TestAccessor().Dynamic._labelEdit; + ListViewLabelEditNativeWindow labelEdit = listView.TestAccessor.Dynamic._labelEdit; ListViewLabelEditAccessibleObject accessibilityObject = (ListViewLabelEditAccessibleObject)labelEdit.AccessibilityObject; Assert.Equal(listView._listViewSubItem.AccessibilityObject, accessibilityObject.FragmentNavigate(NavigateDirection.NavigateDirection_Parent)); @@ -65,7 +65,7 @@ public void ListViewLabelEditAccessibleObject_IsPatternSupported_ReturnsExpected { using ListView listView = CreateListViewAndStartEditing(); - ListViewLabelEditNativeWindow labelEdit = listView.TestAccessor().Dynamic._labelEdit; + ListViewLabelEditNativeWindow labelEdit = listView.TestAccessor.Dynamic._labelEdit; ListViewLabelEditAccessibleObject accessibilityObject = (ListViewLabelEditAccessibleObject)labelEdit.AccessibilityObject; Assert.True(accessibilityObject.IsPatternSupported(UIA_PATTERN_ID.UIA_TextPatternId)); @@ -79,7 +79,7 @@ public void ListViewLabelEditAccessibleObject_RuntimeId_ReturnsExpected() { using ListView listView = CreateListViewAndStartEditing(); - ListViewLabelEditNativeWindow labelEdit = listView.TestAccessor().Dynamic._labelEdit; + ListViewLabelEditNativeWindow labelEdit = listView.TestAccessor.Dynamic._labelEdit; ListViewLabelEditAccessibleObject accessibilityObject = (ListViewLabelEditAccessibleObject)labelEdit.AccessibilityObject; Assert.Equal(new int[] { AccessibleObject.RuntimeIDFirstItem, PARAM.ToInt(labelEdit.Handle) }, accessibilityObject.RuntimeId); @@ -90,7 +90,7 @@ public void ListViewLabelEditAccessibleObject_FragmentRoot_ReturnsExpected() { using ListView listView = CreateListViewAndStartEditing(); - ListViewLabelEditNativeWindow labelEdit = listView.TestAccessor().Dynamic._labelEdit; + ListViewLabelEditNativeWindow labelEdit = listView.TestAccessor.Dynamic._labelEdit; ListViewLabelEditAccessibleObject accessibilityObject = (ListViewLabelEditAccessibleObject)labelEdit.AccessibilityObject; Assert.Equal(listView.AccessibilityObject, accessibilityObject.FragmentRoot); @@ -101,7 +101,7 @@ public unsafe void ListViewLabelEditAccessibleObject_HostRawElementProvider_Retu { using ListView listView = CreateListViewAndStartEditing(); - ListViewLabelEditNativeWindow labelEdit = listView.TestAccessor().Dynamic._labelEdit; + ListViewLabelEditNativeWindow labelEdit = listView.TestAccessor.Dynamic._labelEdit; ListViewLabelEditAccessibleObject accessibilityObject = (ListViewLabelEditAccessibleObject)labelEdit.AccessibilityObject; using ComScope elementProvider = new(accessibilityObject.HostRawElementProvider); Assert.False(elementProvider.IsNull); @@ -112,7 +112,7 @@ public void ListViewLabelEditAccessibleObject_Name_ReturnsExpected() { using ListView listView = CreateListViewAndStartEditing(); - ListViewLabelEditNativeWindow labelEdit = listView.TestAccessor().Dynamic._labelEdit; + ListViewLabelEditNativeWindow labelEdit = listView.TestAccessor.Dynamic._labelEdit; ListViewLabelEditAccessibleObject accessibilityObject = (ListViewLabelEditAccessibleObject)labelEdit.AccessibilityObject; Assert.Equal(listView.Items[0].Text, accessibilityObject.Name); @@ -123,7 +123,7 @@ public void ListViewLabelEditAccessibleObject_Ctor_NullOwningListView_ThrowsArgu { using ListView listView = CreateListViewAndStartEditing(); - ListViewLabelEditNativeWindow labelEdit = listView.TestAccessor().Dynamic._labelEdit; + ListViewLabelEditNativeWindow labelEdit = listView.TestAccessor.Dynamic._labelEdit; Assert.Throws(() => new ListViewLabelEditAccessibleObject(null, labelEdit)); } @@ -138,7 +138,7 @@ public void ListViewLabelEditUiaTextProvider_Ctor_NullOwningListView_ThrowsArgum { using ListView listView = CreateListViewAndStartEditing(); - ListViewLabelEditNativeWindow labelEdit = listView.TestAccessor().Dynamic._labelEdit; + ListViewLabelEditNativeWindow labelEdit = listView.TestAccessor.Dynamic._labelEdit; Assert.Throws(() => new LabelEditUiaTextProvider(null, labelEdit, labelEdit.AccessibilityObject)); } @@ -147,7 +147,7 @@ public void ListViewLabelEditUiaTextProvider_Ctor_NullChildEditAccessibilityObje { using ListView listView = CreateListViewAndStartEditing(); - ListViewLabelEditNativeWindow labelEdit = listView.TestAccessor().Dynamic._labelEdit; + ListViewLabelEditNativeWindow labelEdit = listView.TestAccessor.Dynamic._labelEdit; Assert.Throws(() => new LabelEditUiaTextProvider(listView, labelEdit, null)); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarAccessibleObjectTests.cs index b6c0c319060..e6f474c93d2 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarAccessibleObjectTests.cs @@ -21,7 +21,7 @@ public void CalendarAccessibleObject_ctor_default() CalendarAccessibleObject calendar = new(controlAccessibleObject, calendarIndex, name); Assert.Equal(controlAccessibleObject, calendar.Parent); - Assert.Equal(calendarIndex, calendar.TestAccessor().Dynamic._calendarIndex); + Assert.Equal(calendarIndex, calendar.TestAccessor.Dynamic._calendarIndex); Assert.Equal(name, calendar.Name); Assert.False(control.IsHandleCreated); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarButtonAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarButtonAccessibleObjectTests.cs index 6c850d4f661..c1f5c00af71 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarButtonAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarButtonAccessibleObjectTests.cs @@ -19,7 +19,7 @@ public void CalendarButtonAccessibleObject_ctor_default() buttonAccessibleObject.Parent.Should().Be(controlAccessibleObject); - bool canGetDefaultActionInternal = buttonAccessibleObject.TestAccessor().Dynamic.CanGetDefaultActionInternal; + bool canGetDefaultActionInternal = buttonAccessibleObject.TestAccessor.Dynamic.CanGetDefaultActionInternal; canGetDefaultActionInternal.Should().BeFalse(); control.IsHandleCreated.Should().BeFalse(); } @@ -123,7 +123,7 @@ public void CalendarButtonAccessibleObject_RaiseMouseClick_DoesNotThrow_WhenCont MonthCalendarAccessibleObject controlAccessibleObject = (MonthCalendarAccessibleObject)control.AccessibilityObject; SubCalendarButtonAccessibleObject buttonAccessibleObject = new SubCalendarButtonAccessibleObject(controlAccessibleObject); - Action action = () => buttonAccessibleObject.TestAccessor().Dynamic.RaiseMouseClick(); + Action action = () => buttonAccessibleObject.TestAccessor.Dynamic.RaiseMouseClick(); action.Should().NotThrow(); control.IsHandleCreated.Should().BeTrue(); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarCellAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarCellAccessibleObjectTests.cs index 342d920fe34..4d135c46290 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarCellAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarCellAccessibleObjectTests.cs @@ -18,13 +18,13 @@ public void CalendarCellAccessibleObject_ctor_default() using MonthCalendar control = new(); CalendarCellAccessibleObject cellAccessibleObject = CreateCalendarCellAccessibleObject(control); - int columnIndexResult = cellAccessibleObject.TestAccessor().Dynamic._columnIndex; + int columnIndexResult = cellAccessibleObject.TestAccessor.Dynamic._columnIndex; columnIndexResult.Should().Be(0); - int rowIndexResult = cellAccessibleObject.TestAccessor().Dynamic._rowIndex; + int rowIndexResult = cellAccessibleObject.TestAccessor.Dynamic._rowIndex; rowIndexResult.Should().Be(0); - int calendarIndexResult = cellAccessibleObject.TestAccessor().Dynamic._calendarIndex; + int calendarIndexResult = cellAccessibleObject.TestAccessor.Dynamic._calendarIndex; calendarIndexResult.Should().Be(0); cellAccessibleObject.CanGetDescriptionInternal.Should().BeFalse(); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarDayOfWeekCellAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarDayOfWeekCellAccessibleObjectTests.cs index 6c0f84de781..836bbd1ba20 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarDayOfWeekCellAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarDayOfWeekCellAccessibleObjectTests.cs @@ -16,13 +16,13 @@ public void CalendarDayOfWeekCellAccessibleObject_ctor_default() using MonthCalendar control = new(); CalendarDayOfWeekCellAccessibleObject cellAccessibleObject = CreateCalendarDayOfWeekCellCellAccessibleObject(control); - int columnIndexResult = cellAccessibleObject.TestAccessor().Dynamic._columnIndex; + int columnIndexResult = cellAccessibleObject.TestAccessor.Dynamic._columnIndex; columnIndexResult.Should().Be(0); - int rowIndexResult = cellAccessibleObject.TestAccessor().Dynamic._rowIndex; + int rowIndexResult = cellAccessibleObject.TestAccessor.Dynamic._rowIndex; rowIndexResult.Should().Be(0); - int calendarIndexResult = cellAccessibleObject.TestAccessor().Dynamic._calendarIndex; + int calendarIndexResult = cellAccessibleObject.TestAccessor.Dynamic._calendarIndex; calendarIndexResult.Should().Be(0); cellAccessibleObject.Name.Should().Be("Test name"); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarPreviousButtonAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarPreviousButtonAccessibleObjectTests.cs index 4ed861b310b..12e0723505c 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarPreviousButtonAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarPreviousButtonAccessibleObjectTests.cs @@ -17,7 +17,7 @@ public void CalendarPreviousButtonAccessibleObject_ctor_default() var controlAccessibleObject = (MonthCalendarAccessibleObject)control.AccessibilityObject; CalendarPreviousButtonAccessibleObject previousButtonAccessibleObject = new(controlAccessibleObject); - controlAccessibleObject.Should().BeEquivalentTo(previousButtonAccessibleObject.TestAccessor().Dynamic._monthCalendarAccessibleObject); + controlAccessibleObject.Should().BeEquivalentTo(previousButtonAccessibleObject.TestAccessor.Dynamic._monthCalendarAccessibleObject); control.IsHandleCreated.Should().BeFalse(); previousButtonAccessibleObject.CanGetDescriptionInternal.Should().BeFalse(); previousButtonAccessibleObject.CanGetNameInternal.Should().BeFalse(); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarRowAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarRowAccessibleObjectTests.cs index 20d75ff8df5..0d893392e95 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarRowAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarRowAccessibleObjectTests.cs @@ -16,10 +16,10 @@ public void CalendarRowAccessibleObject_ctor_default() using MonthCalendar control = new(); CalendarRowAccessibleObject rowAccessibleObject = CreateCalendarRowAccessibleObject(control); - int calendarIndexResult = rowAccessibleObject.TestAccessor().Dynamic._calendarIndex; + int calendarIndexResult = rowAccessibleObject.TestAccessor.Dynamic._calendarIndex; calendarIndexResult.Should().Be(0); - int rowIndexResult = rowAccessibleObject.TestAccessor().Dynamic._rowIndex; + int rowIndexResult = rowAccessibleObject.TestAccessor.Dynamic._rowIndex; rowIndexResult.Should().Be(0); control.IsHandleCreated.Should().BeFalse(); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarTodayLinkAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarTodayLinkAccessibleObjectTests.cs index 11059035b8f..19f77e93f1b 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarTodayLinkAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarTodayLinkAccessibleObjectTests.cs @@ -17,13 +17,13 @@ public void CalendarTodayLinkAccessibleObject_ctor_default() var controlAccessibleObject = (MonthCalendarAccessibleObject)control.AccessibilityObject; CalendarTodayLinkAccessibleObject todayLinkAccessibleObject = new(controlAccessibleObject); - controlAccessibleObject.Should().BeEquivalentTo(todayLinkAccessibleObject.TestAccessor().Dynamic._monthCalendarAccessibleObject); + controlAccessibleObject.Should().BeEquivalentTo(todayLinkAccessibleObject.TestAccessor.Dynamic._monthCalendarAccessibleObject); control.IsHandleCreated.Should().BeFalse(); - bool canGetDescriptionInternalResult = todayLinkAccessibleObject.TestAccessor().Dynamic.CanGetDescriptionInternal; + bool canGetDescriptionInternalResult = todayLinkAccessibleObject.TestAccessor.Dynamic.CanGetDescriptionInternal; canGetDescriptionInternalResult.Should().BeFalse(); - bool CanGetNameInternalResult = todayLinkAccessibleObject.TestAccessor().Dynamic.CanGetNameInternal; + bool CanGetNameInternalResult = todayLinkAccessibleObject.TestAccessor.Dynamic.CanGetNameInternal; CanGetNameInternalResult.Should().BeFalse(); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarWeekNumberCellAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarWeekNumberCellAccessibleObjectTests.cs index 8a2ad770d69..01d36045b90 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarWeekNumberCellAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.CalendarWeekNumberCellAccessibleObjectTests.cs @@ -16,9 +16,9 @@ public void CalendarWeekNumberCellAccessibleObject_ctor_default() using MonthCalendar control = new(); CalendarWeekNumberCellAccessibleObject cellAccessibleObject = CreateCalendarWeekNumberCellAccessibleObject(control); - Assert.Equal(0, cellAccessibleObject.TestAccessor().Dynamic._calendarIndex); - Assert.Equal(0, cellAccessibleObject.TestAccessor().Dynamic._rowIndex); - Assert.Equal(0, cellAccessibleObject.TestAccessor().Dynamic._columnIndex); + Assert.Equal(0, cellAccessibleObject.TestAccessor.Dynamic._calendarIndex); + Assert.Equal(0, cellAccessibleObject.TestAccessor.Dynamic._rowIndex); + Assert.Equal(0, cellAccessibleObject.TestAccessor.Dynamic._columnIndex); Assert.False(control.IsHandleCreated); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.MonthCalendarAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.MonthCalendarAccessibleObjectTests.cs index acfcad2d7fc..22f6b062440 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.MonthCalendarAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/MonthCalendar.MonthCalendarAccessibleObjectTests.cs @@ -170,7 +170,7 @@ public void MonthCalendarAccessibleObject_CastDayToDayOfWeek_IsExpected(Day day, using MonthCalendar monthCalendar = new(); var accessibleObject = (MonthCalendarAccessibleObject)monthCalendar.AccessibilityObject; - DayOfWeek actual = accessibleObject.TestAccessor().Dynamic.CastDayToDayOfWeek(day); + DayOfWeek actual = accessibleObject.TestAccessor.Dynamic.CastDayToDayOfWeek(day); Assert.Equal(expected, actual); Assert.False(monthCalendar.IsHandleCreated); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/PropertyGridToolStripButton.PropertyGridToolStripButtonAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/PropertyGridToolStripButton.PropertyGridToolStripButtonAccessibleObjectTests.cs index 4f57cb331f2..0283838ddd1 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/PropertyGridToolStripButton.PropertyGridToolStripButtonAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/PropertyGridToolStripButton.PropertyGridToolStripButtonAccessibleObjectTests.cs @@ -14,7 +14,7 @@ public void PropertyGridToolStripButtonAccessibleObject_IsItemSelected_ReturnsEx { using PropertyGrid propertyGrid = new(); propertyGrid.CreateControl(); - ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor().Dynamic._viewSortButtons; + ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor.Dynamic._viewSortButtons; AccessibleObject categoryButtonAccessibleObject = toolStripButtons[0].AccessibilityObject; AccessibleObject alphaButtonAccessibleObject = toolStripButtons[1].AccessibilityObject; @@ -31,7 +31,7 @@ public void PropertyGridToolStripButtonAccessibleObject_IsItemSelected_ReturnsEx public void PropertyGridToolStripButtonAccessibleObject_Role_IsRadiButton() { using PropertyGrid propertyGrid = new(); - ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor().Dynamic._viewSortButtons; + ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor.Dynamic._viewSortButtons; AccessibleObject accessibleObject = toolStripButtons[0].AccessibilityObject; Assert.Equal(AccessibleRole.RadioButton, accessibleObject.Role); @@ -41,8 +41,8 @@ public void PropertyGridToolStripButtonAccessibleObject_Role_IsRadiButton() public void PropertyGridToolStripButtonAccessibleObject_SelectionItemPatternSupported_ReturnsExpected() { using PropertyGrid propertyGrid = new(); - ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor().Dynamic._viewSortButtons; - ToolStripButton propertyPagesButton = propertyGrid.TestAccessor().Dynamic._viewPropertyPagesButton; + ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor.Dynamic._viewSortButtons; + ToolStripButton propertyPagesButton = propertyGrid.TestAccessor.Dynamic._viewPropertyPagesButton; AccessibleObject categoryButtonAccessibleObject = toolStripButtons[0].AccessibilityObject; AccessibleObject alphaButtonAccessibleObject = toolStripButtons[1].AccessibilityObject; AccessibleObject propertyPagesButtonAccessibleObject = propertyPagesButton.AccessibilityObject; @@ -59,7 +59,7 @@ public void PropertyGridToolStripButtonAccessibleObject_SelectionItemPatternSupp public void PropertyGridToolStripButtonAccessibleObject_GetPropertyValue_ControlType_IsRadioButton() { using PropertyGrid propertyGrid = new(); - ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor().Dynamic._viewSortButtons; + ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor.Dynamic._viewSortButtons; AccessibleObject accessibleObject = toolStripButtons[0].AccessibilityObject; UIA_CONTROLTYPE_ID actual = (UIA_CONTROLTYPE_ID)(int)accessibleObject.GetPropertyValue(UIA_PROPERTY_ID.UIA_ControlTypePropertyId); @@ -72,7 +72,7 @@ public void PropertyGridToolStripButtonAccessibleObject_AddToSelection_UpdatesCh { using PropertyGrid propertyGrid = new(); propertyGrid.CreateControl(); - ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor().Dynamic._viewSortButtons; + ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor.Dynamic._viewSortButtons; ToolStripButton categoryButton = toolStripButtons[0]; ToolStripButton alphaButton = toolStripButtons[1]; AccessibleObject alphaButtonAccessibleObject = alphaButton.AccessibilityObject; @@ -100,7 +100,7 @@ public void PropertyGridToolStripButtonAccessibleObject_Invoke_UpdatesCheckedSta { using PropertyGrid propertyGrid = new(); propertyGrid.CreateControl(); - ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor().Dynamic._viewSortButtons; + ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor.Dynamic._viewSortButtons; ToolStripButton categoryButton = toolStripButtons[0]; ToolStripButton alphaButton = toolStripButtons[1]; AccessibleObject alphaButtonAccessibleObject = alphaButton.AccessibilityObject; @@ -128,7 +128,7 @@ public void PropertyGridToolStripButtonAccessibleObject_RemoveFromSelection_Does { using PropertyGrid propertyGrid = new(); propertyGrid.CreateControl(); - ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor().Dynamic._viewSortButtons; + ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor.Dynamic._viewSortButtons; ToolStripButton categoryButton = toolStripButtons[0]; ToolStripButton alphaButton = toolStripButtons[1]; AccessibleObject alphaButtonAccessibleObject = alphaButton.AccessibilityObject; @@ -150,7 +150,7 @@ public void PropertyGridToolStripButtonAccessibleObject_SelectItem_UpdatesChecke { using PropertyGrid propertyGrid = new(); propertyGrid.CreateControl(); - ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor().Dynamic._viewSortButtons; + ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor.Dynamic._viewSortButtons; ToolStripButton categoryButton = toolStripButtons[0]; ToolStripButton alphaButton = toolStripButtons[1]; AccessibleObject alphaButtonAccessibleObject = alphaButton.AccessibilityObject; @@ -177,8 +177,8 @@ public void PropertyGridToolStripButtonAccessibleObject_SelectItem_UpdatesChecke public void PropertyGridToolStripButtonAccessibleObject_IsTogglePatternSupported_ReturnsExpected() { using PropertyGrid propertyGrid = new(); - ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor().Dynamic._viewSortButtons; - ToolStripButton propertyPagesButton = propertyGrid.TestAccessor().Dynamic._viewPropertyPagesButton; + ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor.Dynamic._viewSortButtons; + ToolStripButton propertyPagesButton = propertyGrid.TestAccessor.Dynamic._viewPropertyPagesButton; AccessibleObject categoryButtonAccessibleObject = toolStripButtons[0].AccessibilityObject; AccessibleObject alphaButtonAccessibleObject = toolStripButtons[1].AccessibilityObject; AccessibleObject propertyPagesButtonAccessibleObject = propertyPagesButton.AccessibilityObject; diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/TabPage.TabAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/TabPage.TabAccessibleObjectTests.cs index 362d6e5ee9e..83a3fbd9c61 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/TabPage.TabAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/TabPage.TabAccessibleObjectTests.cs @@ -40,13 +40,13 @@ public void TabAccessibilityObject_IsDisconnected_WhenTabPageReleasesUiaProvider tabPage.ReleaseUiaProvider(tabPage.HWND); - Assert.Null(tabPage.TestAccessor().Dynamic._tabAccessibilityObject); + Assert.Null(tabPage.TestAccessor.Dynamic._tabAccessibilityObject); Assert.True(tabPage.IsHandleCreated); static void EnforceTabAccessibilityObjectCreation(TabPage tabPage) { _ = tabPage.TabAccessibilityObject; - Assert.NotNull(tabPage.TestAccessor().Dynamic._tabAccessibilityObject); + Assert.NotNull(tabPage.TestAccessor.Dynamic._tabAccessibilityObject); } } @@ -616,7 +616,7 @@ public void TabAccessibleObject_DoDefaultAction_InvokeRaiseAutomationEvent(bool pages.AddRange([new(), new() { Enabled = tabPageEnabled }]); SubTabAccessibleObject tabAccessibleObject = new(pages[1]); - pages[1].TestAccessor().Dynamic._tabAccessibilityObject = tabAccessibleObject; + pages[1].TestAccessor.Dynamic._tabAccessibilityObject = tabAccessibleObject; Assert.IsType(tabControl.AccessibilityObject); @@ -639,7 +639,7 @@ public void TabAccessibleObject_DoDefaultAction_DoesNotInvoke_RaiseAutomationEve pages.AddRange([new(), new()]); SubTabAccessibleObject tabAccessibleObject = new(pages[0]); - pages[0].TestAccessor().Dynamic._tabAccessibilityObject = tabAccessibleObject; + pages[0].TestAccessor.Dynamic._tabAccessibilityObject = tabAccessibleObject; Assert.IsType(tabControl.AccessibilityObject); @@ -661,7 +661,7 @@ public void TabAccessibleObject_DoDefaultAction_DoesNotInvoke_RaiseAutomationEve pages.AddRange([new(), new()]); SubTabAccessibleObject tabAccessibleObject = new(pages[0]); - pages[0].TestAccessor().Dynamic._tabAccessibilityObject = tabAccessibleObject; + pages[0].TestAccessor.Dynamic._tabAccessibilityObject = tabAccessibleObject; pages[0].TabAccessibilityObject.DoDefaultAction(); @@ -683,7 +683,7 @@ public void TabAccessibleObject_DoDefaultAction_DoesNotInvoke_RaiseAutomationEve pages.AddRange([new(), new() { Enabled = tabPageEnabled }]); SubTabAccessibleObject tabAccessibleObject = new(pages[1]); - pages[1].TestAccessor().Dynamic._tabAccessibilityObject = tabAccessibleObject; + pages[1].TestAccessor.Dynamic._tabAccessibilityObject = tabAccessibleObject; Assert.IsType(tabControl.AccessibilityObject); @@ -707,7 +707,7 @@ public void TabAccessibleObject_SetSelectedTab_InvokeRaiseAutomationEvent() Assert.IsType(tabControl.AccessibilityObject); SubTabAccessibleObject tabAccessibleObject = new(pages[1]); - pages[1].TestAccessor().Dynamic._tabAccessibilityObject = tabAccessibleObject; + pages[1].TestAccessor.Dynamic._tabAccessibilityObject = tabAccessibleObject; tabControl.SelectedTab = pages[1]; Application.DoEvents(); @@ -728,7 +728,7 @@ public void TabAccessibleObject_SetSelectedTab_DoesNotInvoke_RaiseAutomationEven pages.AddRange([new(), new()]); SubTabAccessibleObject tabAccessibleObject = new(pages[1]); - pages[1].TestAccessor().Dynamic._tabAccessibilityObject = tabAccessibleObject; + pages[1].TestAccessor.Dynamic._tabAccessibilityObject = tabAccessibleObject; tabControl.SelectedTab = pages[1]; @@ -748,7 +748,7 @@ public void TabAccessibleObject_SetSelectedTab_DoesNotInvoke_RaiseAutomationEven pages.AddRange([new(), new()]); SubTabAccessibleObject tabAccessibleObject = new(pages[0]); - pages[0].TestAccessor().Dynamic._tabAccessibilityObject = tabAccessibleObject; + pages[0].TestAccessor.Dynamic._tabAccessibilityObject = tabAccessibleObject; Assert.IsType(tabControl.AccessibilityObject); @@ -770,7 +770,7 @@ public void TabAccessibleObject_SetSelectedIndex_InvokeRaiseAutomationEvent() pages.AddRange([new(), new()]); SubTabAccessibleObject tabAccessibleObject = new(pages[1]); - pages[1].TestAccessor().Dynamic._tabAccessibilityObject = tabAccessibleObject; + pages[1].TestAccessor.Dynamic._tabAccessibilityObject = tabAccessibleObject; Assert.IsType(tabControl.AccessibilityObject); @@ -793,7 +793,7 @@ public void TabAccessibleObject_SetSelectedIndex_DoesNotInvoke_RaiseAutomationEv pages.AddRange([new(), new()]); SubTabAccessibleObject tabAccessibleObject = new(pages[1]); - pages[1].TestAccessor().Dynamic._tabAccessibilityObject = tabAccessibleObject; + pages[1].TestAccessor.Dynamic._tabAccessibilityObject = tabAccessibleObject; tabControl.SelectedIndex = 1; @@ -813,7 +813,7 @@ public void TabAccessibleObject_SetSelectedIndex_DoesNotInvoke_RaiseAutomationEv pages.AddRange([new(), new()]); SubTabAccessibleObject tabAccessibleObject = new(pages[0]); - pages[0].TestAccessor().Dynamic._tabAccessibilityObject = tabAccessibleObject; + pages[0].TestAccessor.Dynamic._tabAccessibilityObject = tabAccessibleObject; Assert.IsType(tabControl.AccessibilityObject); @@ -835,7 +835,7 @@ public void TabAccessibleObject_OnGotFocus_InvokeTabAccessibleObject_RaiseAutoma pages.AddRange([new(), new()]); SubTabAccessibleObject tabAccessibleObject = new(pages[0]); - pages[0].TestAccessor().Dynamic._tabAccessibilityObject = tabAccessibleObject; + pages[0].TestAccessor.Dynamic._tabAccessibilityObject = tabAccessibleObject; Assert.IsType(tabControl.AccessibilityObject); @@ -855,7 +855,7 @@ public void TabAccessibleObject_OnGotFocus_DoesNotInvoke_RaiseAutomationEvent_If pages.AddRange([new(), new()]); SubTabAccessibleObject tabAccessibleObject = new(pages[0]); - pages[0].TestAccessor().Dynamic._tabAccessibilityObject = tabAccessibleObject; + pages[0].TestAccessor.Dynamic._tabAccessibilityObject = tabAccessibleObject; tabControl.OnGotFocus(); @@ -875,7 +875,7 @@ public void TabAccessibleObject_AddToSelection_InvokeRaiseAutomationEvent(bool t pages.AddRange([new(), new() { Enabled = tabPageEnabled }]); SubTabAccessibleObject tabAccessibleObject = new(pages[1]); - pages[1].TestAccessor().Dynamic._tabAccessibilityObject = tabAccessibleObject; + pages[1].TestAccessor.Dynamic._tabAccessibilityObject = tabAccessibleObject; Assert.IsType(tabControl.AccessibilityObject); @@ -898,7 +898,7 @@ public void TabAccessibleObject_AddToSelection_DoesNotInvoke_RaiseAutomationEven pages.AddRange([new(), new()]); SubTabAccessibleObject tabAccessibleObject = new(pages[0]); - pages[0].TestAccessor().Dynamic._tabAccessibilityObject = tabAccessibleObject; + pages[0].TestAccessor.Dynamic._tabAccessibilityObject = tabAccessibleObject; pages[0].TabAccessibilityObject.AddToSelection(); @@ -918,7 +918,7 @@ public void TabAccessibleObject_AddToSelection_DoesNotInvoke_RaiseAutomationEven pages.AddRange([new(), new()]); SubTabAccessibleObject tabAccessibleObject = new(pages[0]); - pages[0].TestAccessor().Dynamic._tabAccessibilityObject = tabAccessibleObject; + pages[0].TestAccessor.Dynamic._tabAccessibilityObject = tabAccessibleObject; pages[0].TabAccessibilityObject.AddToSelection(); @@ -940,7 +940,7 @@ public void TabAccessibleObject_AddToSelection_DoesNotInvoke_RaiseAutomationEven pages.AddRange([new() { Enabled = tabPageEnabled }, new()]); SubTabAccessibleObject tabAccessibleObject = new(pages[0]); - pages[0].TestAccessor().Dynamic._tabAccessibilityObject = tabAccessibleObject; + pages[0].TestAccessor.Dynamic._tabAccessibilityObject = tabAccessibleObject; Assert.IsType(tabControl.AccessibilityObject); @@ -964,7 +964,7 @@ public void TabAccessibleObject_SelectItem_InvokeRaiseAutomationEvent(bool tabPa pages.AddRange([new(), new() { Enabled = tabPageEnabled }]); SubTabAccessibleObject tabAccessibleObject = new(pages[1]); - pages[1].TestAccessor().Dynamic._tabAccessibilityObject = tabAccessibleObject; + pages[1].TestAccessor.Dynamic._tabAccessibilityObject = tabAccessibleObject; Assert.IsType(tabControl.AccessibilityObject); @@ -987,7 +987,7 @@ public void TabAccessibleObject_SelectItem_DoesNotInvoke_RaiseAutomationEvent_If pages.AddRange([new(), new()]); SubTabAccessibleObject tabAccessibleObject = new(pages[0]); - pages[0].TestAccessor().Dynamic._tabAccessibilityObject = tabAccessibleObject; + pages[0].TestAccessor.Dynamic._tabAccessibilityObject = tabAccessibleObject; pages[0].TabAccessibilityObject.SelectItem(); @@ -1007,7 +1007,7 @@ public void TabAccessibleObject_SelectItem_DoesNotInvoke_RaiseAutomationEvent_If pages.AddRange([new(), new()]); SubTabAccessibleObject tabAccessibleObject = new(pages[0]); - pages[0].TestAccessor().Dynamic._tabAccessibilityObject = tabAccessibleObject; + pages[0].TestAccessor.Dynamic._tabAccessibilityObject = tabAccessibleObject; Assert.IsType(tabControl.AccessibilityObject); @@ -1031,7 +1031,7 @@ public void TabAccessibleObject_SelectItem_DoesNotInvoke_RaiseAutomationEvent_If pages.AddRange([new(), new() { Enabled = tabPageEnabled }]); SubTabAccessibleObject tabAccessibleObject = new(pages[1]); - pages[1].TestAccessor().Dynamic._tabAccessibilityObject = tabAccessibleObject; + pages[1].TestAccessor.Dynamic._tabAccessibilityObject = tabAccessibleObject; Assert.IsType(tabControl.AccessibilityObject); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ToolStripNumericUpDown.ToolStripNumericUpDownAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ToolStripNumericUpDown.ToolStripNumericUpDownAccessibleObjectTests.cs index 16e78ab2995..78601687aa2 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ToolStripNumericUpDown.ToolStripNumericUpDownAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ToolStripNumericUpDown.ToolStripNumericUpDownAccessibleObjectTests.cs @@ -17,7 +17,7 @@ public void ToolStripNumericUpDownAccessibleObject_Ctor_Default() using ToolStripNumericUpDown toolStripNumericUpDown = new(); ToolStripHostedControlAccessibleObject accessibleObject = (ToolStripHostedControlAccessibleObject)toolStripNumericUpDown.Control.AccessibilityObject; - ToolStripNumericUpDown actual = accessibleObject.TestAccessor().Dynamic._toolStripControlHost; + ToolStripNumericUpDown actual = accessibleObject.TestAccessor.Dynamic._toolStripControlHost; Assert.Equal(toolStripNumericUpDown, actual); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ToolStripScrollButton.ToolStripScrollButtonAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ToolStripScrollButton.ToolStripScrollButtonAccessibleObjectTests.cs index 4ad4c8f1971..0e415ebef6c 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ToolStripScrollButton.ToolStripScrollButtonAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ToolStripScrollButton.ToolStripScrollButtonAccessibleObjectTests.cs @@ -36,7 +36,7 @@ public void ToolStripScrollButtonAccessibleObject_FragmentNavigate_ReturnsExpect SubToolStripDropDownMenu dropDownMenu = new(ownerItem, true, true); toolStrip.Items.Add(ownerItem); - ownerItem.TestAccessor().Dynamic._dropDown = dropDownMenu; + ownerItem.TestAccessor.Dynamic._dropDown = dropDownMenu; ownerItem.DropDownItems.Add(new ToolStripDropDownButton("Item 1")); ownerItem.DropDownItems.Add(new ToolStripDropDownButton("Item 2")); ownerItem.DropDownItems.Add(new ToolStripDropDownButton("Item 3")); @@ -98,7 +98,7 @@ public void ToolStripScrollButtonAccessibleObject_FragmentNavigate_ReturnsNull_I SubToolStripDropDownMenu dropDownMenu = new(ownerItem, true, false); toolStrip.Items.Add(ownerItem); - ownerItem.TestAccessor().Dynamic._dropDown = dropDownMenu; + ownerItem.TestAccessor.Dynamic._dropDown = dropDownMenu; ownerItem.DropDownItems.Add(new ToolStripDropDownButton("Item 1")); ownerItem.DropDownItems.Add(new ToolStripDropDownButton("Item 2")); @@ -136,7 +136,7 @@ public void ToolStripScrollButtonAccessibleObject_Properties_ReturnExpected() SubToolStripDropDownMenu dropDownMenu = new(ownerItem, true, true); toolStrip.Items.Add(ownerItem); - ownerItem.TestAccessor().Dynamic._dropDown = dropDownMenu; + ownerItem.TestAccessor.Dynamic._dropDown = dropDownMenu; ownerItem.DropDownItems.Add(new ToolStripDropDownButton("Item 1")); ownerItem.DropDownItems.Add(new ToolStripDropDownButton("Item 2")); dropDownMenu.UpdateDisplayedItems(); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ToolStripSplitButton.ToolStripSplitButtonExAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ToolStripSplitButton.ToolStripSplitButtonExAccessibleObjectTests.cs index 846069bc878..11eb41a939e 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ToolStripSplitButton.ToolStripSplitButtonExAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/ToolStripSplitButton.ToolStripSplitButtonExAccessibleObjectTests.cs @@ -44,7 +44,7 @@ public void ToolStripSplitButtonExAccessibleObject_DropDownItemsCount_ReturnsExp ToolStripSplitButtonExAccessibleObject accessibleObject = new(toolStripSplitButton); Assert.Equal(ExpandCollapseState.ExpandCollapseState_Collapsed, accessibleObject.ExpandCollapseState); - Assert.Equal(0, accessibleObject.TestAccessor().Dynamic.DropDownItemsCount); + Assert.Equal(0, accessibleObject.TestAccessor.Dynamic.DropDownItemsCount); } [WinFormsFact] diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/TreeViewLabelEditAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/TreeViewLabelEditAccessibleObjectTests.cs index cc7f2723b6f..c57a1beeefd 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/TreeViewLabelEditAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AccessibleObjects/TreeViewLabelEditAccessibleObjectTests.cs @@ -16,7 +16,7 @@ public void TreeViewLabelEditAccessibleObject_GetPropertyValue_ReturnsExpected() { using TreeView treeView = CreateTreeViewAndStartEditing(); - TreeViewLabelEditNativeWindow labelEdit = treeView.TestAccessor().Dynamic._labelEdit; + TreeViewLabelEditNativeWindow labelEdit = treeView.TestAccessor.Dynamic._labelEdit; var accessibilityObject = (TreeViewLabelEditAccessibleObject)labelEdit.AccessibilityObject; using VARIANT runtimeId = accessibilityObject.GetPropertyValue(UIA_PROPERTY_ID.UIA_RuntimeIdPropertyId); Assert.Equal(accessibilityObject.RuntimeId, runtimeId.ToObject()); @@ -52,7 +52,7 @@ public void TreeViewLabelEditAccessibleObject_FragmentNavigate_ReturnsExpected() { using TreeView treeView = CreateTreeViewAndStartEditing(); - TreeViewLabelEditNativeWindow labelEdit = treeView.TestAccessor().Dynamic._labelEdit; + TreeViewLabelEditNativeWindow labelEdit = treeView.TestAccessor.Dynamic._labelEdit; var accessibilityObject = (TreeViewLabelEditAccessibleObject)labelEdit.AccessibilityObject; Assert.Equal(treeView.Nodes[0].AccessibilityObject, accessibilityObject.FragmentNavigate(NavigateDirection.NavigateDirection_Parent)); @@ -64,7 +64,7 @@ public void TreeViewLabelEditAccessibleObject_IsPatternSupported_ReturnsExpected { using TreeView treeView = CreateTreeViewAndStartEditing(); - TreeViewLabelEditNativeWindow labelEdit = treeView.TestAccessor().Dynamic._labelEdit; + TreeViewLabelEditNativeWindow labelEdit = treeView.TestAccessor.Dynamic._labelEdit; var accessibilityObject = (TreeViewLabelEditAccessibleObject)labelEdit.AccessibilityObject; Assert.True(accessibilityObject.IsPatternSupported(UIA_PATTERN_ID.UIA_TextPatternId)); @@ -78,7 +78,7 @@ public void TreeViewLabelEditAccessibleObject_RuntimeId_ReturnsExpected() { using TreeView treeView = CreateTreeViewAndStartEditing(); - TreeViewLabelEditNativeWindow labelEdit = treeView.TestAccessor().Dynamic._labelEdit; + TreeViewLabelEditNativeWindow labelEdit = treeView.TestAccessor.Dynamic._labelEdit; var accessibilityObject = (TreeViewLabelEditAccessibleObject)labelEdit.AccessibilityObject; Assert.Equal(new int[] { AccessibleObject.RuntimeIDFirstItem, PARAM.ToInt(labelEdit.Handle) }, accessibilityObject.RuntimeId); @@ -89,7 +89,7 @@ public void TreeViewLabelEditAccessibleObject_FragmentRoot_ReturnsExpected() { using TreeView treeView = CreateTreeViewAndStartEditing(); - TreeViewLabelEditNativeWindow labelEdit = treeView.TestAccessor().Dynamic._labelEdit; + TreeViewLabelEditNativeWindow labelEdit = treeView.TestAccessor.Dynamic._labelEdit; var accessibilityObject = (TreeViewLabelEditAccessibleObject)labelEdit.AccessibilityObject; Assert.Equal(treeView.AccessibilityObject, accessibilityObject.FragmentRoot); @@ -100,7 +100,7 @@ public unsafe void TreeViewLabelEditAccessibleObject_HostRawElementProvider_Retu { using TreeView treeView = CreateTreeViewAndStartEditing(); - TreeViewLabelEditNativeWindow labelEdit = treeView.TestAccessor().Dynamic._labelEdit; + TreeViewLabelEditNativeWindow labelEdit = treeView.TestAccessor.Dynamic._labelEdit; var accessibilityObject = (TreeViewLabelEditAccessibleObject)labelEdit.AccessibilityObject; using ComScope provider = new(accessibilityObject.HostRawElementProvider); Assert.False(provider.IsNull); @@ -111,7 +111,7 @@ public void TreeViewLabelEditAccessibleObject_Name_ReturnsExpected() { using TreeView treeView = CreateTreeViewAndStartEditing(); - TreeViewLabelEditNativeWindow labelEdit = treeView.TestAccessor().Dynamic._labelEdit; + TreeViewLabelEditNativeWindow labelEdit = treeView.TestAccessor.Dynamic._labelEdit; var accessibilityObject = (TreeViewLabelEditAccessibleObject)labelEdit.AccessibilityObject; Assert.Equal(treeView.Nodes[0].Text, accessibilityObject.Name); @@ -122,7 +122,7 @@ public void TreeViewLabelEditAccessibleObject_Ctor_NullOwningTreeView_ThrowsArgu { using TreeView treeView = CreateTreeViewAndStartEditing(); - TreeViewLabelEditNativeWindow labelEdit = treeView.TestAccessor().Dynamic._labelEdit; + TreeViewLabelEditNativeWindow labelEdit = treeView.TestAccessor.Dynamic._labelEdit; Assert.Throws(() => new TreeViewLabelEditAccessibleObject(null, labelEdit)); } @@ -137,7 +137,7 @@ public void TreeViewLabelEditUiaTextProvider_Ctor_NullOwningTreeView_ThrowsArgum { using TreeView treeView = CreateTreeViewAndStartEditing(); - TreeViewLabelEditNativeWindow labelEdit = treeView.TestAccessor().Dynamic._labelEdit; + TreeViewLabelEditNativeWindow labelEdit = treeView.TestAccessor.Dynamic._labelEdit; Assert.Throws(() => new LabelEditUiaTextProvider(null, labelEdit, labelEdit.AccessibilityObject)); } @@ -146,7 +146,7 @@ public void TreeViewLabelEditUiaTextProvider_Ctor_NullChildEditAccessibilityObje { using TreeView treeView = CreateTreeViewAndStartEditing(); - TreeViewLabelEditNativeWindow labelEdit = treeView.TestAccessor().Dynamic._labelEdit; + TreeViewLabelEditNativeWindow labelEdit = treeView.TestAccessor.Dynamic._labelEdit; Assert.Throws(() => new LabelEditUiaTextProvider(treeView, labelEdit, null)); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/Application.ParkingWindowTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/Application.ParkingWindowTests.cs index 11e98cbf272..2ad3ba753bb 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/Application.ParkingWindowTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/Application.ParkingWindowTests.cs @@ -77,7 +77,7 @@ public void ParkingWindow_Unaware() using Control control = new(); ThreadContext ctx = GetContextForHandle(control); Assert.NotNull(ctx); - ParkingWindow parkingWindow = ctx.TestAccessor().Dynamic.GetParkingWindowForContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_UNAWARE); + ParkingWindow parkingWindow = ctx.TestAccessor.Dynamic.GetParkingWindowForContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_UNAWARE); Assert.NotNull(parkingWindow); DPI_AWARENESS_CONTEXT dpiContext = PInvoke.GetWindowDpiAwarenessContext(parkingWindow.HWND); @@ -112,7 +112,7 @@ public void ParkingWindow_SystemAware() using Control control = new(); ThreadContext ctx = GetContextForHandle(control); Assert.NotNull(ctx); - ParkingWindow parkingWindow = ctx.TestAccessor().Dynamic.GetParkingWindowForContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_SYSTEM_AWARE); + ParkingWindow parkingWindow = ctx.TestAccessor.Dynamic.GetParkingWindowForContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_SYSTEM_AWARE); Assert.NotNull(parkingWindow); DPI_AWARENESS_CONTEXT dpiContext = PInvoke.GetWindowDpiAwarenessContext(parkingWindow.HWND); @@ -146,7 +146,7 @@ public void ParkingWindow_PermonitorV2() ThreadContext ctx = GetContextForHandle(control); Assert.NotNull(ctx); - ParkingWindow parkingWindow = ctx.TestAccessor().Dynamic.GetParkingWindowForContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); + ParkingWindow parkingWindow = ctx.TestAccessor.Dynamic.GetParkingWindowForContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); Assert.NotNull(parkingWindow); DPI_AWARENESS_CONTEXT dpiContext = PInvoke.GetWindowDpiAwarenessContext(parkingWindow.HWND); @@ -178,7 +178,7 @@ public void ParkingWindow_Multiple() using Control control = new(); ThreadContext ctx = GetContextForHandle(control); Assert.NotNull(ctx); - ParkingWindow parkingWindow = ctx.TestAccessor().Dynamic.GetParkingWindowForContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); + ParkingWindow parkingWindow = ctx.TestAccessor.Dynamic.GetParkingWindowForContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); Assert.NotNull(parkingWindow); DPI_AWARENESS_CONTEXT dpiContext = PInvoke.GetWindowDpiAwarenessContext(parkingWindow.HWND); @@ -189,14 +189,14 @@ public void ParkingWindow_Multiple() using Control systemControl = new(); ctx = GetContextForHandle(systemControl); Assert.NotNull(ctx); - parkingWindow = ctx.TestAccessor().Dynamic.GetParkingWindowForContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_SYSTEM_AWARE); + parkingWindow = ctx.TestAccessor.Dynamic.GetParkingWindowForContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_SYSTEM_AWARE); Assert.NotNull(parkingWindow); dpiContext = PInvoke.GetWindowDpiAwarenessContext(parkingWindow.HWND); Assert.True(dpiContext.IsEquivalent(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_SYSTEM_AWARE)); // check PMv2 parking window still available. - parkingWindow = ctx.TestAccessor().Dynamic.GetParkingWindowForContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); + parkingWindow = ctx.TestAccessor.Dynamic.GetParkingWindowForContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); Assert.NotNull(parkingWindow); dpiContext = PInvoke.GetWindowDpiAwarenessContext(parkingWindow.HWND); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ApplicationTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ApplicationTests.cs index 6c0d37f5980..47013617e97 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ApplicationTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ApplicationTests.cs @@ -183,7 +183,7 @@ public void Application_SetColorMode_PlausibilityTests() [WinFormsFact] public void Application_DefaultFont_ReturnsNull_IfNoFontSet() { - var applicationTestAccessor = typeof(Application).TestAccessor().Dynamic; + var applicationTestAccessor = typeof(Application).TestAccessor.Dynamic; Assert.Null(applicationTestAccessor.s_defaultFont); Assert.Null(applicationTestAccessor.s_defaultFontScaled); Assert.Null(Application.DefaultFont); @@ -192,7 +192,7 @@ public void Application_DefaultFont_ReturnsNull_IfNoFontSet() [WinFormsFact] public void Application_DefaultFont_Returns_DefaultFont_IfNotScaled() { - var applicationTestAccessor = typeof(Application).TestAccessor().Dynamic; + var applicationTestAccessor = typeof(Application).TestAccessor.Dynamic; Assert.Null(applicationTestAccessor.s_defaultFont); Assert.Null(applicationTestAccessor.s_defaultFontScaled); @@ -215,7 +215,7 @@ public void Application_DefaultFont_Returns_DefaultFont_IfNotScaled() [WinFormsFact] public void Application_DefaultFont_Returns_ScaledDefaultFont_IfScaled() { - var applicationTestAccessor = typeof(Application).TestAccessor().Dynamic; + var applicationTestAccessor = typeof(Application).TestAccessor.Dynamic; Assert.Null(applicationTestAccessor.s_defaultFont); Assert.Null(applicationTestAccessor.s_defaultFontScaled); @@ -256,7 +256,7 @@ public void Application_SetDefaultFont_AfterHandleCreated_InvalidOperationExcept [WinFormsFact] public void Application_SetDefaultFont_SystemFont() { - var applicationTestAccessor = typeof(Application).TestAccessor().Dynamic; + var applicationTestAccessor = typeof(Application).TestAccessor.Dynamic; Font font = applicationTestAccessor.s_defaultFont; font.Should().BeNull(); font = applicationTestAccessor.s_defaultFontScaled; @@ -264,7 +264,7 @@ public void Application_SetDefaultFont_SystemFont() // This a unholy, but generally at this stage NativeWindow.AnyHandleCreated=true, // And we won't be able to set the font, unless we flip the bit - var nativeWindowTestAccessor = typeof(NativeWindow).TestAccessor().Dynamic; + var nativeWindowTestAccessor = typeof(NativeWindow).TestAccessor.Dynamic; bool currentAnyHandleCreated = nativeWindowTestAccessor.t_anyHandleCreated; try { @@ -282,7 +282,7 @@ public void Application_SetDefaultFont_SystemFont() // create fake system font using Font fakeSysFont = sysFont.WithSize(sysFont.Size * 1.25f); // set IsSystemFont flag - fakeSysFont.TestAccessor().Dynamic.SetSystemFontName(sysFont.SystemFontName); + fakeSysFont.TestAccessor.Dynamic.SetSystemFontName(sysFont.SystemFontName); fakeSysFont.IsSystemFont.Should().BeTrue(); Application.SetDefaultFont(fakeSysFont); font = applicationTestAccessor.s_defaultFontScaled; @@ -303,7 +303,7 @@ public void Application_SetDefaultFont_SystemFont() [WinFormsFact] public void Application_SetDefaultFont_NonSystemFont() { - var applicationTestAccessor = typeof(Application).TestAccessor().Dynamic; + var applicationTestAccessor = typeof(Application).TestAccessor.Dynamic; Font font = applicationTestAccessor.s_defaultFont; font.Should().BeNull(); font = applicationTestAccessor.s_defaultFontScaled; @@ -314,7 +314,7 @@ public void Application_SetDefaultFont_NonSystemFont() // This a unholy, but generally at this stage NativeWindow.AnyHandleCreated=true, // And we won't be able to set the font, unless we flip the bit - var nativeWindowTestAccessor = typeof(NativeWindow).TestAccessor().Dynamic; + var nativeWindowTestAccessor = typeof(NativeWindow).TestAccessor.Dynamic; bool currentAnyHandleCreated = nativeWindowTestAccessor.t_anyHandleCreated; try { diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AxHostTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AxHostTests.cs index 5312ae5d86d..ae6ea0eb1fc 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/AxHostTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/AxHostTests.cs @@ -3093,8 +3093,8 @@ public unsafe void AxHost_Ocx_ConnectionPoint_Success() using SubAxHost control = new(WebBrowserClsidString); control.CreateControl(); - object site = control.TestAccessor().Dynamic._oleSite; - AxHost.ConnectionPointCookie cookie = site.TestAccessor().Dynamic._connectionPoint; + object site = control.TestAccessor.Dynamic._oleSite; + AxHost.ConnectionPointCookie cookie = site.TestAccessor.Dynamic._connectionPoint; cookie.Should().NotBeNull(); cookie.Connected.Should().BeTrue(); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/BinaryFormat/WinFormsBinaryFormattedObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/BinaryFormat/WinFormsBinaryFormattedObjectTests.cs index db5313e2303..d29069d4b2b 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/BinaryFormat/WinFormsBinaryFormattedObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/BinaryFormat/WinFormsBinaryFormattedObjectTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -127,7 +127,7 @@ public void BinaryFormattedObject_Bitmap_FromBinaryFormatter() root.TypeName.AssemblyName!.FullName.Should().Be(Assemblies.SystemDrawing); ArrayRecord arrayRecord = root.GetArrayRecord("Data")!; arrayRecord.Should().BeAssignableTo>(); - bool success = typeof(WinFormsNrbfSerializer).TestAccessor().Dynamic.TryGetBitmap(rootRecord, out object? result); + bool success = typeof(WinFormsNrbfSerializer).TestAccessor.Dynamic.TryGetBitmap(rootRecord, out object? result); success.Should().BeTrue(); using Bitmap deserialized = result.Should().BeOfType().Which; deserialized.Size.Should().Be(bitmap.Size); @@ -143,7 +143,7 @@ public void BinaryFormattedObject_Bitmap_RoundTrip() stream.Position = 0; SerializationRecord rootRecord = NrbfDecoder.Decode(stream); - bool success = typeof(WinFormsNrbfSerializer).TestAccessor().Dynamic.TryGetBitmap(rootRecord, out object? result); + bool success = typeof(WinFormsNrbfSerializer).TestAccessor.Dynamic.TryGetBitmap(rootRecord, out object? result); success.Should().BeTrue(); using Bitmap deserialized = result.Should().BeOfType().Which; deserialized.Size.Should().Be(bitmap.Size); @@ -183,7 +183,7 @@ public void BinaryFormattedObject_ImageListStreamer_FromBinaryFormatter() root.TypeName.AssemblyName!.FullName.Should().Be(typeof(WinFormsBinaryFormatWriter).Assembly.FullName); root.GetArrayRecord("Data")!.Should().BeAssignableTo>(); - bool success = typeof(WinFormsNrbfSerializer).TestAccessor().Dynamic.TryGetImageListStreamer(rootRecord, out object? result); + bool success = typeof(WinFormsNrbfSerializer).TestAccessor.Dynamic.TryGetImageListStreamer(rootRecord, out object? result); success.Should().BeTrue(); using ImageListStreamer deserialized = result.Should().BeOfType().Which; using ImageList newList = new(); @@ -206,7 +206,7 @@ public void BinaryFormattedObject_ImageListStreamer_RoundTrip() memoryStream.Position = 0; SerializationRecord rootRecord = NrbfDecoder.Decode(memoryStream); - bool success = typeof(WinFormsNrbfSerializer).TestAccessor().Dynamic.TryGetImageListStreamer(rootRecord, out object? result); + bool success = typeof(WinFormsNrbfSerializer).TestAccessor.Dynamic.TryGetImageListStreamer(rootRecord, out object? result); success.Should().BeTrue(); using ImageListStreamer deserialized = result.Should().BeOfType().Which; using ImageList newList = new(); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/CheckBoxBaseAdapterTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/CheckBoxBaseAdapterTests.cs index 94cb5ee8710..288c489db08 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/CheckBoxBaseAdapterTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/CheckBoxBaseAdapterTests.cs @@ -187,7 +187,7 @@ public void DrawCheckOnly_Protected_DoesNotThrow( Color checkColor = Color.Black; Exception? ex = Record.Exception(() => - adapter.TestAccessor().Dynamic.DrawCheckOnly( + adapter.TestAccessor.Dynamic.DrawCheckOnly( e, layout, colors, @@ -279,7 +279,7 @@ public void AdjustFocusRectangle_SetsFocusAsExpected( Field = new Rectangle(5, 5, 20, 20) }; - adapter.TestAccessor().Dynamic.AdjustFocusRectangle(layout); + adapter.TestAccessor.Dynamic.AdjustFocusRectangle(layout); if (string.IsNullOrEmpty(text)) { diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/CheckBoxFlatAdapterTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/CheckBoxFlatAdapterTests.cs index b633b40d96c..0bbdbf09c31 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/CheckBoxFlatAdapterTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/CheckBoxFlatAdapterTests.cs @@ -122,7 +122,7 @@ public void CreateButtonAdapter_ReturnsButtonFlatAdapter() { (TestCheckBoxFlatAdapter checkBoxFlatAdapter, _) = CreateAdapter(Appearance.Normal, true); - ButtonBaseAdapter result = checkBoxFlatAdapter.TestAccessor().Dynamic.CreateButtonAdapter(); + ButtonBaseAdapter result = checkBoxFlatAdapter.TestAccessor.Dynamic.CreateButtonAdapter(); result.Should().NotBeNull(); result.Should().BeOfType(); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/CheckBoxPopupAdapterTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/CheckBoxPopupAdapterTests.cs index 93d788f133f..6bf24f91af4 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/CheckBoxPopupAdapterTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/CheckBoxPopupAdapterTests.cs @@ -73,7 +73,7 @@ public void Layout_DoesNotThrow_WhenInvokedViaTestAccessor() using Graphics graphics = Graphics.FromImage(bitmap); PaintEventArgs e = new(graphics, checkBox.ClientRectangle); - Action action = () => adapter.TestAccessor().Dynamic.Layout(e); + Action action = () => adapter.TestAccessor.Dynamic.Layout(e); action.Should().NotThrow(); } @@ -84,7 +84,7 @@ public void CreateButtonAdapter_DoesNotThrow_WhenInvokedViaTestAccessor() using CheckBox checkBox = new(); CheckBoxPopupAdapter adapter = new(checkBox); - Action action = () => adapter.TestAccessor().Dynamic.CreateButtonAdapter(); + Action action = () => adapter.TestAccessor.Dynamic.CreateButtonAdapter(); action.Should().NotThrow(); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ComboBox.ComboBoxChildNativeWindowTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ComboBox.ComboBoxChildNativeWindowTests.cs index b86debf2d26..8612824005a 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ComboBox.ComboBoxChildNativeWindowTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ComboBox.ComboBoxChildNativeWindowTests.cs @@ -18,8 +18,8 @@ public void ComboBoxChildNativeWindow_GetChildAccessibleObject() foreach (object childWindowType in Enum.GetValues(childWindowTypeEnum)) { - childNativeWindow.TestAccessor().Dynamic._childWindowType = childWindowType; - Assert.True(childNativeWindow.TestAccessor().Dynamic.GetChildAccessibleObject() is ComboBox.ChildAccessibleObject); + childNativeWindow.TestAccessor.Dynamic._childWindowType = childWindowType; + Assert.True(childNativeWindow.TestAccessor.Dynamic.GetChildAccessibleObject() is ComboBox.ChildAccessibleObject); } } } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ComboBox.ComboBoxUiaTextProviderTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ComboBox.ComboBoxUiaTextProviderTests.cs index 7a5638b9b6e..6e9ee58dc7b 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ComboBox.ComboBoxUiaTextProviderTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ComboBox.ComboBoxUiaTextProviderTests.cs @@ -22,12 +22,12 @@ public void ComboBoxUiaTextProvider_Ctor_DoesNotCreateControlHandle(ComboBoxStyl using ComboBox comboBox = new() { DropDownStyle = dropDownStyle }; Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); ComboBox.ComboBoxUiaTextProvider provider = new(comboBox); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -49,7 +49,7 @@ public void ComboBoxUiaTextProvider_IsMultiline_IsFalse(ComboBoxStyle dropDownSt Assert.False(provider.IsMultiline); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -65,7 +65,7 @@ public void ComboBoxUiaTextProvider_IsReadOnly_IsFalse(ComboBoxStyle dropDownSty Assert.False(provider.IsReadOnly); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -80,7 +80,7 @@ public void ComboBoxUiaTextProvider_IsScrollable_IsTrue(ComboBoxStyle dropDownSt Assert.True(provider.IsScrollable); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } [WinFormsTheory] @@ -95,7 +95,7 @@ public void ComboBoxUiaTextProvider_IsScrollable_False_WithoutHandle(ComboBoxSty Assert.False(provider.IsScrollable); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -111,7 +111,7 @@ public void ComboBoxUiaTextProvider_GetWindowStyle_ReturnsNoneForNotInitializedC Assert.Equal(WINDOW_STYLE.WS_OVERLAPPED, provider.WindowStyle); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -128,7 +128,7 @@ public void ComboBoxUiaTextProvider_IsReadingRTL_ReturnsCorrectValue(ComboBoxSty Assert.Equal(expectedResult, provider.IsReadingRTL); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } [WinFormsTheory] @@ -145,7 +145,7 @@ public void ComboBoxUiaTextProvider_IsReadingRTL_ReturnsFalse_WithoutHandle(Comb Assert.False(provider.IsReadingRTL); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -164,8 +164,8 @@ public void ComboBoxUiaTextProvider_DocumentRange_IsNotNull_WorksCorrectly(Combo using ComScope elementProvider = new(range.Value->GetEnclosingElement()); Assert.Equal(comboBox.ChildEditAccessibleObject, ComHelpers.GetObjectForIUnknown(elementProvider)); UiaTextRange rangeObj = ComHelpers.GetObjectForIUnknown(range) as UiaTextRange; - Assert.Equal(provider, rangeObj?.TestAccessor().Dynamic._provider); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Equal(provider, rangeObj?.TestAccessor.Dynamic._provider); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -195,7 +195,7 @@ public void ComboBoxUiaTextProvider_SupportedTextSelection_IsNotNull(ComboBoxSty Assert.Equal(SupportedTextSelection.SupportedTextSelection_Single, uiaTextRange); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -214,7 +214,7 @@ public void ComboBoxUiaTextProvider_GetCaretRange_IsNotNull(ComboBoxStyle dropDo Assert.False(uiaTextRange.IsNull); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } [WinFormsTheory] @@ -233,7 +233,7 @@ public void ComboBoxUiaTextProvider_GetCaretRange_IsNull_IfHandleIsNotCreated(Co Assert.True(uiaTextRange.IsNull); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -249,7 +249,7 @@ public void ComboBoxUiaTextProvider_LinesPerPage_ReturnsMinusOne_WithoutHandle(C Assert.Equal(-1, provider.LinesPerPage); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -264,7 +264,7 @@ public void ComboBoxUiaTextProvider_LinesPerPage_ReturnsOne_WithHandle(ComboBoxS Assert.Equal(1, provider.LinesPerPage); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } [WinFormsTheory] @@ -292,7 +292,7 @@ public void ComboBoxUiaTextProvider_GetLineFromCharIndex_ReturnsZero( Assert.Equal(0, actualLine); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } [WinFormsTheory] @@ -315,7 +315,7 @@ public void ComboBoxUiaTextProvider_GetLineFromCharIndex_ReturnsMinusOne_Without Assert.Equal(-1, actualLine); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -354,7 +354,7 @@ public void ComboBoxUiaTextProvider_GetLineIndex_ReturnsCorrectValue( Assert.Equal(0, actualIndex); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } [WinFormsTheory] @@ -376,7 +376,7 @@ public void ComboBoxUiaTextProvider_GetLineIndex_ReturnsMinusOne_WithoutHandle( Assert.Equal(-1, actualIndex); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -396,7 +396,7 @@ public void ComboBoxUiaTextProvider_GetLogfont_ReturnsCorrectValue(ComboBoxStyle Assert.False(string.IsNullOrEmpty(actual.FaceName.ToString())); Assert.Equal(expected, actual); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -416,7 +416,7 @@ public void ComboBoxUiaTextProvider_GetLogfont_ReturnsEmpty_WithoutHandle(ComboB Assert.True(string.IsNullOrEmpty(actual.FaceName.ToString())); Assert.Equal(expected, actual); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -444,7 +444,7 @@ public void ComboBoxUiaTextProvider_GetPositionFromChar_ReturnsCorrectValue(Comb Assert.True(actualPoint.X >= expectedPoint.X - 1 || actualPoint.X <= expectedPoint.X + 1); Assert.True(actualPoint.Y >= expectedPoint.Y - 1 || actualPoint.Y <= expectedPoint.Y + 1); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } public static IEnumerable ComboBoxUiaTextProvider_GetPositionFromChar_WithoutHandle_TestData() @@ -471,7 +471,7 @@ public void ComboBoxUiaTextProvider_GetPositionFromChar_ReturnsEmpty_WithoutHand Assert.Equal(Point.Empty, actualPoint); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -510,7 +510,7 @@ public void ComboBoxUiaTextProvider_GetPositionFromCharForUpperRightCorner_Retur Assert.True(actualPoint.X >= expectedPoint.X - 1 || actualPoint.X <= expectedPoint.X + 1); Assert.True(actualPoint.Y >= expectedPoint.Y - 1 || actualPoint.Y <= expectedPoint.Y + 1); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } public static IEnumerable ComboBoxUiaTextProvider_GetPositionFromCharForUpperRightCorner_ReturnsCorrectValue_WithoutHandle_TestData() @@ -548,7 +548,7 @@ public void ComboBoxUiaTextProvider_GetPositionFromCharForUpperRightCorner_Retur Assert.Equal(Point.Empty, actualPoint); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -581,7 +581,7 @@ public void ComboBoxUiaTextProvider_GetFormattingRectangle_ReturnsCorrectValue(C Assert.Equal(expectedRectangle, providerRectangle); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } [WinFormsTheory] @@ -598,7 +598,7 @@ public void ComboBoxUiaTextProvider_GetFormattingRectangle_ReturnsEmpty_WithoutH Assert.Equal(Rectangle.Empty, providerRectangle); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -633,7 +633,7 @@ public void ComboBoxUiaTextProvider_Text_ReturnsCorrectValue(ComboBoxStyle dropD Assert.Equal(expected, actual); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } [WinFormsTheory] @@ -651,7 +651,7 @@ public void ComboBoxUiaTextProvider_Text_ReturnsEmpty_WithoutHandle(ComboBoxStyl Assert.Equal(string.Empty, actual); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -667,7 +667,7 @@ public void ComboBoxUiaTextProvider_TextLength_ReturnsCorrectValue(ComboBoxStyle Assert.Equal(comboBox.Text.Length, provider.TextLength); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } [WinFormsTheory] @@ -683,7 +683,7 @@ public void ComboBoxUiaTextProvider_TextLength_ReturnsMinusOne_WithoutHandle(Com Assert.Equal(-1, provider.TextLength); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -698,7 +698,7 @@ public void ComboBoxUiaTextProvider_WindowExStyle_ReturnsCorrectValue(ComboBoxSt WINDOW_EX_STYLE actual = provider.WindowExStyle; Assert.Equal((WINDOW_EX_STYLE)0, actual); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } [WinFormsTheory] @@ -715,7 +715,7 @@ public void ComboBoxUiaTextProvider_WindowExStyle_ReturnsLeft_WithoutHandle(Comb Assert.Equal(WINDOW_EX_STYLE.WS_EX_LEFT, actual); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -734,7 +734,7 @@ public void ComboBoxUiaTextProvider_EditStyle_ReturnsCorrectValue(ComboBoxStyle Assert.NotEqual(0, ((int)actual & PInvoke.ES_NOHIDESEL)); Assert.NotEqual(0, ((int)actual & PInvoke.ES_AUTOHSCROLL)); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } [WinFormsTheory] @@ -751,7 +751,7 @@ public void ComboBoxUiaTextProvider_EditStyle_ReturnsLeft_WithoutHandle(ComboBox Assert.Equal(PInvoke.ES_LEFT, (int)actual); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -794,7 +794,7 @@ public void ComboBoxUiaTextProvider_GetVisibleRangePoints_ForSinglelineComboBox_ Assert.Equal(expectedStart, providerVisibleStart); Assert.Equal(expectedEnd, providerVisibleEnd); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } public static IEnumerable ComboBox_GetVisibleRangePoints_ForSinglelineComboBox_WithoutHandle_TestData() @@ -830,7 +830,7 @@ public void ComboBoxUiaTextProvider_GetVisibleRangePoints_ReturnsZeros_WithoutHa Assert.Equal(0, providerVisibleStart); Assert.Equal(0, providerVisibleEnd); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -857,7 +857,7 @@ public void ComboBoxUiaTextProvider_GetVisibleRanges_ReturnsCorrectValue(ComboBo Assert.False(result.IsEmpty); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } [WinFormsTheory] @@ -876,7 +876,7 @@ public void ComboBoxUiaTextProvider_GetVisibleRanges_ReturnsNull_WithoutHandle(C Assert.True(result.IsEmpty); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -920,7 +920,7 @@ public void ComboBoxUiaTextProvider_RangeFromPoint_DoesNotThrowAnException(Combo Assert.False(range.IsNull); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } [WinFormsTheory] @@ -937,7 +937,7 @@ public void ComboBoxUiaTextProvider_RangeFromPoint_ReturnsNull_WithoutHandle(Com Assert.True(range.IsNull); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -967,7 +967,7 @@ public void ComboBoxUiaTextProvider_SetSelection_GetSelection_ReturnCorrectValue Assert.Equal(start, comboBox.SelectionStart); Assert.Equal(end, comboBox.SelectionStart + comboBox.SelectionLength); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } [WinFormsTheory] @@ -985,18 +985,18 @@ public void ComboBoxUiaTextProvider_SetSelection_GetSelection_DontWork_WithoutHa ComboBox.ComboBoxUiaTextProvider provider = new(comboBox); provider.SetSelection(start, end); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); using ComSafeArrayScope selection = new(null); Assert.True(provider.GetSelection(selection).Succeeded); Assert.True(selection.IsNull); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); Assert.Equal(0, comboBox.SelectionStart); Assert.Equal(0, comboBox.SelectionStart + comboBox.SelectionLength); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -1029,7 +1029,7 @@ public void ComboBoxUiaTextProvider_SetSelection_DoesNotSelectText_IfIncorrectAr Assert.Equal(0, comboBox.SelectionStart); Assert.Equal(0, comboBox.SelectionStart + comboBox.SelectionLength); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -1049,7 +1049,7 @@ public void ComboBoxUiaTextProvider_LineScroll_ReturnsFalse(ComboBoxStyle dropDo Assert.False(provider.LineScroll(0, newLine)); Assert.Equal(0, provider.FirstVisibleLine); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } [WinFormsTheory] @@ -1069,7 +1069,7 @@ public void ComboBoxUiaTextProvider_LineScroll_DoesNotWork_WithoutHandle(ComboBo Assert.False(provider.LineScroll(0, newLine)); Assert.Equal(-1, provider.FirstVisibleLine); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); } } @@ -1087,7 +1087,7 @@ public void ComboBoxUiaTextProvider_GetLogfont_ReturnSegoe_ByDefault(ComboBoxSty Assert.Equal("Segoe UI", actual); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } [WinFormsTheory] @@ -1100,7 +1100,7 @@ public void ComboBoxUiaTextProvider_GetLogfont_ReturnEmpty_WithoutHandle(ComboBo using ComboBox comboBox = new() { DropDownStyle = dropDownStyle, Size = new(50, 100) }; ComboBox.ComboBoxUiaTextProvider provider = new(comboBox); Assert.False(comboBox.IsHandleCreated); - Assert.Null(comboBox.TestAccessor().Dynamic._childEdit); + Assert.Null(comboBox.TestAccessor.Dynamic._childEdit); Assert.Equal(default, provider.Logfont); } } @@ -1114,7 +1114,7 @@ public void ComboBoxUiaTextProvider_FirstVisibleLine_DefaultValueCorrect(ComboBo comboBox.CreateControl(); ComboBox.ComboBoxUiaTextProvider provider = new(comboBox); - int actualValue = (int)PInvokeCore.SendMessage((IHandle)comboBox.TestAccessor().Dynamic._childEdit, PInvokeCore.EM_GETFIRSTVISIBLELINE); + int actualValue = (int)PInvokeCore.SendMessage((IHandle)comboBox.TestAccessor.Dynamic._childEdit, PInvokeCore.EM_GETFIRSTVISIBLELINE); Assert.Equal(actualValue, provider.FirstVisibleLine); } @@ -1128,7 +1128,7 @@ public void ComboBoxUiaTextProvider_LinesCount_DefaultValueCorrect(ComboBoxStyle comboBox.CreateControl(); ComboBox.ComboBoxUiaTextProvider provider = new(comboBox); - int actualValue = (int)PInvokeCore.SendMessage((IHandle)comboBox.TestAccessor().Dynamic._childEdit, PInvokeCore.EM_GETLINECOUNT); + int actualValue = (int)PInvokeCore.SendMessage((IHandle)comboBox.TestAccessor.Dynamic._childEdit, PInvokeCore.EM_GETLINECOUNT); Assert.Equal(actualValue, provider.LinesCount); } @@ -1154,12 +1154,12 @@ public void ComboBoxUiaTextProvider_GetLineFromCharIndex_DefaultValueCorrect( comboBox.SelectedIndex = 0; ComboBox.ComboBoxUiaTextProvider provider = new(comboBox); - int expectedLine = (int)PInvokeCore.SendMessage((IHandle)comboBox.TestAccessor().Dynamic._childEdit, PInvokeCore.EM_LINEFROMCHAR, (WPARAM)charIndex); + int expectedLine = (int)PInvokeCore.SendMessage((IHandle)comboBox.TestAccessor.Dynamic._childEdit, PInvokeCore.EM_LINEFROMCHAR, (WPARAM)charIndex); int actualLine = provider.GetLineFromCharIndex(charIndex); Assert.Equal(expectedLine, actualLine); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } [WinFormsTheory] @@ -1175,10 +1175,10 @@ public void ComboBoxUiaTextProvider_LineScroll_DefaultValueCorrect(ComboBoxStyle comboBox.SelectedIndex = 0; ComboBox.ComboBoxUiaTextProvider provider = new(comboBox); - bool expectedValue = PInvokeCore.SendMessage((IHandle)comboBox.TestAccessor().Dynamic._childEdit, PInvokeCore.EM_LINESCROLL, 0, newLine) != 0; + bool expectedValue = PInvokeCore.SendMessage((IHandle)comboBox.TestAccessor.Dynamic._childEdit, PInvokeCore.EM_LINESCROLL, 0, newLine) != 0; Assert.Equal(expectedValue, provider.LineScroll(0, newLine)); Assert.True(comboBox.IsHandleCreated); - Assert.NotNull(comboBox.TestAccessor().Dynamic._childEdit); + Assert.NotNull(comboBox.TestAccessor.Dynamic._childEdit); } } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ComboBoxTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ComboBoxTests.cs index 416119aee6a..bcb46fd6318 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ComboBoxTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ComboBoxTests.cs @@ -359,7 +359,7 @@ public void ComboBox_Paint_AddHandler_ShouldSubscribeEvent() PaintEventHandler handler = (sender, e) => callCount++; comboBox.Paint += handler; - comboBox.TestAccessor().Dynamic.OnPaint(new PaintEventArgs(Graphics.FromHwnd(comboBox.Handle), default)); + comboBox.TestAccessor.Dynamic.OnPaint(new PaintEventArgs(Graphics.FromHwnd(comboBox.Handle), default)); callCount.Should().Be(1); } @@ -2173,8 +2173,8 @@ public void ComboBox_OnKeyUp_DoesNotInvoke_RaiseAutomationEvent_AccessibilityObj { using AutomationEventCountingComboBox comboBox = new(); comboBox.CreateControl(); - AutomationEventCountingComboBoxChildEditUiaProvider comboBoxChildEditUiaProvider = new(comboBox, comboBox.TestAccessor().Dynamic._childEdit.HWND); - comboBox.TestAccessor().Dynamic._childEditAccessibleObject = comboBoxChildEditUiaProvider; + AutomationEventCountingComboBoxChildEditUiaProvider comboBoxChildEditUiaProvider = new(comboBox, comboBox.TestAccessor.Dynamic._childEdit.HWND); + comboBox.TestAccessor.Dynamic._childEditAccessibleObject = comboBoxChildEditUiaProvider; comboBox.Items.Add("item1"); comboBox.Items.Add("item2"); @@ -2193,8 +2193,8 @@ public void ComboBox_OnKeyUp_Invoke_RaiseAutomationEvent_AccessibilityObjectIsCr { using AutomationEventCountingComboBox comboBox = new(); comboBox.CreateControl(); - AutomationEventCountingComboBoxChildEditUiaProvider comboBoxChildEditUiaProvider = new(comboBox, comboBox.TestAccessor().Dynamic._childEdit.HWND); - comboBox.TestAccessor().Dynamic._childEditAccessibleObject = comboBoxChildEditUiaProvider; + AutomationEventCountingComboBoxChildEditUiaProvider comboBoxChildEditUiaProvider = new(comboBox, comboBox.TestAccessor.Dynamic._childEdit.HWND); + comboBox.TestAccessor.Dynamic._childEditAccessibleObject = comboBoxChildEditUiaProvider; comboBox.Items.Add("item1"); comboBox.Items.Add("item2"); @@ -2215,8 +2215,8 @@ public void ComboBox_OnMouseDown_DoesNotInvoke_RaiseAutomationEvent_Accessibilit { using AutomationEventCountingComboBox comboBox = new(); comboBox.CreateControl(); - AutomationEventCountingComboBoxChildEditUiaProvider comboBoxChildEditUiaProvider = new(comboBox, comboBox.TestAccessor().Dynamic._childEdit.HWND); - comboBox.TestAccessor().Dynamic._childEditAccessibleObject = comboBoxChildEditUiaProvider; + AutomationEventCountingComboBoxChildEditUiaProvider comboBoxChildEditUiaProvider = new(comboBox, comboBox.TestAccessor.Dynamic._childEdit.HWND); + comboBox.TestAccessor.Dynamic._childEditAccessibleObject = comboBoxChildEditUiaProvider; comboBox.Items.Add("item1"); comboBox.Items.Add("item2"); @@ -2235,8 +2235,8 @@ public void ComboBox_OnMouseDown_Invoke_RaiseAutomationEvent_AccessibilityObject { using AutomationEventCountingComboBox comboBox = new(); comboBox.CreateControl(); - AutomationEventCountingComboBoxChildEditUiaProvider comboBoxChildEditUiaProvider = new(comboBox, comboBox.TestAccessor().Dynamic._childEdit.HWND); - comboBox.TestAccessor().Dynamic._childEditAccessibleObject = comboBoxChildEditUiaProvider; + AutomationEventCountingComboBoxChildEditUiaProvider comboBoxChildEditUiaProvider = new(comboBox, comboBox.TestAccessor.Dynamic._childEdit.HWND); + comboBox.TestAccessor.Dynamic._childEditAccessibleObject = comboBoxChildEditUiaProvider; comboBox.Items.Add("item1"); comboBox.Items.Add("item2"); @@ -2281,8 +2281,8 @@ public void ComboBox_SelectedItem_Set_DoesNotInvoke_RaiseAutomationEvent_Accessi { using AutomationEventCountingComboBox comboBox = new(); comboBox.CreateControl(); - AutomationEventCountingComboBoxChildEditUiaProvider comboBoxChildEditUiaProvider = new(comboBox, comboBox.TestAccessor().Dynamic._childEdit.HWND); - comboBox.TestAccessor().Dynamic._childEditAccessibleObject = comboBoxChildEditUiaProvider; + AutomationEventCountingComboBoxChildEditUiaProvider comboBoxChildEditUiaProvider = new(comboBox, comboBox.TestAccessor.Dynamic._childEdit.HWND); + comboBox.TestAccessor.Dynamic._childEditAccessibleObject = comboBoxChildEditUiaProvider; comboBox.Items.Add("item1"); comboBox.Items.Add("item2"); @@ -2298,8 +2298,8 @@ public void ComboBox_SelectedItem_Set_Invoke_RaiseAutomationEvent_AccessibilityO { using AutomationEventCountingComboBox comboBox = new(); comboBox.CreateControl(); - AutomationEventCountingComboBoxChildEditUiaProvider comboBoxChildEditUiaProvider = new(comboBox, comboBox.TestAccessor().Dynamic._childEdit.HWND); - comboBox.TestAccessor().Dynamic._childEditAccessibleObject = comboBoxChildEditUiaProvider; + AutomationEventCountingComboBoxChildEditUiaProvider comboBoxChildEditUiaProvider = new(comboBox, comboBox.TestAccessor.Dynamic._childEdit.HWND); + comboBox.TestAccessor.Dynamic._childEditAccessibleObject = comboBoxChildEditUiaProvider; comboBox.Items.Add("item1"); comboBox.Items.Add("item2"); @@ -2321,8 +2321,8 @@ public void ComboBox_Text_Set_DoesNotInvoke_RaiseAutomationEvent_AccessibilityOb using AutomationEventCountingComboBox comboBox = new(); comboBox.CreateControl(); - AutomationEventCountingComboBoxChildEditUiaProvider comboBoxChildEditUiaProvider = new(comboBox, comboBox.TestAccessor().Dynamic._childEdit.HWND); - comboBox.TestAccessor().Dynamic._childEditAccessibleObject = comboBoxChildEditUiaProvider; + AutomationEventCountingComboBoxChildEditUiaProvider comboBoxChildEditUiaProvider = new(comboBox, comboBox.TestAccessor.Dynamic._childEdit.HWND); + comboBox.TestAccessor.Dynamic._childEditAccessibleObject = comboBoxChildEditUiaProvider; comboBox.Items.Add("item1"); comboBox.Items.Add("item2"); @@ -2338,8 +2338,8 @@ public void ComboBox_Text_Set_Invoke_RaiseAutomationEvent_AccessibilityObjectIsC { using AutomationEventCountingComboBox comboBox = new(); comboBox.CreateControl(); - AutomationEventCountingComboBoxChildEditUiaProvider comboBoxChildEditUiaProvider = new(comboBox, comboBox.TestAccessor().Dynamic._childEdit.HWND); - comboBox.TestAccessor().Dynamic._childEditAccessibleObject = comboBoxChildEditUiaProvider; + AutomationEventCountingComboBoxChildEditUiaProvider comboBoxChildEditUiaProvider = new(comboBox, comboBox.TestAccessor.Dynamic._childEdit.HWND); + comboBox.TestAccessor.Dynamic._childEditAccessibleObject = comboBoxChildEditUiaProvider; comboBox.Items.Add("item1"); comboBox.Items.Add("item2"); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ContainerControlTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ContainerControlTests.cs index 7b6253fcc62..e24bc891530 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ContainerControlTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ContainerControlTests.cs @@ -1322,12 +1322,12 @@ public void ContainerControl_OnMove_HidesToolTip_IfToolTipIsShown() // Simulate that a keyboard toolTip is shown KeyboardToolTipStateMachine instance = KeyboardToolTipStateMachine.Instance; - instance.TestAccessor().Dynamic._currentTool = control; - instance.TestAccessor().Dynamic._currentState = (byte)2; + instance.TestAccessor.Dynamic._currentTool = control; + instance.TestAccessor.Dynamic._currentState = (byte)2; container.MoveContainer(); - IKeyboardToolTip currentTool = instance.TestAccessor().Dynamic._currentTool; - string currentState = instance.TestAccessor().Dynamic._currentState.ToString(); + IKeyboardToolTip currentTool = instance.TestAccessor.Dynamic._currentTool; + string currentState = instance.TestAccessor.Dynamic._currentState.ToString(); Assert.Null(currentTool); Assert.Equal("Hidden", currentState); @@ -1347,12 +1347,12 @@ public void ContainerControl_OnResize_HidesToolTip_IfToolTipIsShown() // Simulate that a keyboard toolTip is shown KeyboardToolTipStateMachine instance = KeyboardToolTipStateMachine.Instance; - instance.TestAccessor().Dynamic._currentTool = control; - instance.TestAccessor().Dynamic._currentState = (byte)2; + instance.TestAccessor.Dynamic._currentTool = control; + instance.TestAccessor.Dynamic._currentState = (byte)2; container.ResizeContainer(); - IKeyboardToolTip currentTool = instance.TestAccessor().Dynamic._currentTool; - string currentState = instance.TestAccessor().Dynamic._currentState.ToString(); + IKeyboardToolTip currentTool = instance.TestAccessor.Dynamic._currentTool; + string currentState = instance.TestAccessor.Dynamic._currentState.ToString(); Assert.Null(currentTool); Assert.Equal("Hidden", currentState); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ControlTests.Internals.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ControlTests.Internals.cs index 89d3bd2d91a..5ddaf37ce6a 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ControlTests.Internals.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ControlTests.Internals.cs @@ -407,7 +407,7 @@ public void Control_ReflectParentDoesNotRootParent() using Control control = new(); CreateAndDispose(control); GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, blocking: true); - Assert.Null(control.TestAccessor().Dynamic.ReflectParent); + Assert.Null(control.TestAccessor.Dynamic.ReflectParent); [MethodImpl(MethodImplOptions.NoInlining)] static void CreateAndDispose(Control control) @@ -418,7 +418,7 @@ static void CreateAndDispose(Control control) form.Controls.Add(control); form.Show(); form.Controls.Remove(control); - Assert.NotNull(control.TestAccessor().Dynamic.ReflectParent); + Assert.NotNull(control.TestAccessor.Dynamic.ReflectParent); } } } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ControlTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ControlTests.cs index f8d1e3de2a8..2286bbff228 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ControlTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ControlTests.cs @@ -1235,7 +1235,7 @@ public SubControl(Control parent, string text, int left, int top, int width, int } public Control GetNextSelectableControl(Control ctl, bool forward, bool tabStopOnly, bool nested, bool wrap) - => this.TestAccessor().Dynamic.GetNextSelectableControl(ctl, forward, tabStopOnly, nested, wrap); + => this.TestAccessor.Dynamic.GetNextSelectableControl(ctl, forward, tabStopOnly, nested, wrap); public new bool CanEnableIme => base.CanEnableIme; diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewButtonCellTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewButtonCellTests.cs index eeab7acd99f..a0f423e2c0a 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewButtonCellTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewButtonCellTests.cs @@ -52,7 +52,7 @@ public void GetContentBounds_ReturnsEmpty_WhenDataGridViewIsNull() { DataGridViewCellStyle dataGridViewCellStyle = new(); using Graphics g = Graphics.FromImage(new Bitmap(10, 10)); - var result = _dataGridViewButtonCell.TestAccessor().Dynamic.GetContentBounds(g, dataGridViewCellStyle, 0); + var result = _dataGridViewButtonCell.TestAccessor.Dynamic.GetContentBounds(g, dataGridViewCellStyle, 0); ((Rectangle)result).Should().Be(Rectangle.Empty); } @@ -66,7 +66,7 @@ public void GetContentBounds_ReturnsEmpty_WhenRowIndexIsNegative() dataGridView.Columns.Add(new DataGridViewButtonColumn()); dataGridView.Rows.Add(); dataGridView[0, 0] = _dataGridViewButtonCell; - var result = _dataGridViewButtonCell.TestAccessor().Dynamic.GetContentBounds(g, dataGridViewCellStyle, -1); + var result = _dataGridViewButtonCell.TestAccessor.Dynamic.GetContentBounds(g, dataGridViewCellStyle, -1); ((Rectangle)result).Should().Be(Rectangle.Empty); } @@ -81,7 +81,7 @@ public void GetContentBounds_ReturnsEmpty_WhenOwningColumnIsNull() dataGridView.Rows.Add(); dataGridView[0, 0] = _dataGridViewButtonCell; dataGridView.Columns.Clear(); - var result = _dataGridViewButtonCell.TestAccessor().Dynamic.GetContentBounds(g, dataGridViewCellStyle, 0); + var result = _dataGridViewButtonCell.TestAccessor.Dynamic.GetContentBounds(g, dataGridViewCellStyle, 0); ((Rectangle)result).Should().Be(Rectangle.Empty); } @@ -91,7 +91,7 @@ public void GetErrorIconBounds_ReturnsEmpty_WhenDataGridViewIsNull() { DataGridViewCellStyle dataGridViewCellStyle = new(); using Graphics g = Graphics.FromImage(new Bitmap(10, 10)); - var result = _dataGridViewButtonCell.TestAccessor().Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, 0); + var result = _dataGridViewButtonCell.TestAccessor.Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, 0); ((Rectangle)result).Should().Be(Rectangle.Empty); } @@ -105,7 +105,7 @@ public void GetErrorIconBounds_ReturnsEmpty_WhenRowIndexIsNegative() dataGridView.Columns.Add(new DataGridViewButtonColumn()); dataGridView.Rows.Add(); dataGridView[0, 0] = _dataGridViewButtonCell; - var result = _dataGridViewButtonCell.TestAccessor().Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, -1); + var result = _dataGridViewButtonCell.TestAccessor.Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, -1); ((Rectangle)result).Should().Be(Rectangle.Empty); } @@ -120,7 +120,7 @@ public void GetErrorIconBounds_ReturnsEmpty_WhenOwningColumnIsNull() dataGridView.Rows.Add(); dataGridView[0, 0] = _dataGridViewButtonCell; dataGridView.Columns.Clear(); - var result = _dataGridViewButtonCell.TestAccessor().Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, 0); + var result = _dataGridViewButtonCell.TestAccessor.Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, 0); ((Rectangle)result).Should().Be(Rectangle.Empty); } @@ -135,7 +135,7 @@ public void GetErrorIconBounds_ReturnsEmpty_WhenShowCellErrorsIsFalse() dataGridView.Rows.Add(); dataGridView.ShowCellErrors = false; dataGridView[0, 0] = _dataGridViewButtonCell; - var result = _dataGridViewButtonCell.TestAccessor().Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, 0); + var result = _dataGridViewButtonCell.TestAccessor.Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, 0); ((Rectangle)result).Should().Be(Rectangle.Empty); } @@ -149,7 +149,7 @@ public void GetErrorIconBounds_ReturnsEmpty_WhenErrorTextIsEmpty() dataGridView.Columns.Add(new DataGridViewButtonColumn()); dataGridView.Rows.Add(); dataGridView[0, 0] = _dataGridViewButtonCell; - var result = _dataGridViewButtonCell.TestAccessor().Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, 0); + var result = _dataGridViewButtonCell.TestAccessor.Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, 0); ((Rectangle)result).Should().Be(Rectangle.Empty); } @@ -165,7 +165,7 @@ public void GetErrorIconBounds_ReturnsNonEmpty_WhenErrorTextIsSet() dataGridView[0, 0] = _dataGridViewButtonCell; _dataGridViewButtonCell.ErrorText = "Error!"; - var result = _dataGridViewButtonCell.TestAccessor().Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, 0); + var result = _dataGridViewButtonCell.TestAccessor.Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, 0); ((Rectangle)result).Should().NotBe(Rectangle.Empty); } @@ -178,7 +178,7 @@ public void GetPreferredSize_ReturnsMinusOne_WhenDataGridViewIsNull() Font = SystemFonts.DefaultFont }; using Graphics g = Graphics.FromImage(new Bitmap(10, 10)); - var result = _dataGridViewButtonCell.TestAccessor().Dynamic.GetPreferredSize(g, dataGridViewCellStyle, 0, new Size(100, 100)); + var result = _dataGridViewButtonCell.TestAccessor.Dynamic.GetPreferredSize(g, dataGridViewCellStyle, 0, new Size(100, 100)); ((Size)result).Should().Be(new Size(-1, -1)); } @@ -192,7 +192,7 @@ public void GetPreferredSize_ThrowsNullReferenceException_WhenCellStyleIsNull() dataGridView.Rows.Add(); dataGridView[0, 0] = _dataGridViewButtonCell; - Action action = () => _dataGridViewButtonCell.TestAccessor().Dynamic.GetPreferredSize(g, null, 0, new Size(100, 100)); + Action action = () => _dataGridViewButtonCell.TestAccessor.Dynamic.GetPreferredSize(g, null, 0, new Size(100, 100)); action.Should().Throw(); } @@ -213,7 +213,7 @@ public void GetPreferredSize_UsesThemeMargins_WhenVisualStylesApplied() if (!DataGridView.ApplyVisualStylesToInnerCells) return; - var result = _dataGridViewButtonCell.TestAccessor().Dynamic.GetPreferredSize( + var result = _dataGridViewButtonCell.TestAccessor.Dynamic.GetPreferredSize( g, dataGridView.Rows[0].Cells[0].Style, 0, Size.Empty); ((Size)result).Width.Should().BeGreaterThan(0); @@ -230,7 +230,7 @@ public void GetValue_ReturnsColumnText_WhenUseColumnTextForButtonValueIsTrue() _dataGridViewButtonCell.UseColumnTextForButtonValue = true; dataGridView[0, 0] = _dataGridViewButtonCell; - var value = _dataGridViewButtonCell.TestAccessor().Dynamic.GetValue(0); + var value = _dataGridViewButtonCell.TestAccessor.Dynamic.GetValue(0); ((string)value).Should().Be("ColumnText"); } @@ -246,7 +246,7 @@ public void GetValue_ReturnsBaseValue_WhenUseColumnTextForButtonValueIsFalse() dataGridView[0, 0] = _dataGridViewButtonCell; _dataGridViewButtonCell.Value = "CellValue"; - var value = _dataGridViewButtonCell.TestAccessor().Dynamic.GetValue(0); + var value = _dataGridViewButtonCell.TestAccessor.Dynamic.GetValue(0); ((string)value).Should().Be("CellValue"); } @@ -263,7 +263,7 @@ public void GetValue_ReturnsBaseValue_WhenOwningColumnIsNotButtonColumn() dataGridView[0, 0] = _dataGridViewButtonCell; _dataGridViewButtonCell.Value = "CellValue"; - var value = _dataGridViewButtonCell.TestAccessor().Dynamic.GetValue(0); + var value = _dataGridViewButtonCell.TestAccessor.Dynamic.GetValue(0); ((string)value).Should().Be("CellValue"); } @@ -285,7 +285,7 @@ public void KeyDownUnsharesRow_ReturnsExpected(Keys key, bool alt, bool control, keyData |= Keys.Shift; KeyEventArgs e = new(keyData); - bool result = _dataGridViewButtonCell.TestAccessor().Dynamic.KeyDownUnsharesRow(e, 0); + bool result = _dataGridViewButtonCell.TestAccessor.Dynamic.KeyDownUnsharesRow(e, 0); result.Should().Be(expected); } @@ -297,7 +297,7 @@ public void KeyUpUnsharesRow_ReturnsExpected(Keys key, bool expected) { KeyEventArgs e = new(key); - bool result = _dataGridViewButtonCell.TestAccessor().Dynamic.KeyUpUnsharesRow(e, 0); + bool result = _dataGridViewButtonCell.TestAccessor.Dynamic.KeyUpUnsharesRow(e, 0); result.Should().Be(expected); } @@ -311,7 +311,7 @@ public void MouseDownUnsharesRow_ReturnsExpected(MouseButtons button, bool expec { DataGridViewCellMouseEventArgs e = new(0, 0, 0, 0, new MouseEventArgs(button, 1, 0, 0, 0)); - bool result = _dataGridViewButtonCell.TestAccessor().Dynamic.MouseDownUnsharesRow(e); + bool result = _dataGridViewButtonCell.TestAccessor.Dynamic.MouseDownUnsharesRow(e); result.Should().Be(expected); } @@ -328,9 +328,9 @@ public void MouseLeaveUnsharesRow_ReturnsExpected(ButtonState buttonState, bool dataGridView.Rows.Add(); dataGridView[0, 0] = _dataGridViewButtonCell; - _dataGridViewButtonCell.TestAccessor().Dynamic.ButtonState = buttonState; + _dataGridViewButtonCell.TestAccessor.Dynamic.ButtonState = buttonState; - bool result = _dataGridViewButtonCell.TestAccessor().Dynamic.MouseLeaveUnsharesRow(0); + bool result = _dataGridViewButtonCell.TestAccessor.Dynamic.MouseLeaveUnsharesRow(0); result.Should().Be(expected); } @@ -348,7 +348,7 @@ public void MouseUpUnsharesRow_ReturnsExpected(MouseButtons button, bool expecte dataGridView[0, 0] = _dataGridViewButtonCell; DataGridViewCellMouseEventArgs dataGridViewCellMouseEventArgs = new(0, 0, 0, 0, new MouseEventArgs(button, 1, 0, 0, 0)); - bool result = _dataGridViewButtonCell.TestAccessor().Dynamic.MouseUpUnsharesRow(dataGridViewCellMouseEventArgs); + bool result = _dataGridViewButtonCell.TestAccessor.Dynamic.MouseUpUnsharesRow(dataGridViewCellMouseEventArgs); result.Should().Be(expected); } @@ -363,11 +363,11 @@ public void OnKeyDown_SetsCheckedStateAndHandled_WhenSpacePressedWithoutModifier KeyEventArgs keyEventArgs = new(Keys.Space); - ButtonState buttonState = _dataGridViewButtonCell.TestAccessor().Dynamic.ButtonState; + ButtonState buttonState = _dataGridViewButtonCell.TestAccessor.Dynamic.ButtonState; buttonState.Should().Be(ButtonState.Normal); - _dataGridViewButtonCell.TestAccessor().Dynamic.OnKeyDown(keyEventArgs, 0); - buttonState = _dataGridViewButtonCell.TestAccessor().Dynamic.ButtonState; + _dataGridViewButtonCell.TestAccessor.Dynamic.OnKeyDown(keyEventArgs, 0); + buttonState = _dataGridViewButtonCell.TestAccessor.Dynamic.ButtonState; buttonState.HasFlag(ButtonState.Checked).Should().BeTrue(); keyEventArgs.Handled.Should().BeTrue(); @@ -388,11 +388,11 @@ public void OnKeyDown_DoesNotSetCheckedStateOrHandled_WhenModifiersOrOtherKey(Ke KeyEventArgs keyEventArgs = new(keyData); - ButtonState buttonState = _dataGridViewButtonCell.TestAccessor().Dynamic.ButtonState; + ButtonState buttonState = _dataGridViewButtonCell.TestAccessor.Dynamic.ButtonState; buttonState.Should().Be(ButtonState.Normal); - _dataGridViewButtonCell.TestAccessor().Dynamic.OnKeyDown(keyEventArgs, 0); - buttonState = _dataGridViewButtonCell.TestAccessor().Dynamic.ButtonState; + _dataGridViewButtonCell.TestAccessor.Dynamic.OnKeyDown(keyEventArgs, 0); + buttonState = _dataGridViewButtonCell.TestAccessor.Dynamic.ButtonState; (buttonState & ButtonState.Checked).Should().Be(0); keyEventArgs.Handled.Should().BeFalse(); @@ -411,12 +411,12 @@ public void OnKeyUp_RemovesCheckedState_AndSetsHandledAsExpected(Keys keyData, b dataGridView.Rows.Add(); dataGridView[0, 0] = _dataGridViewButtonCell; - _dataGridViewButtonCell.TestAccessor().Dynamic.ButtonState = ButtonState.Checked; + _dataGridViewButtonCell.TestAccessor.Dynamic.ButtonState = ButtonState.Checked; KeyEventArgs keyEventArgs = new(keyData); - _dataGridViewButtonCell.TestAccessor().Dynamic.OnKeyUp(keyEventArgs, 0); + _dataGridViewButtonCell.TestAccessor.Dynamic.OnKeyUp(keyEventArgs, 0); - ButtonState buttonState = _dataGridViewButtonCell.TestAccessor().Dynamic.ButtonState; + ButtonState buttonState = _dataGridViewButtonCell.TestAccessor.Dynamic.ButtonState; buttonState.HasFlag(ButtonState.Checked).Should().BeFalse(); keyEventArgs.Handled.Should().Be(expectedHandled); } @@ -430,11 +430,11 @@ public void OnLeave_ResetsButtonState_WhenNotNormal() dataGridView.Rows.Add(); dataGridView[0, 0] = _dataGridViewButtonCell; - _dataGridViewButtonCell.TestAccessor().Dynamic.ButtonState = ButtonState.Pushed | ButtonState.Checked; + _dataGridViewButtonCell.TestAccessor.Dynamic.ButtonState = ButtonState.Pushed | ButtonState.Checked; - _dataGridViewButtonCell.TestAccessor().Dynamic.OnLeave(0, false); + _dataGridViewButtonCell.TestAccessor.Dynamic.OnLeave(0, false); - ButtonState buttonState = _dataGridViewButtonCell.TestAccessor().Dynamic.ButtonState; + ButtonState buttonState = _dataGridViewButtonCell.TestAccessor.Dynamic.ButtonState; buttonState.Should().Be(ButtonState.Normal); } @@ -446,12 +446,12 @@ public void OnMouseUp_UpdatesButtonState_WhenLeftButton() dataGridView.Columns.Add(dataGridViewButtonColumn); dataGridView.Rows.Add(); dataGridView[0, 0] = _dataGridViewButtonCell; - _dataGridViewButtonCell.TestAccessor().Dynamic.ButtonState = ButtonState.Pushed; + _dataGridViewButtonCell.TestAccessor.Dynamic.ButtonState = ButtonState.Pushed; DataGridViewCellMouseEventArgs dataGridViewCellMouseEventArgs = new(0, 0, 0, 0, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0)); - _dataGridViewButtonCell.TestAccessor().Dynamic.OnMouseUp(dataGridViewCellMouseEventArgs); + _dataGridViewButtonCell.TestAccessor.Dynamic.OnMouseUp(dataGridViewCellMouseEventArgs); - ((ButtonState)_dataGridViewButtonCell.TestAccessor().Dynamic.ButtonState).HasFlag(ButtonState.Pushed).Should().BeFalse(); + ((ButtonState)_dataGridViewButtonCell.TestAccessor.Dynamic.ButtonState).HasFlag(ButtonState.Pushed).Should().BeFalse(); } [WinFormsFact] @@ -464,7 +464,7 @@ public void Paint_CallsPaintPrivate_WithExpectedParameters() dataGridView[0, 0] = _dataGridViewButtonCell; DataGridViewCellStyle dataGridViewCellStyle = new() { Font = SystemFonts.DefaultFont }; DataGridViewAdvancedBorderStyle advancedBorderStyle = new(); - _dataGridViewButtonCell.TestAccessor().Dynamic.Paint( + _dataGridViewButtonCell.TestAccessor.Dynamic.Paint( g, new Rectangle(0, 0, 10, 10), new Rectangle(0, 0, 10, 10), diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewButtonColumnTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewButtonColumnTests.cs index af76ea7c566..61ad414e994 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewButtonColumnTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewButtonColumnTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Drawing; @@ -187,7 +187,7 @@ public void DataGridViewButtonColumn_Clone_CopiesProperties() [Fact] public void DataGridViewButtonColumn_ShouldSerializeDefaultCellStyle_ReturnsExpected() { - dynamic accessor = _column.TestAccessor().Dynamic; + dynamic accessor = _column.TestAccessor.Dynamic; bool result = accessor.ShouldSerializeDefaultCellStyle(); result.Should().BeFalse(); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewComboBoxCellTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewComboBoxCellTests.cs index d4c7566960d..9518ee76988 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewComboBoxCellTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewComboBoxCellTests.cs @@ -200,8 +200,8 @@ public void ValueType_WithDisplayMemberProperty_ReturnsPropertyType() { StubPropertyDescriptor prop = new("Name", typeof(string)); - _dataGridViewComboBoxCell.TestAccessor().Dynamic.DisplayMemberProperty = prop; - _dataGridViewComboBoxCell.TestAccessor().Dynamic.ValueMemberProperty = null; + _dataGridViewComboBoxCell.TestAccessor.Dynamic.DisplayMemberProperty = prop; + _dataGridViewComboBoxCell.TestAccessor.Dynamic.ValueMemberProperty = null; _dataGridViewComboBoxCell.ValueType.Should().Be(typeof(string)); } @@ -213,7 +213,7 @@ public void GetContentBounds_ReturnsEmpty_WhenDataGridViewIsNull() using Graphics g = Graphics.FromImage(bmp); DataGridViewCellStyle style = new(); - Rectangle result = _dataGridViewComboBoxCell.TestAccessor().Dynamic.GetContentBounds(g, style, 0); + Rectangle result = _dataGridViewComboBoxCell.TestAccessor.Dynamic.GetContentBounds(g, style, 0); result.Should().Be(Rectangle.Empty); } @@ -228,7 +228,7 @@ public void GetContentBounds_ReturnsEmpty_WhenRowIndexIsNegative() using Graphics g = Graphics.FromImage(bmp); DataGridViewCellStyle style = new(); - Rectangle result = _dataGridViewComboBoxCell.TestAccessor().Dynamic.GetContentBounds(g, style, -1); + Rectangle result = _dataGridViewComboBoxCell.TestAccessor.Dynamic.GetContentBounds(g, style, -1); result.Should().Be(Rectangle.Empty); } @@ -240,7 +240,7 @@ public void GetErrorIconBounds_ReturnsEmpty_WhenDataGridViewIsNull() using Graphics g = Graphics.FromImage(bmp); DataGridViewCellStyle style = new(); - Rectangle result = _dataGridViewComboBoxCell.TestAccessor().Dynamic.GetErrorIconBounds(g, style, 0); + Rectangle result = _dataGridViewComboBoxCell.TestAccessor.Dynamic.GetErrorIconBounds(g, style, 0); result.Should().Be(Rectangle.Empty); } @@ -255,7 +255,7 @@ public void GetErrorIconBounds_UsingTestAccessor_ReturnsEmpty_WhenRowIndexIsNega using Graphics g = Graphics.FromImage(bmp); DataGridViewCellStyle style = new(); - Rectangle result = _dataGridViewComboBoxCell.TestAccessor().Dynamic.GetErrorIconBounds(g, style, -1); + Rectangle result = _dataGridViewComboBoxCell.TestAccessor.Dynamic.GetErrorIconBounds(g, style, -1); result.Should().Be(Rectangle.Empty); } @@ -267,7 +267,7 @@ public void GetPreferredSize_ReturnsMinusOne_WhenDataGridViewIsNull() using Graphics g = Graphics.FromImage(bmp); DataGridViewCellStyle style = new(); - Size result = _dataGridViewComboBoxCell.TestAccessor().Dynamic.GetPreferredSize( + Size result = _dataGridViewComboBoxCell.TestAccessor.Dynamic.GetPreferredSize( g, style, 0, @@ -336,7 +336,7 @@ public void ParseFormattedValue_UsesValueMemberPropertyConverter_WhenValueTypeCo DataGridViewCellStyle style = new(); StubPropertyDescriptor prop = new("Id", typeof(string)); - _dataGridViewComboBoxCell.TestAccessor().Dynamic.ValueMemberProperty = prop; + _dataGridViewComboBoxCell.TestAccessor.Dynamic.ValueMemberProperty = prop; object? result = _dataGridViewComboBoxCell.ParseFormattedValue("abc", style, null, null); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewImageCellTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewImageCellTests.cs index 0b832de5728..7831ed0b64d 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewImageCellTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewImageCellTests.cs @@ -98,7 +98,7 @@ public void GetContentBounds_ReturnsEmpty_WhenDataGridViewIsNull() using Graphics g = Graphics.FromImage(new Bitmap(10, 10)); DataGridViewCellStyle dataGridViewCellStyle = new(); _dataGridViewImageCell.DataGridView = null; - Rectangle bounds = (Rectangle)_dataGridViewImageCell.TestAccessor().Dynamic.GetContentBounds(g, dataGridViewCellStyle, 0); + Rectangle bounds = (Rectangle)_dataGridViewImageCell.TestAccessor.Dynamic.GetContentBounds(g, dataGridViewCellStyle, 0); bounds.Should().Be(Rectangle.Empty); } @@ -110,7 +110,7 @@ public void GetContentBounds_ReturnsEmpty_WhenRowIndexNegative() _dataGridViewImageCell.DataGridView = dataGridView; using Graphics g = Graphics.FromImage(new Bitmap(10, 10)); DataGridViewCellStyle dataGridViewCellStyle = new(); - Rectangle bounds = (Rectangle)_dataGridViewImageCell.TestAccessor().Dynamic.GetContentBounds(g, dataGridViewCellStyle, -1); + Rectangle bounds = (Rectangle)_dataGridViewImageCell.TestAccessor.Dynamic.GetContentBounds(g, dataGridViewCellStyle, -1); bounds.Should().Be(Rectangle.Empty); } @@ -125,7 +125,7 @@ public void GetContentBounds_ReturnsEmpty_WhenOwningColumnIsNull() _dataGridViewImageCell.OwningColumn = null; using Graphics g = Graphics.FromImage(new Bitmap(10, 10)); DataGridViewCellStyle dataGridViewCellStyle = new(); - Rectangle bounds = (Rectangle)_dataGridViewImageCell.TestAccessor().Dynamic.GetContentBounds(g, dataGridViewCellStyle, 0); + Rectangle bounds = (Rectangle)_dataGridViewImageCell.TestAccessor.Dynamic.GetContentBounds(g, dataGridViewCellStyle, 0); bounds.Should().Be(Rectangle.Empty); } @@ -135,7 +135,7 @@ public void GetErrorIconBounds_ReturnsEmpty_WhenDataGridViewIsNull() { using Graphics g = Graphics.FromImage(new Bitmap(10, 10)); DataGridViewCellStyle dataGridViewCellStyle = new(); - Rectangle bounds = (Rectangle)_dataGridViewImageCell.TestAccessor().Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, 0); + Rectangle bounds = (Rectangle)_dataGridViewImageCell.TestAccessor.Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, 0); bounds.Should().Be(Rectangle.Empty); } @@ -149,7 +149,7 @@ public void GetErrorIconBounds_ReturnsEmpty_WhenRowIndexNegative() _dataGridViewImageCell.DataGridView = dataGridView; using Graphics g = Graphics.FromImage(new Bitmap(10, 10)); DataGridViewCellStyle dataGridViewCellStyle = new(); - Rectangle bounds = (Rectangle)_dataGridViewImageCell.TestAccessor().Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, -1); + Rectangle bounds = (Rectangle)_dataGridViewImageCell.TestAccessor.Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, -1); bounds.Should().Be(Rectangle.Empty); } @@ -164,7 +164,7 @@ public void GetErrorIconBounds_ReturnsEmpty_WhenOwningColumnIsNull() _dataGridViewImageCell.OwningColumn = null; using Graphics g = Graphics.FromImage(new Bitmap(10, 10)); DataGridViewCellStyle dataGridViewCellStyle = new(); - Rectangle bounds = (Rectangle)_dataGridViewImageCell.TestAccessor().Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, 0); + Rectangle bounds = (Rectangle)_dataGridViewImageCell.TestAccessor.Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, 0); bounds.Should().Be(Rectangle.Empty); } @@ -180,7 +180,7 @@ public void GetErrorIconBounds_ReturnsEmpty_WhenShowCellErrorsIsFalse() _dataGridViewImageCell.DataGridView = dataGridView; using Graphics g = Graphics.FromImage(new Bitmap(10, 10)); DataGridViewCellStyle dataGridViewCellStyle = new(); - Rectangle bounds = (Rectangle)_dataGridViewImageCell.TestAccessor().Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, 0); + Rectangle bounds = (Rectangle)_dataGridViewImageCell.TestAccessor.Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, 0); bounds.Should().Be(Rectangle.Empty); } @@ -198,7 +198,7 @@ public void GetErrorIconBounds_ReturnsEmpty_WhenErrorTextIsNullOrEmpty() _dataGridViewImageCell.OwningColumn = null; using Graphics g = Graphics.FromImage(new Bitmap(10, 10)); DataGridViewCellStyle dataGridViewCellStyle = new(); - Rectangle bounds = (Rectangle)_dataGridViewImageCell.TestAccessor().Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, 0); + Rectangle bounds = (Rectangle)_dataGridViewImageCell.TestAccessor.Dynamic.GetErrorIconBounds(g, dataGridViewCellStyle, 0); bounds.Should().Be(Rectangle.Empty); } @@ -209,7 +209,7 @@ public void GetPreferredSize_ReturnsMinusOne_WhenDataGridViewIsNull() using DataGridViewImageCell dataGridViewImageCell = _dataGridViewImageCell; using Graphics g = Graphics.FromImage(new Bitmap(10, 10)); DataGridViewCellStyle dataGridViewCellStyle = new(); - Size size = (Size)dataGridViewImageCell.TestAccessor().Dynamic.GetPreferredSize(g, dataGridViewCellStyle, 0, new Size(100, 100)); + Size size = (Size)dataGridViewImageCell.TestAccessor.Dynamic.GetPreferredSize(g, dataGridViewCellStyle, 0, new Size(100, 100)); size.Should().Be(new Size(-1, -1)); } @@ -219,7 +219,7 @@ public void GetPreferredSize_ThrowsNullReferenceException_WhenCellStyleIsNull() { using DataGridViewImageCell dataGridViewImageCell = _dataGridViewImageCell; using Graphics g = Graphics.FromImage(new Bitmap(10, 10)); - Action action = () => dataGridViewImageCell.TestAccessor().Dynamic.GetPreferredSize(g, null, 0, new Size(100, 100)); + Action action = () => dataGridViewImageCell.TestAccessor.Dynamic.GetPreferredSize(g, null, 0, new Size(100, 100)); action.Should().Throw(); } @@ -237,7 +237,7 @@ public void Paint_DoesNotThrow_WithValidArguments_UsingTestAccessor() DataGridViewCellStyle dataGridViewCellStyle = new(); DataGridViewAdvancedBorderStyle borderStyle = new(); - Action action = () => dataGridViewImageCell.TestAccessor().Dynamic.Paint( + Action action = () => dataGridViewImageCell.TestAccessor.Dynamic.Paint( g, new Rectangle(0, 0, 10, 10), new Rectangle(0, 0, 10, 10), diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewLinkCellTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewLinkCellTests.cs index dcb2aed4066..a3c487fbb0f 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewLinkCellTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewLinkCellTests.cs @@ -319,7 +319,7 @@ public void GetErrorIconBounds_ReturnsEmpty_WhenErrorTextIsNullOrEmpty() using DataGridView dataGridView = CreateGridWithColumn(); dataGridView.Rows[0].Cells[0] = _cell; - string? errorText = _cell.TestAccessor().Dynamic.GetErrorText(0); + string? errorText = _cell.TestAccessor.Dynamic.GetErrorText(0); errorText.Should().BeNullOrEmpty(); Rectangle result = _cell.GetErrorIconBounds(0); @@ -337,7 +337,7 @@ public void GetValue_ReturnsBaseValue_WhenUseColumnTextForLinkValueIsFalse() object testValue = "TestValue"; _cell.Value = testValue; - object? result = _cell.TestAccessor().Dynamic.GetValue(0); + object? result = _cell.TestAccessor.Dynamic.GetValue(0); result.Should().Be(testValue); } @@ -352,7 +352,7 @@ public void GetValue_ReturnsColumnText_WhenUseColumnTextForLinkValueIsTrue_AndOw _cell.UseColumnTextForLinkValue = true; dataGridView.Rows[0].Cells[0] = _cell; - object? result = _cell.TestAccessor().Dynamic.GetValue(0); + object? result = _cell.TestAccessor.Dynamic.GetValue(0); result.Should().Be("ColumnText"); } @@ -366,7 +366,7 @@ public void GetValue_ReturnsBaseValue_WhenUseColumnTextForLinkValueIsTrue_ButOwn object testValue = "TestValue"; _cell.Value = testValue; - object? result = _cell.TestAccessor().Dynamic.GetValue(0); + object? result = _cell.TestAccessor.Dynamic.GetValue(0); result.Should().Be(testValue); } @@ -384,7 +384,7 @@ public void GetValue_ReturnsBaseValue_WhenUseColumnTextForLinkValueIsTrue_AndRow object testValue = "TestValue"; _cell.Value = testValue; - object? result = _cell.TestAccessor().Dynamic.GetValue(newRowIndex); + object? result = _cell.TestAccessor.Dynamic.GetValue(newRowIndex); result.Should().Be(testValue); } @@ -402,7 +402,7 @@ public void KeyUpUnsharesRow_VariousScenarios_ReturnsExpected(Keys key, bool alt _cell.TrackVisitedState = trackVisitedState; _cell.LinkVisited = linkVisited; - bool result = _cell.TestAccessor().Dynamic.KeyUpUnsharesRow(keyEvent, 0); + bool result = _cell.TestAccessor.Dynamic.KeyUpUnsharesRow(keyEvent, 0); result.Should().Be(expected); } @@ -415,7 +415,7 @@ public void MouseDownUnsharesRow_ReturnsFalse_WhenPointInLinkBounds() MouseEventArgs mouseEventArgs = new(MouseButtons.None, 0, 1, 1, 0); DataGridViewCellMouseEventArgs args = new(0, 0, 1, 1, mouseEventArgs); - bool result = _cell.TestAccessor().Dynamic.MouseDownUnsharesRow(args); + bool result = _cell.TestAccessor.Dynamic.MouseDownUnsharesRow(args); result.Should().BeFalse(); } @@ -428,7 +428,7 @@ public void MouseDownUnsharesRow_ReturnsFalse_WhenPointNotInLinkBounds() MouseEventArgs mouseEventArgs = new(MouseButtons.None, 0, 100, 100, 0); DataGridViewCellMouseEventArgs args = new(0, 0, 100, 100, mouseEventArgs); - bool result = _cell.TestAccessor().Dynamic.MouseDownUnsharesRow(args); + bool result = _cell.TestAccessor.Dynamic.MouseDownUnsharesRow(args); result.Should().BeFalse(); } @@ -436,12 +436,12 @@ public void MouseDownUnsharesRow_ReturnsFalse_WhenPointNotInLinkBounds() [WinFormsFact] public void MouseMoveUnsharesRow_ReturnsTrue_WhenPointInLinkBounds_AndHoverSet() { - _cell.TestAccessor().Dynamic.LinkState = LinkState.Hover; + _cell.TestAccessor.Dynamic.LinkState = LinkState.Hover; MouseEventArgs mouseEventArgs = new(MouseButtons.None, 0, 1, 1, 0); DataGridViewCellMouseEventArgs args = new(0, 0, 1, 1, mouseEventArgs); - bool result = _cell.TestAccessor().Dynamic.MouseMoveUnsharesRow(args); + bool result = _cell.TestAccessor.Dynamic.MouseMoveUnsharesRow(args); result.Should().BeTrue(); } @@ -449,7 +449,7 @@ public void MouseMoveUnsharesRow_ReturnsTrue_WhenPointInLinkBounds_AndHoverSet() [WinFormsFact] public void MouseMoveUnsharesRow_CanSetLinkBehaviorInternal() { - _cell.TestAccessor().Dynamic.LinkBehaviorInternal = LinkBehavior.AlwaysUnderline; + _cell.TestAccessor.Dynamic.LinkBehaviorInternal = LinkBehavior.AlwaysUnderline; _cell.LinkBehavior.Should().Be(LinkBehavior.AlwaysUnderline); } @@ -457,12 +457,12 @@ public void MouseMoveUnsharesRow_CanSetLinkBehaviorInternal() [WinFormsFact] public void MouseMoveUnsharesRow_ReturnsTrue_WhenPointNotInLinkBounds_AndHoverSet() { - _cell.TestAccessor().Dynamic.LinkState = LinkState.Hover; + _cell.TestAccessor.Dynamic.LinkState = LinkState.Hover; MouseEventArgs mouseEventArgs = new(MouseButtons.None, 0, 100, 100, 0); DataGridViewCellMouseEventArgs args = new(0, 0, 100, 100, mouseEventArgs); - bool result = _cell.TestAccessor().Dynamic.MouseMoveUnsharesRow(args); + bool result = _cell.TestAccessor.Dynamic.MouseMoveUnsharesRow(args); result.Should().BeTrue(); } @@ -473,7 +473,7 @@ public void MouseMoveUnsharesRow_ReturnsFalse_WhenPointNotInLinkBounds_AndNotHov MouseEventArgs mouseEventArgs = new(MouseButtons.None, 0, 100, 100, 0); DataGridViewCellMouseEventArgs args = new(0, 0, 100, 100, mouseEventArgs); - bool result = _cell.TestAccessor().Dynamic.MouseMoveUnsharesRow(args); + bool result = _cell.TestAccessor.Dynamic.MouseMoveUnsharesRow(args); result.Should().BeFalse(); } @@ -486,7 +486,7 @@ public void MouseUpUnsharesRow_ReturnsFalse_WhenTrackVisitedStateFalse_AndPointI MouseEventArgs mouseEventArgs = new(MouseButtons.None, 0, 1, 1, 0); DataGridViewCellMouseEventArgs args = new(0, 0, 1, 1, mouseEventArgs); - bool result = _cell.TestAccessor().Dynamic.MouseUpUnsharesRow(args); + bool result = _cell.TestAccessor.Dynamic.MouseUpUnsharesRow(args); result.Should().BeFalse(); } @@ -499,7 +499,7 @@ public void MouseUpUnsharesRow_ReturnsFalse_WhenTrackVisitedStateFalse_AndPointN MouseEventArgs mouseEventArgs = new(MouseButtons.None, 0, 100, 100, 0); DataGridViewCellMouseEventArgs args = new(0, 0, 100, 100, mouseEventArgs); - bool result = _cell.TestAccessor().Dynamic.MouseUpUnsharesRow(args); + bool result = _cell.TestAccessor.Dynamic.MouseUpUnsharesRow(args); result.Should().BeFalse(); } @@ -509,7 +509,7 @@ public void OnKeyUp_DoesNothing_WhenDataGridViewIsNull() { KeyEventArgs keyEvent = new(Keys.Space); - _cell.Invoking(c => c.TestAccessor().Dynamic.OnKeyUp(keyEvent, 0)).Should().NotThrow(); + _cell.Invoking(c => c.TestAccessor.Dynamic.OnKeyUp(keyEvent, 0)).Should().NotThrow(); keyEvent.Handled.Should().BeFalse(); } @@ -533,7 +533,7 @@ public void OnKeyUp_RaisesCellClickAndContentClick_AndSetsHandled_AndLinkVisited }; KeyEventArgs keyEvent = new(Keys.Space); - _cell.TestAccessor().Dynamic.OnKeyUp(keyEvent, 0); + _cell.TestAccessor.Dynamic.OnKeyUp(keyEvent, 0); cellClickRaised.Should().BeTrue(); contentClickRaised.Should().BeTrue(); @@ -561,7 +561,7 @@ public void OnKeyUp_RaisesCellClickAndContentClick_ButNotLinkVisited_WhenTrackVi }; KeyEventArgs keyEvent = new(Keys.Space); - _cell.TestAccessor().Dynamic.OnKeyUp(keyEvent, 0); + _cell.TestAccessor.Dynamic.OnKeyUp(keyEvent, 0); cellClickRaised.Should().BeTrue(); contentClickRaised.Should().BeTrue(); @@ -580,7 +580,7 @@ public void OnKeyUp_DoesNotRaiseEvents_WhenKeyIsNotSpace() dataGridView.CellContentClick += (s, e) => contentClickRaised = true; KeyEventArgs keyEvent = new(Keys.Enter); - _cell.TestAccessor().Dynamic.OnKeyUp(keyEvent, 0); + _cell.TestAccessor.Dynamic.OnKeyUp(keyEvent, 0); cellClickRaised.Should().BeFalse(); contentClickRaised.Should().BeFalse(); @@ -593,12 +593,12 @@ public void OnMouseDown_DoesNothing_WhenDataGridViewIsNull() MouseEventArgs mouseEventArgs = new(MouseButtons.None, 0, 1, 1, 0); DataGridViewCellMouseEventArgs args = new(0, 0, 1, 1, mouseEventArgs); - _cell.Invoking(c => c.TestAccessor().Dynamic.OnMouseDown(args)).Should().NotThrow(); + _cell.Invoking(c => c.TestAccessor.Dynamic.OnMouseDown(args)).Should().NotThrow(); } [WinFormsFact] public void OnMouseLeave_DoesNothing_WhenDataGridViewIsNull() => - _cell.Invoking(c => c.TestAccessor().Dynamic.OnMouseLeave(0)).Should().NotThrow(); + _cell.Invoking(c => c.TestAccessor.Dynamic.OnMouseLeave(0)).Should().NotThrow(); [WinFormsFact] public void OnMouseMove_DoesNothing_WhenDataGridViewIsNull() @@ -606,7 +606,7 @@ public void OnMouseMove_DoesNothing_WhenDataGridViewIsNull() MouseEventArgs mouseEventArgs = new(MouseButtons.None, 0, 1, 1, 0); DataGridViewCellMouseEventArgs args = new(0, 0, 1, 1, mouseEventArgs); - _cell.Invoking(c => c.TestAccessor().Dynamic.OnMouseMove(args)).Should().NotThrow(); + _cell.Invoking(c => c.TestAccessor.Dynamic.OnMouseMove(args)).Should().NotThrow(); } [WinFormsFact] @@ -615,7 +615,7 @@ public void OnMouseUp_DoesNothing_WhenDataGridViewIsNull() MouseEventArgs mouseEventArgs = new(MouseButtons.None, 0, 1, 1, 0); DataGridViewCellMouseEventArgs args = new(0, 0, 1, 1, mouseEventArgs); - _cell.Invoking(c => c.TestAccessor().Dynamic.OnMouseUp(args)).Should().NotThrow(); + _cell.Invoking(c => c.TestAccessor.Dynamic.OnMouseUp(args)).Should().NotThrow(); } [WinFormsFact] @@ -628,7 +628,7 @@ public void OnMouseUp_DoesNotSetLinkVisited_WhenPointNotInLinkBounds() MouseEventArgs mouseEventArgs = new(MouseButtons.None, 0, 100, 100, 0); DataGridViewCellMouseEventArgs args = new(0, 0, 100, 100, mouseEventArgs); - _cell.TestAccessor().Dynamic.OnMouseUp(args); + _cell.TestAccessor.Dynamic.OnMouseUp(args); _cell.LinkVisited.Should().BeFalse(); } @@ -643,7 +643,7 @@ public void OnMouseUp_DoesNotSetLinkVisited_WhenTrackVisitedStateFalse() MouseEventArgs mouseEventArgs = new(MouseButtons.None, 0, 1, 1, 0); DataGridViewCellMouseEventArgs args = new(0, 0, 1, 1, mouseEventArgs); - _cell.TestAccessor().Dynamic.OnMouseUp(args); + _cell.TestAccessor.Dynamic.OnMouseUp(args); _cell.LinkVisited.Should().BeFalse(); } @@ -655,7 +655,7 @@ public void Paint_ThrowsArgumentNullException_WhenCellStyleIsNull() using Graphics graphics = Graphics.FromImage(bitmap); ((Action)(() => - _cell.TestAccessor().Dynamic.Paint( + _cell.TestAccessor.Dynamic.Paint( graphics, new Rectangle(0, 0, 10, 10), new Rectangle(0, 0, 10, 10), diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewRowTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewRowTests.cs index 5419bb8d407..68b3e26e2b2 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewRowTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewRowTests.cs @@ -2023,7 +2023,7 @@ public void DataGridViewRow_Height_IsEqualDefaultHeight_IfDefaultFontIsChanged() var oldApplicationDefaultFont = Application.DefaultFont; using Font font = new("Times New Roman", 12); using TestDataGridViewRow row = new(); - var applicationTestAccessor = typeof(Application).TestAccessor().Dynamic; + var applicationTestAccessor = typeof(Application).TestAccessor.Dynamic; try { @@ -5820,6 +5820,6 @@ internal class TestDataGridViewRow : DataGridViewRow { internal int GetDefaultHeight() { - return this.TestAccessor().Dynamic.DefaultHeight; + return this.TestAccessor.Dynamic.DefaultHeight; } } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataObjectComTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataObjectComTests.cs index 95f28497e1e..6495ac07def 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataObjectComTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataObjectComTests.cs @@ -17,8 +17,8 @@ public unsafe partial class DataObjectTests public void DataObject_CustomIDataObject_MockRoundTrip() { CustomIDataObject data = new(); - dynamic accessor = typeof(Control).TestAccessor().Dynamic; - var dropTargetAccessor = typeof(DropTarget).TestAccessor(); + dynamic accessor = typeof(Control).TestAccessor.Dynamic; + var dropTargetAccessor = typeof(DropTarget).TestAccessor; IComDataObject inData = accessor.CreateRuntimeDataObjectForDrag(data); inData.Should().BeAssignableTo(); @@ -36,8 +36,8 @@ public void DataObject_CustomIDataObject_MockRoundTrip() public void DataObject_ComTypesIDataObject_MockRoundTrip() { CustomComTypesDataObject data = new(); - dynamic accessor = typeof(Control).TestAccessor().Dynamic; - var dropTargetAccessor = typeof(DropTarget).TestAccessor(); + dynamic accessor = typeof(Control).TestAccessor.Dynamic; + var dropTargetAccessor = typeof(DropTarget).TestAccessor; DataObject inData = accessor.CreateRuntimeDataObjectForDrag(data); inData.Should().NotBeSameAs(data); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataObjectTests.cs index 3321c4bbf50..e9aed7a0e57 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/DataObjectTests.cs @@ -2782,8 +2782,8 @@ public static IEnumerable DataObjectMockRoundTripData() [MemberData(nameof(DataObjectMockRoundTripData))] public unsafe void MockRoundTrip_OutData_IsSame(object data) { - dynamic controlAccessor = typeof(Control).TestAccessor().Dynamic; - var dropTargetAccessor = typeof(DropTarget).TestAccessor(); + dynamic controlAccessor = typeof(Control).TestAccessor.Dynamic; + var dropTargetAccessor = typeof(DropTarget).TestAccessor; DataObject inData = controlAccessor.CreateRuntimeDataObjectForDrag(data); if (data is CustomDataObject) @@ -2818,8 +2818,8 @@ public static IEnumerable DataObjectWithJsonMockRoundTripData() [MemberData(nameof(DataObjectWithJsonMockRoundTripData))] public unsafe void WithJson_MockRoundTrip_OutData_IsSame(DataObject data) { - dynamic controlAccessor = typeof(Control).TestAccessor().Dynamic; - var dropTargetAccessor = typeof(DropTarget).TestAccessor(); + dynamic controlAccessor = typeof(Control).TestAccessor.Dynamic; + var dropTargetAccessor = typeof(DropTarget).TestAccessor; Point point = new() { X = 1, Y = 1 }; data.SetDataAsJson("point", point); @@ -2839,8 +2839,8 @@ public unsafe void WithJson_MockRoundTrip_OutData_IsSame(DataObject data) public unsafe void StringData_MockRoundTrip_IsWrapped() { string testString = "Test"; - dynamic accessor = typeof(Control).TestAccessor().Dynamic; - var dropTargetAccessor = typeof(DropTarget).TestAccessor(); + dynamic accessor = typeof(Control).TestAccessor.Dynamic; + var dropTargetAccessor = typeof(DropTarget).TestAccessor; DataObject inData = accessor.CreateRuntimeDataObjectForDrag(testString); inData.Should().BeAssignableTo(); @@ -2855,8 +2855,8 @@ public unsafe void StringData_MockRoundTrip_IsWrapped() public unsafe void IMockRoundTrip_IsWrapped() { CustomIDataObject data = new(); - dynamic accessor = typeof(Control).TestAccessor().Dynamic; - var dropTargetAccessor = typeof(DropTarget).TestAccessor(); + dynamic accessor = typeof(Control).TestAccessor.Dynamic; + var dropTargetAccessor = typeof(DropTarget).TestAccessor; DataObject inData = accessor.CreateRuntimeDataObjectForDrag(data); inData.Should().BeAssignableTo(); @@ -2871,8 +2871,8 @@ public unsafe void IMockRoundTrip_IsWrapped() public unsafe void ComTypesIMockRoundTrip_IsWrapped() { CustomComTypesDataObject data = new(); - dynamic accessor = typeof(Control).TestAccessor().Dynamic; - var dropTargetAccessor = typeof(DropTarget).TestAccessor(); + dynamic accessor = typeof(Control).TestAccessor.Dynamic; + var dropTargetAccessor = typeof(DropTarget).TestAccessor; DataObject inData = accessor.CreateRuntimeDataObjectForDrag(data); inData.Should().NotBeSameAs(data); @@ -3109,7 +3109,7 @@ public void SetDataAsJson_CustomFormat_IsJsonSerialized(string format) { DataObject data = new(); data.SetDataAsJson(format, 1); - object storedData = data.TestAccessor().Dynamic._innerData.GetData(format); + object storedData = data.TestAccessor.Dynamic._innerData.GetData(format); storedData.Should().BeAssignableTo(); data.GetData(format).Should().Be(1); data.TryGetData(format, out int deserialized).Should().BeTrue(); @@ -3123,7 +3123,7 @@ public void SetDataAsJson_NonRestrictedFormat_JsonSerialized(string format) DataObject data = new(); SimpleTestData testData = new() { X = 1, Y = 1 }; data.SetDataAsJson(format, testData); - object storedData = data.TestAccessor().Dynamic._innerData.GetData(format); + object storedData = data.TestAccessor.Dynamic._innerData.GetData(format); storedData.Should().BeOfType>(); // We don't expose JsonData in public legacy API diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/FileDialogTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/FileDialogTests.cs index 0e963fda0a3..1912a2daee9 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/FileDialogTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/FileDialogTests.cs @@ -794,7 +794,7 @@ public void FileDialog_ToString_Invoke_ReturnsExpected(FileDialog dialog, string public void FileDialog_GetMultiselectFiles_ReturnsExpected() { // Test with directory - var accessor = typeof(FileDialog).TestAccessor(); + var accessor = typeof(FileDialog).TestAccessor; string buffer = "C:\\test\0testfile.txt\0testfile2.txt\0"; string[] expected = ["C:\\test\\testfile.txt", "C:\\test\\testfile2.txt"]; string[] result = accessor.CreateDelegate()(buffer); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/GroupBoxTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/GroupBoxTests.cs index a93c10dc92a..89012a3a518 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/GroupBoxTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/GroupBoxTests.cs @@ -607,7 +607,7 @@ public void GroupBox_FontPropertyChange_UpdatesFontHeightAndCachedFont() groupBox.Font = newFont; Rectangle result = groupBox.DisplayRectangle; - var accessor = groupBox.TestAccessor(); + var accessor = groupBox.TestAccessor; int updatedFontHeight = accessor.Dynamic._fontHeight; Font updatedCachedFont = accessor.Dynamic._cachedFont; diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/LabelTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/LabelTests.cs index 9752c4b0b18..931fbac3c55 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/LabelTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/LabelTests.cs @@ -228,7 +228,7 @@ public void Label_Invokes_SetToolTip_IfExternalToolTipIsSet() using ToolTip toolTip = new(); label.CreateControl(); - dynamic labelDynamic = label.TestAccessor().Dynamic; + dynamic labelDynamic = label.TestAccessor.Dynamic; bool actual = labelDynamic._controlToolTip; Assert.False(actual); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/LayoutEventArgsTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/LayoutEventArgsTests.cs index 1dd6789dc63..ea42be9f9c1 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/LayoutEventArgsTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/LayoutEventArgsTests.cs @@ -80,7 +80,7 @@ static LayoutEventArgs CreateAndDisposeControl() } // Check the cachedLayoutEventArgs - ITestAccessor tableLayoutPanelTestAccessor = tableLayoutPanel.TestAccessor(); + ITestAccessor tableLayoutPanelTestAccessor = tableLayoutPanel.TestAccessor; LayoutEventArgs layoutEventArgs = (LayoutEventArgs)tableLayoutPanelTestAccessor.Dynamic._cachedLayoutEventArgs; tableLayoutPanel.ResumeLayout(); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/LinkLabel.LinkComparerTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/LinkLabel.LinkComparerTests.cs index 6ae962c4451..04a4f1487a4 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/LinkLabel.LinkComparerTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/LinkLabel.LinkComparerTests.cs @@ -21,7 +21,7 @@ public static IEnumerable LinkCompare_Return_IsExpected_TestData() public void LinkCompare_Return_IsExpected(object link1, object link2, int expectedValue) { using LinkLabel linkLabel = new(); - var comparer = linkLabel.TestAccessor().Dynamic.s_linkComparer; + var comparer = linkLabel.TestAccessor.Dynamic.s_linkComparer; var compareMethod = comparer.GetType().GetMethod("Compare"); Assert.Equal(expectedValue, compareMethod.Invoke(comparer, (object[])[link1, link2])); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ListBoxTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ListBoxTests.cs index 361aa31226f..1ad48b85b77 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ListBoxTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ListBoxTests.cs @@ -6360,7 +6360,7 @@ public void ListBox_PreferredHeight_RecreatingHandle_ReturnsCurrentHeight() }; // Use TestAccessor to call the private RecreateHandle method - listBox.TestAccessor().Dynamic.RecreateHandle(); + listBox.TestAccessor.Dynamic.RecreateHandle(); int totalItemHeight = 0; for (int i = 0; i < listBox.Items.Count; i++) @@ -6384,7 +6384,7 @@ public void ListBox_PreferredHeight_CreatingHandle_ReturnsCurrentHeight() }; // Use TestAccessor to call the private SetState method and set the state to 'true' - listBox.TestAccessor().Dynamic.SetState(1, true); + listBox.TestAccessor.Dynamic.SetState(1, true); int totalItemHeight = 0; for (int i = 0; i < listBox.Items.Count; i++) diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ListView.IconComparerTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ListView.IconComparerTests.cs index cc6a4ef16dc..6ab47cc38a3 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ListView.IconComparerTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ListView.IconComparerTests.cs @@ -13,7 +13,7 @@ public void Constructor_SetsSortOrder_Correctly(SortOrder order) { ListView.IconComparer comparer = new(order); - ((SortOrder)comparer.TestAccessor().Dynamic._sortOrder).Should().Be(order); + ((SortOrder)comparer.TestAccessor.Dynamic._sortOrder).Should().Be(order); } [WinFormsTheory] @@ -27,7 +27,7 @@ public void SortOrder_Setter_UpdatesSortOrder(SortOrder initialOrder, SortOrder SortOrder = updatedOrder }; - ((SortOrder)comparer.TestAccessor().Dynamic._sortOrder).Should().Be(updatedOrder); + ((SortOrder)comparer.TestAccessor.Dynamic._sortOrder).Should().Be(updatedOrder); } [WinFormsTheory] diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ListViewGroupTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ListViewGroupTests.cs index 110e6d3d854..405500ec702 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ListViewGroupTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ListViewGroupTests.cs @@ -1431,7 +1431,7 @@ public void ListViewGroup_InvokeAdd_DoesNotAddTreeViewItemToList() ListViewItem listViewItem = new(); ListViewItem listViewItemGroup = new(); ListViewGroup listViewGroup = new(); - var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor(); + var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor; listView.Groups.Add(listViewGroup); listView.Items.Add(listViewItem); listViewGroup.Items.Add(listViewItemGroup); @@ -1446,7 +1446,7 @@ public void ListViewGroup_InvokeRemove_DoesNotRemoveTreeViewItemFromList() using ListView listView = new(); ListViewItem listViewItem = new(); ListViewGroup listViewGroup = new(); - var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor(); + var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor; listView.Groups.Add(listViewGroup); listView.Items.Add(listViewItem); listViewGroup.Items.Add(listViewItem); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ListViewItemStateImageIndexConverterTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ListViewItemStateImageIndexConverterTests.cs index 402a39575e4..19ceb57d490 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ListViewItemStateImageIndexConverterTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ListViewItemStateImageIndexConverterTests.cs @@ -13,7 +13,7 @@ public class ListViewItemStateImageIndexConverterTests [Fact] public void ListViewItemStateImageIndexConverter_IncludeNoneAsStandardValue_ReturnsFalse() { - Assert.False(new ListViewItemStateImageIndexConverter().TestAccessor().Dynamic.IncludeNoneAsStandardValue); + Assert.False(new ListViewItemStateImageIndexConverter().TestAccessor.Dynamic.IncludeNoneAsStandardValue); } [Fact] diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ListViewTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ListViewTests.cs index f99fdf7ace2..adad3bdfe51 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ListViewTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ListViewTests.cs @@ -4869,7 +4869,7 @@ public void ListView_InvokeAdd_AddListViewItemToTrackList(bool showItemToolTips) ListViewItem listViewItem = new(); listView.Items.Add(listViewItem); - Assert.True((bool)KeyboardToolTipStateMachine.Instance.TestAccessor().Dynamic.IsToolTracked(listViewItem)); + Assert.True((bool)KeyboardToolTipStateMachine.Instance.TestAccessor.Dynamic.IsToolTracked(listViewItem)); } [WinFormsTheory] @@ -4882,7 +4882,7 @@ public void ListView_InvokeAddRange_AddlistViewItemsToTrackList(bool showItemToo ListViewItem listViewItem1 = new(); ListViewItem listViewItem2 = new(); ListViewItem listViewItem3 = new(); - var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor(); + var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor; listView.Items.AddRange((ListViewItem[])[listViewItem1, listViewItem2, listViewItem3]); @@ -4901,7 +4901,7 @@ public void ListView_InvokeInsert_AddlistViewItemToTrackList(bool showItemToolTi ListViewItem listViewItem = new(); listView.Items.Insert(0, listViewItem); - Assert.True((bool)KeyboardToolTipStateMachine.Instance.TestAccessor().Dynamic.IsToolTracked(listViewItem)); + Assert.True((bool)KeyboardToolTipStateMachine.Instance.TestAccessor.Dynamic.IsToolTracked(listViewItem)); } [WinFormsTheory] @@ -4912,7 +4912,7 @@ public void ListView_InvokeRemove_RemoveListViewItemFromTrackList(bool showItemT using ListView listView = new(); listView.ShowItemToolTips = showItemToolTips; ListViewItem listViewItem = new(); - var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor(); + var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor; listView.Items.Add(listViewItem); Assert.True(accessor.IsToolTracked(listViewItem)); @@ -4929,7 +4929,7 @@ public void ListView_InvokeDispose_RemoveListViewItemFromTrackList(bool showItem using ListView listView = new(); listView.ShowItemToolTips = showItemToolTips; ListViewItem listViewItem = new(); - var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor(); + var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor; listView.Items.Add(listViewItem); Assert.True(accessor.Dynamic.IsToolTracked(listViewItem)); @@ -4943,8 +4943,8 @@ public void ListView_NormalMode_InvokeNotifyAboutGotFocus_DoesNotAddListViewItem { using ListView listView = new(); ListViewItem listViewItem = new(); - listView.TestAccessor().Dynamic.NotifyAboutGotFocus(listViewItem); - Assert.False((bool)KeyboardToolTipStateMachine.Instance.TestAccessor().Dynamic.IsToolTracked(listViewItem)); + listView.TestAccessor.Dynamic.NotifyAboutGotFocus(listViewItem); + Assert.False((bool)KeyboardToolTipStateMachine.Instance.TestAccessor.Dynamic.IsToolTracked(listViewItem)); } [WinFormsFact] @@ -4952,8 +4952,8 @@ public void ListView_VirtualMode_InvokeNotifyAboutGotFocus_AddListViewItemToTrac { using ListView listView = new() { VirtualMode = true }; ListViewItem listViewItem = new(); - listView.TestAccessor().Dynamic.NotifyAboutGotFocus(listViewItem); - Assert.True((bool)KeyboardToolTipStateMachine.Instance.TestAccessor().Dynamic.IsToolTracked(listViewItem)); + listView.TestAccessor.Dynamic.NotifyAboutGotFocus(listViewItem); + Assert.True((bool)KeyboardToolTipStateMachine.Instance.TestAccessor.Dynamic.IsToolTracked(listViewItem)); } [WinFormsFact] @@ -4961,12 +4961,12 @@ public void ListView_NormalMode_InvokeNotifyAboutLostFocus_DoesNotRemoveListView { using ListView listView = new(); ListViewItem listViewItem = new(); - var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor(); + var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor; listView.Items.Add(listViewItem); Assert.True(accessor.IsToolTracked(listViewItem)); - listView.TestAccessor().Dynamic.NotifyAboutLostFocus(listViewItem); + listView.TestAccessor.Dynamic.NotifyAboutLostFocus(listViewItem); Assert.True(accessor.IsToolTracked(listViewItem)); } @@ -4975,12 +4975,12 @@ public void ListView_VirtualMode_InvokeNotifyAboutLostFocus_RemoveListViewItemFr { using ListView listView = new() { VirtualMode = true }; ListViewItem listViewItem = new(); - var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor(); + var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor; - listView.TestAccessor().Dynamic.NotifyAboutGotFocus(listViewItem); + listView.TestAccessor.Dynamic.NotifyAboutGotFocus(listViewItem); Assert.True(accessor.IsToolTracked(listViewItem)); - listView.TestAccessor().Dynamic.NotifyAboutLostFocus(listViewItem); + listView.TestAccessor.Dynamic.NotifyAboutLostFocus(listViewItem); Assert.False(accessor.IsToolTracked(listViewItem)); } @@ -5119,7 +5119,7 @@ public void ListView_Invokes_SetToolTip_IfExternalToolTipIsSet() using ToolTip toolTip = new(); listView.CreateControl(); - dynamic listViewDynamic = listView.TestAccessor().Dynamic; + dynamic listViewDynamic = listView.TestAccessor.Dynamic; string actual = listViewDynamic._toolTipCaption; Assert.Empty(actual); @@ -5152,7 +5152,7 @@ public void ListView_AnnounceColumnHeader_DoesNotWork_WithoutHandle(View view) listView.Items.Add(new ListViewItem("Test")); SubListViewAccessibleObject accessibleObject = new(listView); - int accessibilityProperty = listView.TestAccessor().Dynamic.s_accessibilityProperty; + int accessibilityProperty = listView.TestAccessor.Dynamic.s_accessibilityProperty; listView.Properties.AddValue(accessibilityProperty, accessibleObject); listView.AnnounceColumnHeader(new Point(15, 40)); Assert.Equal(0, accessibleObject.RaiseAutomationNotificationCallCount); @@ -5177,7 +5177,7 @@ public void ListView_AnnounceColumnHeader_DoesNotWork_WithoutHeader(View view) listView.Items.Add(new ListViewItem("Test")); SubListViewAccessibleObject accessibleObject = new(listView); - int accessibilityProperty = listView.TestAccessor().Dynamic.s_accessibilityProperty; + int accessibilityProperty = listView.TestAccessor.Dynamic.s_accessibilityProperty; listView.Properties.AddValue(accessibilityProperty, accessibleObject); listView.AnnounceColumnHeader(new Point(15, 40)); Assert.Equal(0, accessibleObject.RaiseAutomationNotificationCallCount); @@ -5202,7 +5202,7 @@ public void ListView_AnnounceColumnHeader_DoesNotWork_InvalidPoint(View view) listView.Items.Add(new ListViewItem("Test")); SubListViewAccessibleObject accessibleObject = new(listView); - int accessibilityProperty = listView.TestAccessor().Dynamic.s_accessibilityProperty; + int accessibilityProperty = listView.TestAccessor.Dynamic.s_accessibilityProperty; listView.Properties.AddValue(accessibilityProperty, accessibleObject); listView.AnnounceColumnHeader(new Point(10, 20)); Assert.Equal(0, accessibleObject.RaiseAutomationNotificationCallCount); @@ -5229,7 +5229,7 @@ public void ListView_AnnounceColumnHeader_WorksCorrectly(int x, int y, string ex listView.Items.Add(new ListViewItem("Test")); SubListViewAccessibleObject accessibleObject = new(listView); - int accessibilityProperty = listView.TestAccessor().Dynamic.s_accessibilityProperty; + int accessibilityProperty = listView.TestAccessor.Dynamic.s_accessibilityProperty; listView.Properties.AddValue(accessibilityProperty, accessibleObject); listView.AnnounceColumnHeader(new Point(x, y)); @@ -5350,7 +5350,7 @@ public void ListView_OnSelectedIndexChanged_DoesNotInvoke_RaiseAutomationEvent_S Assert.NotNull(listViewItem.AccessibilityObject); SubListViewItemAccessibleObject accessibleObject = new(listViewItem); - listViewItem.TestAccessor().Dynamic._accessibilityObject = accessibleObject; + listViewItem.TestAccessor.Dynamic._accessibilityObject = accessibleObject; listView.CreateControl(); listViewItem.Focused = true; listViewItem.Selected = true; @@ -5403,7 +5403,7 @@ public void ListView_OnGroupCollapsedStateChanged_InvokeRaiseAutomationEvent_AsE { using SubListView listView = GetSubListViewWithData(view, virtualMode, showGroups, withinGroup, createControl); SubListViewAccessibleObject accessibleObject = new(listView); - int accessibilityProperty = listView.TestAccessor().Dynamic.s_accessibilityProperty; + int accessibilityProperty = listView.TestAccessor.Dynamic.s_accessibilityProperty; listView.Properties.AddValue(accessibilityProperty, accessibleObject); listView.OnGroupCollapsedStateChanged(new ListViewGroupEventArgs(groupId)); @@ -5453,7 +5453,7 @@ public void ListView_OnMouseClick_EditLabel_AsExpected(int subItemIndex, bool is PInvokeCore.SendMessage(listView, PInvokeCore.WM_LBUTTONDOWN, 1, PARAM.FromPoint(subItemLocation)); // Start editing immediately (if it was queued). - PInvokeCore.SendMessage(listView, PInvokeCore.WM_TIMER, (WPARAM)(nint)listView.TestAccessor().Dynamic.LVLABELEDITTIMER); + PInvokeCore.SendMessage(listView, PInvokeCore.WM_TIMER, (WPARAM)(nint)listView.TestAccessor.Dynamic.LVLABELEDITTIMER); nint editControlHandle = PInvokeCore.SendMessage(listView, PInvoke.LVM_GETEDITCONTROL); @@ -5863,7 +5863,7 @@ public void ListView_ReleaseUiaProvider_DoesNotForceDefaultGroupCreation() listView.ReleaseUiaProvider(listView.HWND); - Assert.Null(listView.TestAccessor().Dynamic._defaultGroup); + Assert.Null(listView.TestAccessor.Dynamic._defaultGroup); Assert.True(listView.IsHandleCreated); } @@ -5995,7 +5995,7 @@ public void ListView_ColumnClick_AddRemoveHandlers_ShouldCorrectlyInvokeOrNotInv // Add first handler and simulate the column click event listView.ColumnClick += firstHandler; ColumnClickEventArgs args = new(1); - listView.TestAccessor().Dynamic.OnColumnClick(args); + listView.TestAccessor.Dynamic.OnColumnClick(args); firstHandlerInvokeCount.Should().Be(1); secondHandlerInvokeCount.Should().Be(0); @@ -6004,14 +6004,14 @@ public void ListView_ColumnClick_AddRemoveHandlers_ShouldCorrectlyInvokeOrNotInv // Add second handler and simulate the event again listView.ColumnClick += secondHandler; - listView.TestAccessor().Dynamic.OnColumnClick(args); + listView.TestAccessor.Dynamic.OnColumnClick(args); firstHandlerInvokeCount.Should().Be(2); // First handler called again secondHandlerInvokeCount.Should().Be(1); // Second handler called for the first time // Remove first handler and simulate the event again listView.ColumnClick -= firstHandler; - listView.TestAccessor().Dynamic.OnColumnClick(args); + listView.TestAccessor.Dynamic.OnColumnClick(args); // First handler should not be called again, second handler should be called again firstHandlerInvokeCount.Should().Be(2); @@ -6038,7 +6038,7 @@ public void ListView_GroupTaskLinkClick_EventHandling_ShouldBehaveAsExpected() // Test adding and invoking first handler. listView.GroupTaskLinkClick += handler1; ListViewGroupEventArgs expectedEventArgs = new(1); - listView.TestAccessor().Dynamic.OnGroupTaskLinkClick(expectedEventArgs); + listView.TestAccessor.Dynamic.OnGroupTaskLinkClick(expectedEventArgs); callCount.Should().Be(1); eventSender.Should().Be(listView); @@ -6046,21 +6046,21 @@ public void ListView_GroupTaskLinkClick_EventHandling_ShouldBehaveAsExpected() // Test adding and invoking both handlers. listView.GroupTaskLinkClick += handler2; - listView.TestAccessor().Dynamic.OnGroupTaskLinkClick(new ListViewGroupEventArgs(2)); + listView.TestAccessor.Dynamic.OnGroupTaskLinkClick(new ListViewGroupEventArgs(2)); // Expect callCount to be 3 because both handlers should be called. callCount.Should().Be(3); // Test removing first handler and invoking. listView.GroupTaskLinkClick -= handler1; - listView.TestAccessor().Dynamic.OnGroupTaskLinkClick(new ListViewGroupEventArgs(3)); + listView.TestAccessor.Dynamic.OnGroupTaskLinkClick(new ListViewGroupEventArgs(3)); // Expect callCount to be 4 because only second handler should be called. callCount.Should().Be(4); // Test removing second handler and ensuring no invocation. listView.GroupTaskLinkClick -= handler2; - listView.TestAccessor().Dynamic.OnGroupTaskLinkClick(new ListViewGroupEventArgs(4)); + listView.TestAccessor.Dynamic.OnGroupTaskLinkClick(new ListViewGroupEventArgs(4)); // Expect callCount to remain 4 because no handlers should be called. callCount.Should().Be(4); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/MdiControlStripTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/MdiControlStripTests.cs index 80add57b722..d0a181c40a0 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/MdiControlStripTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/MdiControlStripTests.cs @@ -161,10 +161,10 @@ public void MdiControlStrip_Ctor_VerifyMenuItemsInRightOrder() Assert.Equal(4, mdiControlStrip.Items.Count); - ToolStripMenuItem system = mdiControlStrip.TestAccessor().Dynamic._system; - ToolStripMenuItem close = mdiControlStrip.TestAccessor().Dynamic._close; - ToolStripMenuItem minimize = mdiControlStrip.TestAccessor().Dynamic._minimize; - ToolStripMenuItem restore = mdiControlStrip.TestAccessor().Dynamic._restore; + ToolStripMenuItem system = mdiControlStrip.TestAccessor.Dynamic._system; + ToolStripMenuItem close = mdiControlStrip.TestAccessor.Dynamic._close; + ToolStripMenuItem minimize = mdiControlStrip.TestAccessor.Dynamic._minimize; + ToolStripMenuItem restore = mdiControlStrip.TestAccessor.Dynamic._restore; Assert.Equal(minimize, mdiControlStrip.Items[0]); Assert.Equal(restore, mdiControlStrip.Items[1]); Assert.Equal(close, mdiControlStrip.Items[2]); @@ -179,10 +179,10 @@ public void MdiControlStrip_Ctor_VerifyMenuItemsHaveImages() ToolStripMenuItem[] items = [ - mdiControlStrip.TestAccessor().Dynamic._system, - mdiControlStrip.TestAccessor().Dynamic._close, - mdiControlStrip.TestAccessor().Dynamic._minimize, - mdiControlStrip.TestAccessor().Dynamic._restore + mdiControlStrip.TestAccessor.Dynamic._system, + mdiControlStrip.TestAccessor.Dynamic._close, + mdiControlStrip.TestAccessor.Dynamic._minimize, + mdiControlStrip.TestAccessor.Dynamic._restore ]; foreach (ToolStripMenuItem item in items) @@ -217,7 +217,7 @@ public void MdiControlStrip_MaximizedChildWindow_NextSibling_ReturnsControlBoxBu mdiParent.Show(); mdiChild.Show(); AccessibleObject accessibleObject = mdiParent.MainMenuStrip.AccessibilityObject; - ToolStripItem.ToolStripItemAccessibleObject systemItem = (ToolStripItem.ToolStripItemAccessibleObject)accessibleObject.TestAccessor().Dynamic.FragmentNavigate(NavigateDirection.NavigateDirection_FirstChild); + ToolStripItem.ToolStripItemAccessibleObject systemItem = (ToolStripItem.ToolStripItemAccessibleObject)accessibleObject.TestAccessor.Dynamic.FragmentNavigate(NavigateDirection.NavigateDirection_FirstChild); ToolStripItem.ToolStripItemAccessibleObject test1Item = (ToolStripItem.ToolStripItemAccessibleObject)systemItem.FragmentNavigate(NavigateDirection.NavigateDirection_NextSibling); ToolStripItem.ToolStripItemAccessibleObject test2Item = (ToolStripItem.ToolStripItemAccessibleObject)test1Item.FragmentNavigate(NavigateDirection.NavigateDirection_NextSibling); ToolStripItem.ToolStripItemAccessibleObject minimizeItem = (ToolStripItem.ToolStripItemAccessibleObject)test2Item.FragmentNavigate(NavigateDirection.NavigateDirection_NextSibling); @@ -263,7 +263,7 @@ public void MdiControlStrip_MaximizedChildWindow_PreviousSibling_ReturnsControlB mdiParent.Show(); mdiChild.Show(); AccessibleObject accessibleObject = mdiParent.MainMenuStrip.AccessibilityObject; - ToolStripItem.ToolStripItemAccessibleObject closeItem = (ToolStripItem.ToolStripItemAccessibleObject)accessibleObject.TestAccessor().Dynamic.FragmentNavigate(NavigateDirection.NavigateDirection_LastChild); + ToolStripItem.ToolStripItemAccessibleObject closeItem = (ToolStripItem.ToolStripItemAccessibleObject)accessibleObject.TestAccessor.Dynamic.FragmentNavigate(NavigateDirection.NavigateDirection_LastChild); ToolStripItem.ToolStripItemAccessibleObject restoreItem = (ToolStripItem.ToolStripItemAccessibleObject)closeItem.FragmentNavigate(NavigateDirection.NavigateDirection_PreviousSibling); ToolStripItem.ToolStripItemAccessibleObject minimizeItem = (ToolStripItem.ToolStripItemAccessibleObject)restoreItem.FragmentNavigate(NavigateDirection.NavigateDirection_PreviousSibling); ToolStripItem.ToolStripItemAccessibleObject test2Item = (ToolStripItem.ToolStripItemAccessibleObject)minimizeItem.FragmentNavigate(NavigateDirection.NavigateDirection_PreviousSibling); @@ -325,7 +325,7 @@ public void MdiControlStrip_MaximizedChildWindow_RecreatesOnSizeChanged() mdiChild.Show(); mdiChild.WindowState = FormWindowState.Maximized; - MdiControlStrip originalMdiControlStrip = mdiParent.TestAccessor().Dynamic.MdiControlStrip; + MdiControlStrip originalMdiControlStrip = mdiParent.TestAccessor.Dynamic.MdiControlStrip; // Force size change with large icon HICON hicon = (HICON)new Bitmap(256, 256).GetHicon(); @@ -333,7 +333,7 @@ public void MdiControlStrip_MaximizedChildWindow_RecreatesOnSizeChanged() PInvokeCore.DestroyIcon(hicon); mdiChild.Icon = largeIcon; - MdiControlStrip currentMdiControlStrip = mdiParent.TestAccessor().Dynamic.MdiControlStrip; + MdiControlStrip currentMdiControlStrip = mdiParent.TestAccessor.Dynamic.MdiControlStrip; Assert.NotEqual(originalMdiControlStrip, currentMdiControlStrip); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/MessageBoxTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/MessageBoxTests.cs index bb24825a20c..e57b22cfc5f 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/MessageBoxTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/MessageBoxTests.cs @@ -147,7 +147,7 @@ private static MESSAGEBOX_STYLE GetMessageBoxStyle( { try { - return typeof(MessageBox).TestAccessor().Dynamic.GetMessageBoxStyle(owner, buttons, icon, defaultButton, options, showHelp); + return typeof(MessageBox).TestAccessor.Dynamic.GetMessageBoxStyle(owner, buttons, icon, defaultButton, options, showHelp); } catch (TargetInvocationException ex) { diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/MonthCalendarTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/MonthCalendarTests.cs index 8c3475f2c9c..58e748d2f3c 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/MonthCalendarTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/MonthCalendarTests.cs @@ -4193,14 +4193,14 @@ public unsafe void MonthCalendar_FillMonthDayStates_ReturnsExpected(DateTime cur calendar.CreateControl(); // Set a visible range (08/29/2021 - 09/10/2022) to have a stable test case calendar.SetSelectionRange(new DateTime(2021, 9, 1), new DateTime(2022, 8, 31)); - MONTH_CALDENDAR_MESSAGES_VIEW view = calendar.TestAccessor().Dynamic._mcCurView; + MONTH_CALDENDAR_MESSAGES_VIEW view = calendar.TestAccessor.Dynamic._mcCurView; SelectionRange displayRange = calendar.GetDisplayRange(visible: false); Assert.Equal(MONTH_CALDENDAR_MESSAGES_VIEW.MCMV_MONTH, view); Assert.Equal(new DateTime(2021, 8, 29), displayRange.Start); Assert.Equal(new DateTime(2022, 9, 10), displayRange.End); - int monthsCount = calendar.TestAccessor().Dynamic.GetMonthsCountOfRange(displayRange); + int monthsCount = calendar.TestAccessor.Dynamic.GetMonthsCountOfRange(displayRange); int currentMonthIndex = (currentDate.Year - displayRange.Start.Year) * MonthsInYear + currentDate.Month - displayRange.Start.Month; calendar.AddBoldedDate(currentDate); Span boldedDates = stackalloc uint[monthsCount]; @@ -4239,7 +4239,7 @@ public unsafe void MonthCalendar_GetIndexInMonths_ReturnsExpected(DateTime curre { DateTime startDate = new(2021, 8, 1); using MonthCalendar calendar = new(); - int actualIndex = calendar.TestAccessor().Dynamic.GetIndexInMonths(startDate, currentDate); + int actualIndex = calendar.TestAccessor.Dynamic.GetIndexInMonths(startDate, currentDate); Assert.Equal(expectedIndex, actualIndex); } @@ -4385,7 +4385,7 @@ public void CalendarCellAccessibleObject_Select_SetsSelectionRange() DateTime startDate = new(2022, 10, 1); DateTime endDate = new(2022, 10, 7); - cellAccessibleObject.TestAccessor().Dynamic._dateRange = new SelectionRange(startDate, endDate); + cellAccessibleObject.TestAccessor.Dynamic._dateRange = new SelectionRange(startDate, endDate); cellAccessibleObject.Select(AccessibleSelection.TakeSelection); @@ -4513,15 +4513,15 @@ public void MonthCalendar_ShouldSerializeProperties_ReturnsExpected() using MonthCalendar calendar = new(); calendar.MaxDate = DateTime.MaxValue; - ShouldSerializeProperty(() => calendar.TestAccessor().Dynamic.ShouldSerializeTodayDate(), () => calendar.TodayDate = DateTime.Now); - ShouldSerializeProperty(() => calendar.TestAccessor().Dynamic.ShouldSerializeAnnuallyBoldedDates(), () => calendar.AddAnnuallyBoldedDate(DateTime.Now)); - ShouldSerializeProperty(() => calendar.TestAccessor().Dynamic.ShouldSerializeBoldedDates(), () => calendar.AddBoldedDate(DateTime.Now)); - ShouldSerializeProperty(() => calendar.TestAccessor().Dynamic.ShouldSerializeMonthlyBoldedDates(), () => calendar.AddMonthlyBoldedDate(DateTime.Now)); - ShouldSerializeProperty(() => calendar.TestAccessor().Dynamic.ShouldSerializeMaxDate(), () => calendar.MaxDate = DateTime.Now.AddYears(2)); - ShouldSerializeProperty(() => calendar.TestAccessor().Dynamic.ShouldSerializeMinDate(), () => calendar.MinDate = DateTime.Now); - ShouldSerializeProperty(() => calendar.TestAccessor().Dynamic.ShouldSerializeTrailingForeColor(), () => calendar.TrailingForeColor = Color.Red); - ShouldSerializeProperty(() => calendar.TestAccessor().Dynamic.ShouldSerializeTitleForeColor(), () => calendar.TitleForeColor = Color.Red); - ShouldSerializeProperty(() => calendar.TestAccessor().Dynamic.ShouldSerializeTitleBackColor(), () => calendar.TitleBackColor = Color.Red); + ShouldSerializeProperty(() => calendar.TestAccessor.Dynamic.ShouldSerializeTodayDate(), () => calendar.TodayDate = DateTime.Now); + ShouldSerializeProperty(() => calendar.TestAccessor.Dynamic.ShouldSerializeAnnuallyBoldedDates(), () => calendar.AddAnnuallyBoldedDate(DateTime.Now)); + ShouldSerializeProperty(() => calendar.TestAccessor.Dynamic.ShouldSerializeBoldedDates(), () => calendar.AddBoldedDate(DateTime.Now)); + ShouldSerializeProperty(() => calendar.TestAccessor.Dynamic.ShouldSerializeMonthlyBoldedDates(), () => calendar.AddMonthlyBoldedDate(DateTime.Now)); + ShouldSerializeProperty(() => calendar.TestAccessor.Dynamic.ShouldSerializeMaxDate(), () => calendar.MaxDate = DateTime.Now.AddYears(2)); + ShouldSerializeProperty(() => calendar.TestAccessor.Dynamic.ShouldSerializeMinDate(), () => calendar.MinDate = DateTime.Now); + ShouldSerializeProperty(() => calendar.TestAccessor.Dynamic.ShouldSerializeTrailingForeColor(), () => calendar.TrailingForeColor = Color.Red); + ShouldSerializeProperty(() => calendar.TestAccessor.Dynamic.ShouldSerializeTitleForeColor(), () => calendar.TitleForeColor = Color.Red); + ShouldSerializeProperty(() => calendar.TestAccessor.Dynamic.ShouldSerializeTitleBackColor(), () => calendar.TitleBackColor = Color.Red); } private void ShouldSerializeProperty(Func shouldSerializeFunc, Action setPropertyAction) @@ -4548,7 +4548,7 @@ public void MonthCalendar_ResetTodayDate_InvokeWithSetTodayDate_ReturnsExpected( } DateTime todayDateBeforeReset = calendar.TodayDate; - calendar.TestAccessor().Dynamic.ResetTodayDate(); + calendar.TestAccessor.Dynamic.ResetTodayDate(); DateTime todayDateAfterReset = calendar.TodayDate; todayDateBeforeReset.Should().NotBe(todayDateAfterReset); @@ -4567,7 +4567,7 @@ public void MonthCalendar_ResetTodayDate_InvokeWithoutSetTodayDate_ReturnsExpect } DateTime todayDateBeforeReset = calendar.TodayDate; - calendar.TestAccessor().Dynamic.ResetTodayDate(); + calendar.TestAccessor.Dynamic.ResetTodayDate(); DateTime todayDateAfterReset = calendar.TodayDate; todayDateBeforeReset.Should().Be(todayDateAfterReset); @@ -4576,7 +4576,7 @@ public void MonthCalendar_ResetTodayDate_InvokeWithoutSetTodayDate_ReturnsExpect private void TestResetColorProperty(Func getColor, Action setColor, Action resetColor) { using MonthCalendar calendar = new(); - var testAccessor = calendar.TestAccessor(); + var testAccessor = calendar.TestAccessor; Color originalColor = getColor(calendar); @@ -4627,7 +4627,7 @@ private void TestResetProperty(MonthCalendar calendar, Action multiPropertyDescriptorGridEntry - .TestAccessor() + .TestAccessor .Dynamic .NotifyParentsOfChanges(multiPropertyDescriptorGridEntry); @@ -230,7 +230,7 @@ public void OwnersEqual_ComparesOwnersCorrectly() object o1 = new(); object o2 = new(); - var accessor = typeof(MultiPropertyDescriptorGridEntry).TestAccessor(); + var accessor = typeof(MultiPropertyDescriptorGridEntry).TestAccessor; bool result1 = accessor.Dynamic.OwnersEqual(o1, o1); bool result2 = accessor.Dynamic.OwnersEqual(new[] { o1, o2 }, new[] { o1, o2 }); bool result3 = accessor.Dynamic.OwnersEqual(new[] { o1 }, new[] { o2 }); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/NoneExcludedImageIndexConverterTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/NoneExcludedImageIndexConverterTests.cs index c4a30654632..15bb2f5ef15 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/NoneExcludedImageIndexConverterTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/NoneExcludedImageIndexConverterTests.cs @@ -11,6 +11,6 @@ public class NoneExcludedImageIndexConverterTests [Fact] public void NoneExcludedImageIndexConverter_IncludeNoneAsStandardValue_ReturnsFalse() { - Assert.False(new NoneExcludedImageIndexConverter().TestAccessor().Dynamic.IncludeNoneAsStandardValue); + Assert.False(new NoneExcludedImageIndexConverter().TestAccessor.Dynamic.IncludeNoneAsStandardValue); } } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/Printing/PrintPreviewControl.PrintPreviewControlAccessibilityObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/Printing/PrintPreviewControl.PrintPreviewControlAccessibilityObjectTests.cs index 9799fb1dd59..9d42867b5e4 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/Printing/PrintPreviewControl.PrintPreviewControlAccessibilityObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/Printing/PrintPreviewControl.PrintPreviewControlAccessibilityObjectTests.cs @@ -189,10 +189,10 @@ public SubPrintPreviewControl() } public new ScrollBar VerticalScrollBar - => this.TestAccessor().Dynamic._vScrollBar; + => this.TestAccessor.Dynamic._vScrollBar; public new ScrollBar HorizontalScrollBar - => this.TestAccessor().Dynamic._hScrollBar; + => this.TestAccessor.Dynamic._hScrollBar; public void MakeNoScrollBarsVisible() { diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/Printing/PrintPreviewControlTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/Printing/PrintPreviewControlTests.cs index 201f4f5fce4..ab5c1f19a24 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/Printing/PrintPreviewControlTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/Printing/PrintPreviewControlTests.cs @@ -15,12 +15,12 @@ public void ShowPrintPreviewControl_BackColorIsCorrect() { PrintPreviewControl control = new(); - int actualBackColorArgb = control.TestAccessor().Dynamic.GetBackColor(false).ToArgb(); + int actualBackColorArgb = control.TestAccessor.Dynamic.GetBackColor(false).ToArgb(); Assert.Equal(SystemColors.AppWorkspace.ToArgb(), actualBackColorArgb); control.BackColor = Color.Green; - actualBackColorArgb = control.TestAccessor().Dynamic.GetBackColor(false).ToArgb(); + actualBackColorArgb = control.TestAccessor.Dynamic.GetBackColor(false).ToArgb(); Assert.Equal(Color.Green.ToArgb(), actualBackColorArgb); } @@ -29,7 +29,7 @@ public void ShowPrintPreviewControlHighContrast_BackColorIsCorrect() { PrintPreviewControl control = new(); - int actualBackColorArgb = control.TestAccessor().Dynamic.GetBackColor(true).ToArgb(); + int actualBackColorArgb = control.TestAccessor.Dynamic.GetBackColor(true).ToArgb(); Assert.Equal(SystemColors.ControlDarkDark.ToArgb(), actualBackColorArgb); // Default AppWorkSpace color in HC theme does not allow to follow HC standards. @@ -37,7 +37,7 @@ public void ShowPrintPreviewControlHighContrast_BackColorIsCorrect() control.BackColor = Color.Green; - actualBackColorArgb = control.TestAccessor().Dynamic.GetBackColor(true).ToArgb(); + actualBackColorArgb = control.TestAccessor.Dynamic.GetBackColor(true).ToArgb(); Assert.Equal(Color.Green.ToArgb(), actualBackColorArgb); Assert.False(SystemColors.AppWorkspace.ToArgb().Equals(actualBackColorArgb)); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridCommandsTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridCommandsTests.cs index 9ff3284c7dd..997cb189ad7 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridCommandsTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridCommandsTests.cs @@ -29,7 +29,7 @@ public void PropertyGridCommand_CommandID_HasExpectedValues() public void WfcMenuGroup_HasExpectedGuid() { PropertyGridCommands propertyGridCommands = new(); - Guid tests = propertyGridCommands.TestAccessor().Dynamic.wfcMenuGroup; + Guid tests = propertyGridCommands.TestAccessor.Dynamic.wfcMenuGroup; tests.Should().Be(new Guid("a72bd644-1979-4cbc-a620-ea4112198a66")); } @@ -38,7 +38,7 @@ public void WfcMenuGroup_HasExpectedGuid() public void WfcMenuCommand_HasExpectedGuid() { PropertyGridCommands propertyGridCommands = new(); - Guid tests = propertyGridCommands.TestAccessor().Dynamic.wfcMenuCommand; + Guid tests = propertyGridCommands.TestAccessor.Dynamic.wfcMenuCommand; tests.Should().Be(new Guid("5a51cf82-7619-4a5d-b054-47f438425aa7")); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/AccessibleObjects/DropDownButton.DropDownButtonAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/AccessibleObjects/DropDownButton.DropDownButtonAccessibleObjectTests.cs index f136725250c..60975620f01 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/AccessibleObjects/DropDownButton.DropDownButtonAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/AccessibleObjects/DropDownButton.DropDownButtonAccessibleObjectTests.cs @@ -87,7 +87,7 @@ public void DropDownButtonAccessibleObject_FragmentNavigate_ParentIsGridEntry() control.SelectedObject = button; control.SelectedGridItem = control.GetCurrentEntries()[1].GridItems[5]; // FlatStyle property - PropertyGridView gridView = control.TestAccessor().GridView; + PropertyGridView gridView = control.TestAccessor.GridView; DropDownButton dropDownButton = gridView.DropDownButton; dropDownButton.Visible = true; diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/AccessibleObjects/PropertyDescriptorGridEntry.PropertyDescriptorGridEntryAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/AccessibleObjects/PropertyDescriptorGridEntry.PropertyDescriptorGridEntryAccessibleObjectTests.cs index be31f978882..cc3c7b86bf4 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/AccessibleObjects/PropertyDescriptorGridEntry.PropertyDescriptorGridEntryAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/AccessibleObjects/PropertyDescriptorGridEntry.PropertyDescriptorGridEntryAccessibleObjectTests.cs @@ -18,15 +18,15 @@ public void PropertyDescriptorGridEntryAccessibleObject_Navigates_to_DropDownCon using PropertyGridView propertyGridView = new(serviceProvider: null, propertyGrid); TestPropertyGridViewAccessibleObject accessibleObject = new(propertyGridView, parentPropertyGrid: null); - propertyGridView.Properties.AddValue(propertyGrid.TestAccessor().Dynamic.s_accessibilityProperty, accessibleObject); + propertyGridView.Properties.AddValue(propertyGrid.TestAccessor.Dynamic.s_accessibilityProperty, accessibleObject); TestPropertyDescriptorGridEntry gridEntry = new(propertyGrid, null, false); - propertyGridView.TestAccessor().Dynamic._selectedGridEntry = gridEntry; + propertyGridView.TestAccessor.Dynamic._selectedGridEntry = gridEntry; PropertyGridView.DropDownHolder dropDownHolder = new(propertyGridView); - dropDownHolder.TestAccessor().Dynamic.SetState(0x00000002, true); // Control class States.Visible flag - propertyGridView.TestAccessor().Dynamic._dropDownHolder = dropDownHolder; - gridEntry.TestAccessor().Dynamic._parent = new TestGridEntry(propertyGrid, null, propertyGridView); + dropDownHolder.TestAccessor.Dynamic.SetState(0x00000002, true); // Control class States.Visible flag + propertyGridView.TestAccessor.Dynamic._dropDownHolder = dropDownHolder; + gridEntry.TestAccessor.Dynamic._parent = new TestGridEntry(propertyGrid, null, propertyGridView); IRawElementProviderFragment.Interface firstChild = gridEntry.AccessibilityObject.FragmentNavigate(NavigateDirection.NavigateDirection_FirstChild); Assert.NotNull(firstChild); @@ -68,12 +68,12 @@ public void PropertyDescriptorGridEntryAccessibleObject_ExpandCollapseState_refl }; propertyGrid.SelectedObject = testEntity; - PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView; + PropertyGridView propertyGridView = propertyGrid.TestAccessor.GridView; int firstPropertyIndex = 1; // Index 0 corresponds to the category grid entry. var gridEntry = (PropertyDescriptorGridEntry)propertyGridView.AccessibilityGetGridEntries()[firstPropertyIndex]; - var selectedGridEntry = propertyGridView.TestAccessor().Dynamic._selectedGridEntry as PropertyDescriptorGridEntry; + var selectedGridEntry = propertyGridView.TestAccessor.Dynamic._selectedGridEntry as PropertyDescriptorGridEntry; Assert.Equal(gridEntry.PropertyName, selectedGridEntry.PropertyName); AccessibleObject selectedGridEntryAccessibleObject = gridEntry.AccessibilityObject; diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/AccessibleObjects/PropertyGridView.DropDownHolder.DropDownHolderAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/AccessibleObjects/PropertyGridView.DropDownHolder.DropDownHolderAccessibleObjectTests.cs index 5d198da4444..30ac3306c76 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/AccessibleObjects/PropertyGridView.DropDownHolder.DropDownHolderAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/AccessibleObjects/PropertyGridView.DropDownHolder.DropDownHolderAccessibleObjectTests.cs @@ -15,7 +15,7 @@ public class PropertyGridView_DropDownHolder_DropDownHolderAccessibleObjectTests public void DropDownHolder_AccessibilityObject_Constructor_initializes_fields() { using PropertyGrid propertyGrid = new(); - PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView; + PropertyGridView propertyGridView = propertyGrid.TestAccessor.GridView; using PropertyGridView.DropDownHolder dropDownHolderControl = new(propertyGridView); PropertyGridView.DropDownHolder.DropDownHolderAccessibleObject dropDownHolderControlAccessibilityObject = @@ -23,7 +23,7 @@ public void DropDownHolder_AccessibilityObject_Constructor_initializes_fields() dropDownHolderControl.AccessibilityObject); PropertyGridView.DropDownHolder dropDownHolder = - dropDownHolderControlAccessibilityObject.TestAccessor().Dynamic._owningDropDownHolder; + dropDownHolderControlAccessibilityObject.TestAccessor.Dynamic._owningDropDownHolder; Assert.NotNull(dropDownHolder); Assert.Same(dropDownHolder, dropDownHolderControl); } @@ -41,7 +41,7 @@ public void DropDownHolder_AccessibilityObject_Constructor_throws_error_if_passe public void DropDownHolder_AccessibilityObject_ReturnsExpected() { using PropertyGrid propertyGrid = new(); - PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView; + PropertyGridView propertyGridView = propertyGrid.TestAccessor.GridView; using PropertyGridView.DropDownHolder ownerControl = new(propertyGridView); Control.ControlAccessibleObject accessibilityObject = ownerControl.AccessibilityObject as Control.ControlAccessibleObject; @@ -54,7 +54,7 @@ public void DropDownHolder_AccessibilityObject_ReturnsExpected() PropertyDescriptor property = TypeDescriptor.GetProperties(typeof(PropertyGrid))[0]; PropertyDescriptorGridEntry gridEntry = new(propertyGrid, null, property, false); - propertyGridView.TestAccessor().Dynamic._selectedGridEntry = gridEntry; + propertyGridView.TestAccessor.Dynamic._selectedGridEntry = gridEntry; ownerControl.Visible = true; @@ -68,7 +68,7 @@ public void DropDownHolder_AccessibilityObject_ReturnsExpected() public void DropDownHolderAccessibleObject_ControlType_IsPane_IfAccessibleRoleIsDefault() { using PropertyGrid propertyGrid = new(); - PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView; + PropertyGridView propertyGridView = propertyGrid.TestAccessor.GridView; using PropertyGridView.DropDownHolder dropDownControlHolder = new(propertyGridView); // AccessibleRole is not set = Default diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/AccessibleObjects/PropertyGridView.GridViewListBoxAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/AccessibleObjects/PropertyGridView.GridViewListBoxAccessibleObjectTests.cs index ebc34d4fbaf..719da6c19d1 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/AccessibleObjects/PropertyGridView.GridViewListBoxAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/AccessibleObjects/PropertyGridView.GridViewListBoxAccessibleObjectTests.cs @@ -15,7 +15,7 @@ public class PropertyGridView_GridViewListBoxAccessibleObjectTest public void GridViewListBoxAccessibleObject_Ctor_Default() { using PropertyGrid propertyGrid = new(); - PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView; + PropertyGridView propertyGridView = propertyGrid.TestAccessor.GridView; using GridViewListBox gridViewListBox = new(propertyGridView); Type type = gridViewListBox.AccessibilityObject.GetType(); @@ -30,7 +30,7 @@ public void GridViewListBoxAccessibleObject_Ctor_Default() public void GridViewListBoxAccessibleObject_ControlType_IsList_IfAccessibleRoleIsDefault() { using PropertyGrid propertyGrid = new(); - PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView; + PropertyGridView propertyGridView = propertyGrid.TestAccessor.GridView; AccessibleObject accessibleObject = propertyGridView.DropDownListBoxAccessibleObject; // AccessibleRole is not set = Default @@ -46,7 +46,7 @@ public void GridViewListBoxAccessibleObject_ControlType_IsList_IfAccessibleRoleI public void GridViewListBoxAccessibleObject_Role_IsExpected_ByDefault(bool createControl, AccessibleRole expectedRole) { using PropertyGrid propertyGrid = new(); - PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView; + PropertyGridView propertyGridView = propertyGrid.TestAccessor.GridView; using GridViewListBox gridViewListBox = new(propertyGridView); // AccessibleRole is not set = Default diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/AccessibleObjects/PropertyGridView.GridViewTextBox.GridViewTextBoxAccessibleObjectTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/AccessibleObjects/PropertyGridView.GridViewTextBox.GridViewTextBoxAccessibleObjectTests.cs index df61e218701..4e69827af0e 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/AccessibleObjects/PropertyGridView.GridViewTextBox.GridViewTextBoxAccessibleObjectTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/AccessibleObjects/PropertyGridView.GridViewTextBox.GridViewTextBoxAccessibleObjectTests.cs @@ -26,16 +26,16 @@ public void GridViewTextBoxAccessibleObject_created_for_string_property() SelectedObject = testEntity }; - PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView; + PropertyGridView propertyGridView = propertyGrid.TestAccessor.GridView; int firstPropertyIndex = 1; // Index 0 corresponds to the category grid entry. PropertyDescriptorGridEntry gridEntry = (PropertyDescriptorGridEntry)propertyGridView.AccessibilityGetGridEntries()[firstPropertyIndex]; - PropertyDescriptorGridEntry selectedGridEntry = propertyGridView.TestAccessor().Dynamic._selectedGridEntry; + PropertyDescriptorGridEntry selectedGridEntry = propertyGridView.TestAccessor.Dynamic._selectedGridEntry; Assert.Equal(gridEntry.PropertyName, selectedGridEntry.PropertyName); // Force the entry edit control Handle creation. // GridViewEditAccessibleObject exists, if its control is already created. // In UI case an entry edit control is created when an PropertyGridView gets focus. - Assert.NotEqual(IntPtr.Zero, propertyGridView.TestAccessor().Dynamic.EditTextBox.Handle); + Assert.NotEqual(IntPtr.Zero, propertyGridView.TestAccessor.Dynamic.EditTextBox.Handle); AccessibleObject selectedGridEntryAccessibleObject = gridEntry.AccessibilityObject; IRawElementProviderFragment.Interface editFieldAccessibleObject = selectedGridEntryAccessibleObject.FragmentNavigate(NavigateDirection.NavigateDirection_FirstChild); @@ -53,17 +53,17 @@ public unsafe void GridViewTextBoxAccessibleObject_FragmentNavigate_navigates_co }; propertyGrid.CreateControl(); - PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView; + PropertyGridView propertyGridView = propertyGrid.TestAccessor.GridView; int firstPropertyIndex = 2; // Index of Text property which has a RichEdit control as an editor. PropertyDescriptorGridEntry gridEntry = (PropertyDescriptorGridEntry)propertyGridView.AccessibilityGetGridEntries()[firstPropertyIndex]; - propertyGridView.TestAccessor().Dynamic._selectedGridEntry = gridEntry; + propertyGridView.TestAccessor.Dynamic._selectedGridEntry = gridEntry; // Force the entry edit control Handle creation. // GridViewEditAccessibleObject exists, if its control is already created. // In UI case an entry edit control is created when an PropertyGridView gets focus. - Assert.NotEqual(IntPtr.Zero, propertyGridView.TestAccessor().Dynamic.EditTextBox.Handle); + Assert.NotEqual(IntPtr.Zero, propertyGridView.TestAccessor.Dynamic.EditTextBox.Handle); IRawElementProviderFragment.Interface editFieldAccessibleObject = gridEntry.AccessibilityObject.FragmentNavigate(NavigateDirection.NavigateDirection_FirstChild); Assert.Equal("GridViewTextBoxAccessibleObject", editFieldAccessibleObject.GetType().Name); @@ -71,9 +71,9 @@ public unsafe void GridViewTextBoxAccessibleObject_FragmentNavigate_navigates_co // The case with drop down holder: using PropertyGridView.DropDownHolder dropDownHolder = new(propertyGridView); dropDownHolder.CreateControl(); - propertyGridView.TestAccessor().Dynamic._dropDownHolder = dropDownHolder; + propertyGridView.TestAccessor.Dynamic._dropDownHolder = dropDownHolder; - dropDownHolder.TestAccessor().Dynamic.SetState(0x00000002, true); // Control class States.Visible flag + dropDownHolder.TestAccessor.Dynamic.SetState(0x00000002, true); // Control class States.Visible flag IRawElementProviderFragment.Interface dropDownHolderAccessibleObject = gridEntry.AccessibilityObject.FragmentNavigate(NavigateDirection.NavigateDirection_FirstChild); Assert.Equal("DropDownHolderAccessibleObject", dropDownHolderAccessibleObject.GetType().Name); @@ -93,7 +93,7 @@ public class TestEntityWithTextField public void GridViewTextBoxAccessibleObject_ctor_default() { using PropertyGrid propertyGrid = new(); - PropertyGridView gridView = propertyGrid.TestAccessor().GridView; + PropertyGridView gridView = propertyGrid.TestAccessor.GridView; Type gridViewTextBoxType = typeof(PropertyGridView).GetNestedType("GridViewTextBox", BindingFlags.NonPublic); Assert.NotNull(gridViewTextBoxType); TextBox gridViewTextBox = (TextBox)Activator.CreateInstance(gridViewTextBoxType, gridView); @@ -107,7 +107,7 @@ public void GridViewTextBoxAccessibleObject_ctor_default() public void GridViewTextBoxAccessibleObject_ctor_ThrowsException_IfOwnerIsNull() { using PropertyGrid propertyGrid = new(); - PropertyGridView gridView = propertyGrid.TestAccessor().GridView; + PropertyGridView gridView = propertyGrid.TestAccessor.GridView; Type gridViewTextBoxType = typeof(PropertyGridView).GetNestedType("GridViewTextBox", BindingFlags.NonPublic); Assert.NotNull(gridViewTextBoxType); TextBox gridViewTextBox = (TextBox)Activator.CreateInstance(gridViewTextBoxType, gridView); @@ -123,7 +123,7 @@ public void GridViewTextBoxAccessibleObject_ctor_ThrowsException_IfOwnerIsNull() public void GridViewTextBoxAccessibleObject_GetPropertyValue_PatternsSuported(int propertyID) { using PropertyGrid propertyGrid = new(); - PropertyGridView gridView = propertyGrid.TestAccessor().GridView; + PropertyGridView gridView = propertyGrid.TestAccessor.GridView; AccessibleObject accessibleObject = gridView.EditAccessibleObject; Assert.True((bool)accessibleObject.GetPropertyValue((UIA_PROPERTY_ID)propertyID)); } @@ -135,7 +135,7 @@ public void GridViewTextBoxAccessibleObject_GetPropertyValue_PatternsSuported(in public void GridViewTextBoxAccessibleObject_IsPatternSupported_PatternsSuported(int patternId) { using PropertyGrid propertyGrid = new(); - PropertyGridView gridView = propertyGrid.TestAccessor().GridView; + PropertyGridView gridView = propertyGrid.TestAccessor.GridView; AccessibleObject accessibleObject = gridView.EditAccessibleObject; Assert.True(accessibleObject.IsPatternSupported((UIA_PATTERN_ID)patternId)); } @@ -144,7 +144,7 @@ public void GridViewTextBoxAccessibleObject_IsPatternSupported_PatternsSuported( public void GridViewTextBoxAccessibleObject_ControlType_IsEdit_IfAccessibleRoleIsDefault() { using PropertyGrid propertyGrid = new(); - PropertyGridView gridView = propertyGrid.TestAccessor().GridView; + PropertyGridView gridView = propertyGrid.TestAccessor.GridView; AccessibleObject accessibleObject = gridView.EditAccessibleObject; // AccessibleRole is not set = Default @@ -159,7 +159,7 @@ public void GridViewTextBoxAccessibleObject_ControlType_IsEdit_IfAccessibleRoleI public void GridViewTextBoxAccessibleObject_GetPropertyValue_FrameworkIdPropertyId_ReturnsExpected() { using PropertyGrid propertyGrid = new(); - PropertyGridView gridView = propertyGrid.TestAccessor().GridView; + PropertyGridView gridView = propertyGrid.TestAccessor.GridView; AccessibleObject accessibleObject = gridView.EditAccessibleObject; Assert.Equal("WinForm", ((BSTR)accessibleObject.GetPropertyValue(UIA_PROPERTY_ID.UIA_FrameworkIdPropertyId)).ToStringAndFree()); @@ -172,13 +172,13 @@ public void GridViewTextBoxAccessibleObject_GetPropertyValue_FrameworkIdProperty public void GridViewTextBoxAccessibleObject_Role_IsExpected_ByDefault(bool createControl, AccessibleRole expectedRole) { using PropertyGrid propertyGrid = new(); - PropertyGridView gridView = propertyGrid.TestAccessor().GridView; + PropertyGridView gridView = propertyGrid.TestAccessor.GridView; // AccessibleRole is not set = Default if (createControl) { - gridView.TestAccessor().Dynamic.EditTextBox.CreateControl(true); // "true" means ignoring Visible value + gridView.TestAccessor.Dynamic.EditTextBox.CreateControl(true); // "true" means ignoring Visible value } AccessibleRole actual = gridView.EditAccessibleObject.Role; @@ -192,17 +192,17 @@ public void GridViewTextBoxAccessibleObject_RuntimeId_ReturnsNull() { using PropertyGrid propertyGrid = new() { SelectedObject = new TestEntityWithTextField() { TextProperty = "Test" } }; - PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView; + PropertyGridView propertyGridView = propertyGrid.TestAccessor.GridView; int firstPropertyIndex = 1; // Index 0 corresponds to the category grid entry. PropertyDescriptorGridEntry gridEntry = (PropertyDescriptorGridEntry)propertyGridView.AccessibilityGetGridEntries()[firstPropertyIndex]; // Force the entry edit control Handle creation. // GridViewEditAccessibleObject exists, if its control is already created. // In UI case an entry edit control is created when an PropertyGridView gets focus. - Assert.NotEqual(IntPtr.Zero, propertyGridView.TestAccessor().Dynamic.EditTextBox.Handle); + Assert.NotEqual(IntPtr.Zero, propertyGridView.TestAccessor.Dynamic.EditTextBox.Handle); AccessibleObject editFieldAccessibleObject = (AccessibleObject)gridEntry.AccessibilityObject.FragmentNavigate(NavigateDirection.NavigateDirection_FirstChild); - propertyGridView.TestAccessor().Dynamic._selectedGridEntry = null; + propertyGridView.TestAccessor.Dynamic._selectedGridEntry = null; Assert.NotNull(editFieldAccessibleObject.RuntimeId); } @@ -211,7 +211,7 @@ public void GridViewTextBoxAccessibleObject_RuntimeId_ReturnsNull() public void GridViewTextBoxAccessibleObject_FragmentRoot_ReturnsExpected() { using PropertyGrid propertyGrid = new(); - PropertyGridView gridView = propertyGrid.TestAccessor().GridView; + PropertyGridView gridView = propertyGrid.TestAccessor.GridView; AccessibleObject accessibleObject = gridView.EditAccessibleObject; Assert.Equal(propertyGrid.AccessibilityObject, accessibleObject.FragmentRoot); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/PropertyGridView.DropDownHolderTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/PropertyGridView.DropDownHolderTests.cs index ef9d456d1ff..a5e09e6dc3f 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/PropertyGridView.DropDownHolderTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/PropertyGridView.DropDownHolderTests.cs @@ -32,7 +32,7 @@ public void SupportsUiaProviders_returns_true() public void CreateAccessibilityObject_creates_DropDownHolderAccessibleObject() { using PropertyGrid propertyGrid = new(); - PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView; + PropertyGridView propertyGridView = propertyGrid.TestAccessor.GridView; using DropDownHolder dropDownHolder = new(propertyGridView); AccessibleObject accessibleObject = dropDownHolder.AccessibilityObject; @@ -43,7 +43,7 @@ public void CreateAccessibilityObject_creates_DropDownHolderAccessibleObject() public void SetDropDownControl_control_notnull() { using PropertyGrid propertyGrid = new(); - PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView; + PropertyGridView propertyGridView = propertyGrid.TestAccessor.GridView; using DropDownHolder dropDownHolder = new(propertyGridView); dropDownHolder.Visible = true; @@ -60,7 +60,7 @@ public void SetDropDownControl_control_notnull() public void SetDropDownControl_control_null() { using PropertyGrid propertyGrid = new(); - PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView; + PropertyGridView propertyGridView = propertyGrid.TestAccessor.GridView; using DropDownHolder dropDownHolder = new(propertyGridView); dropDownHolder.SetDropDownControl(null, resizable: false); @@ -71,7 +71,7 @@ public void SetDropDownControl_control_null() public void SetDropDownControl_Control_Height_verify() { using PropertyGrid propertyGrid = new(); - PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView; + PropertyGridView propertyGridView = propertyGrid.TestAccessor.GridView; using DropDownHolder dropDownHolder = new(propertyGridView); using GridViewListBox listBox = new(propertyGridView); @@ -91,7 +91,7 @@ public void SetDropDownControl_Control_Height_verify() public void SetDropDownControl_resizable_true() { using PropertyGrid propertyGrid = new(); - PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView; + PropertyGridView propertyGridView = propertyGrid.TestAccessor.GridView; using DropDownHolder dropDownHolder = new(propertyGridView); using GridViewListBox listBox = new(propertyGridView); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/PropertyGridView.GridViewListBoxTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/PropertyGridView.GridViewListBoxTests.cs index 7db89cdec2a..eafe58a6be9 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/PropertyGridView.GridViewListBoxTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/PropertyGridView.GridViewListBoxTests.cs @@ -19,7 +19,7 @@ public void GridViewListBoxAccessibleObject_checks_arguments() }; propertyGrid.CreateControl(); - PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView; + PropertyGridView propertyGridView = propertyGrid.TestAccessor.GridView; using PropertyGridView.GridViewListBox gridViewListBox = new(propertyGridView); AccessibleObject gridViewListBoxAccessibleObject = gridViewListBox.AccessibilityObject; diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/PropertyGridViewTests.Rendering.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/PropertyGridViewTests.Rendering.cs index 9c2fa63493d..9ac3bec2846 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/PropertyGridViewTests.Rendering.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/PropertyGridViewTests.Rendering.cs @@ -22,7 +22,7 @@ public void PropertyGridView_Render_Labels_Values_Correctly() Visible = true }; - PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView; + PropertyGridView propertyGridView = propertyGrid.TestAccessor.GridView; // For us to be able to render PropertyGridView and its values // PropertyGrid must be visible and have a valid handle. diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/PropertyGridViewTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/PropertyGridViewTests.cs index 8907c9d0559..a3361537d1d 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/PropertyGridViewTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/PropertyGridViewTests.cs @@ -11,7 +11,7 @@ public partial class PropertyGridViewTests public void PropertyGridView_Ctor_Default() { using PropertyGrid propertyGrid = new(); - PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView; + PropertyGridView propertyGridView = propertyGrid.TestAccessor.GridView; // TODO: validate properties diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/TestAccessors.PropertyGridTestAccessor.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/TestAccessors.PropertyGridTestAccessor.cs index e5eb6a0fb1f..7247f1be533 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/TestAccessors.PropertyGridTestAccessor.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/TestAccessors.PropertyGridTestAccessor.cs @@ -20,6 +20,8 @@ public PropertyGridTestAccessor(PropertyGrid instance) : base(instance) { } internal Dictionary _designerSelections => Dynamic._designerSelections; } - public static PropertyGridTestAccessor TestAccessor(this PropertyGrid propertyGrid) - => new(propertyGrid); + extension(PropertyGrid propertyGrid) + { + public PropertyGridTestAccessor TestAccessor => new(propertyGrid); + } } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/TestAccessors.PropertyGridViewTestAccessor.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/TestAccessors.PropertyGridViewTestAccessor.cs index 246361ef1c4..73af1a0ba38 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/TestAccessors.PropertyGridViewTestAccessor.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/TestAccessors.PropertyGridViewTestAccessor.cs @@ -18,6 +18,8 @@ internal Windows.Forms.PropertyGridInternal.PropertyDescriptorGridEntry Selected } } - internal static PropertyGridViewTestAccessor TestAccessor(this Windows.Forms.PropertyGridInternal.PropertyGridView propertyGridView) - => new(propertyGridView); + extension(Windows.Forms.PropertyGridInternal.PropertyGridView propertyGridView) + { + internal PropertyGridViewTestAccessor TestAccessor => new(propertyGridView); + } } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridTests.cs index 7163a1bdbba..92c4a676797 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridTests.cs @@ -167,7 +167,7 @@ public void PropertyGrid_Ctor_Default() Assert.False(control.VScroll); Assert.Equal(130, control.Width); - PropertyGridView propertyGridView = control.TestAccessor().GridView; + PropertyGridView propertyGridView = control.TestAccessor.GridView; Assert.NotNull(propertyGridView); Assert.False(control.IsHandleCreated); @@ -2741,7 +2741,7 @@ private ISite CreateISiteObject() public void PropertyGrid_Site_ShouldSaveSelectedTabIndex() { using PropertyGrid propertyGrid = new(); - var propertyGridTestAccessor = propertyGrid.TestAccessor(); + var propertyGridTestAccessor = propertyGrid.TestAccessor; propertyGrid.Site = CreateISiteObject(); Assert.NotNull(propertyGrid.ActiveDesigner); @@ -2764,7 +2764,7 @@ public void PropertyGrid_Site_ShouldSaveSelectedTabIndex() public void PropertyGrid_SiteChange_ShouldNotSaveSelectedTabIndex() { using PropertyGrid propertyGrid = new(); - var propertyGridTestAccessor = propertyGrid.TestAccessor(); + var propertyGridTestAccessor = propertyGrid.TestAccessor; propertyGrid.Site = CreateISiteObject(); var previousActiveDesigner = propertyGrid.ActiveDesigner; propertyGridTestAccessor.SaveSelectedTabIndex(); @@ -3876,7 +3876,7 @@ void handler(object sender, MouseEventArgs e) public void PropertyGrid_Buttons_AccessibleRole_IsRadiButton() { using PropertyGrid propertyGrid = new(); - ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor().Dynamic._viewSortButtons; + ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor.Dynamic._viewSortButtons; ToolStripButton categoryButton = toolStripButtons[0]; ToolStripButton alphaButton = toolStripButtons[1]; @@ -3889,13 +3889,13 @@ public void PropertyGrid_SystemColorsChanged_DoesNotLeakImageList() { using SubPropertyGrid propertyGrid = new(); - ImageList normalButtons = propertyGrid.TestAccessor().Dynamic._normalButtonImages; + ImageList normalButtons = propertyGrid.TestAccessor.Dynamic._normalButtonImages; Assert.NotNull(normalButtons); propertyGrid.OnSystemColorsChanged(EventArgs.Empty); - ImageList newNormalButtons = propertyGrid.TestAccessor().Dynamic._normalButtonImages; + ImageList newNormalButtons = propertyGrid.TestAccessor.Dynamic._normalButtonImages; Assert.NotNull(newNormalButtons); Assert.NotSame(normalButtons, newNormalButtons); @@ -3940,7 +3940,7 @@ public void PropertyGrid_BindObject() Type propertyType = gridEntry.PropertyType; Assert.True(propertyType == typeof(object)); - AttributeCollection attributes = gridEntry.TestAccessor().Dynamic.Attributes; + AttributeCollection attributes = gridEntry.TestAccessor.Dynamic.Attributes; bool foundTypeForward = false; foreach (object attribute in attributes) { @@ -3999,7 +3999,7 @@ public void ShortcutKeys_GridEntry_ProcessInput() shortcutKeyEntry.PropertyDescriptor.GetValue(menuItem).Should().Be(Keys.None); propertyGrid.SelectedGridItem = shortcutKeyEntry; - var gridViewAccessor = propertyGridView.TestAccessor(); + var gridViewAccessor = propertyGridView.TestAccessor; bool result = gridViewAccessor.Dynamic.ProcessEnumUpAndDown(shortcutKeyEntry, Keys.Down, closeDropDown: true); // Current value indicates the shortcut property is not set, thus up/down keys are ignored. @@ -4026,7 +4026,7 @@ public void PropertyGrid_PropertyValueChanged_Invoke_CallsPropertyValueChanged() }; propertyGrid.PropertyValueChanged += handler; - var accessor = propertyGrid.TestAccessor(); + var accessor = propertyGrid.TestAccessor; var gridItem = new Mock().Object; accessor.Dynamic.OnPropertyValueChanged(new PropertyValueChangedEventArgs(gridItem, 0)); callCount.Should().Be(1); @@ -4122,7 +4122,7 @@ public void PropertyGrid_PropertyTabChangedEventTriggered() var oldTab = tab2; var newTab = tab1; - var accessor = propertyGrid.TestAccessor(); + var accessor = propertyGrid.TestAccessor; accessor.Dynamic.OnPropertyTabChanged(new PropertyTabChangedEventArgs(oldTab, newTab)); eventCallCount.Should().Be(1); @@ -4149,7 +4149,7 @@ public void PropertyGrid_SelectedGridItemChanged_TriggeredCorrectly() Mock gridItemMock = new(); var gridItem = gridItemMock.Object; - var accessor = propertyGrid.TestAccessor(); + var accessor = propertyGrid.TestAccessor; accessor.Dynamic.OnSelectedGridItemChanged(new SelectedGridItemChangedEventArgs(null, gridItem)); eventCallCount.Should().Be(1); @@ -4166,7 +4166,7 @@ public void PropertyGrid_FullRefreshShouldTriggerTypeConverterGetProperties() { SelectedObject = new SelectedObject() }; - PropertyGridView propertyGridView = propertyGrid.TestAccessor().Dynamic._gridView; + PropertyGridView propertyGridView = propertyGrid.TestAccessor.Dynamic._gridView; MyTypeConverter.GetPropertiesInvokeCount = 0; propertyGridView.Refresh(true); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridToolStripButtonTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridToolStripButtonTests.cs index 07467240a1b..e7192d4cec7 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridToolStripButtonTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridToolStripButtonTests.cs @@ -11,7 +11,7 @@ public class PropertyGridToolStripButtonTests public void PropertyGridToolStripButton_AccessibilityObject_ReturnsPropertyGridToolStripButtonAccessibleObject() { using PropertyGrid propertyGrid = new(); - ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor().Dynamic._viewSortButtons; + ToolStripButton[] toolStripButtons = propertyGrid.TestAccessor.Dynamic._viewSortButtons; Assert.IsType(toolStripButtons[0].AccessibilityObject); Assert.IsType(toolStripButtons[1].AccessibilityObject); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/RadioButtonRendererTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/RadioButtonRendererTests.cs index 74f8f0e21cf..8865ccd9da9 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/RadioButtonRendererTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/RadioButtonRendererTests.cs @@ -311,7 +311,7 @@ public void DrawRadioButton_Internal_WithImageAndText_DoesNotThrow() HWND hwnd = HWND.Null; typeof(RadioButtonRenderer) - .TestAccessor() + .TestAccessor .Dynamic .DrawRadioButton( g, diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/RichTextBoxTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/RichTextBoxTests.cs index 83b547fdee1..349b5f21983 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/RichTextBoxTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/RichTextBoxTests.cs @@ -6900,7 +6900,7 @@ public void RichTextBox_Text_GetWithHandle_ReturnsExpected() Assert.Equal(expectedText, control.Text); // verify the old behavior via StreamOut(SF.TEXT | SF.UNICODE) - string textOldWay = control.TestAccessor().Dynamic.StreamOut(PInvoke.SF_TEXT | PInvoke.SF_UNICODE); + string textOldWay = control.TestAccessor.Dynamic.StreamOut(PInvoke.SF_TEXT | PInvoke.SF_UNICODE); Assert.Equal(oldWayExpectedText, textOldWay); // verify against RichEdit20W @@ -6982,7 +6982,7 @@ public void RichTextBox_Text_GetTextEx_USECRLF_ReturnsExpected(string text, stri control.Text = text; - string textOldWay = control.TestAccessor().Dynamic.GetTextEx(GETTEXTEX_FLAGS.GT_USECRLF); + string textOldWay = control.TestAccessor.Dynamic.GetTextEx(GETTEXTEX_FLAGS.GT_USECRLF); Assert.Equal(expected, textOldWay); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ScrollBarTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ScrollBarTests.cs index cccc4c86511..c8d9c2db50f 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ScrollBarTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ScrollBarTests.cs @@ -2594,7 +2594,7 @@ public void ScrollBar_ScaleScrollBarForDpi_InvokeWithSize_Nop(bool scaleScrollBa Size = controlSize }; - control.TestAccessor().Dynamic._scrollOrientation = orientation; + control.TestAccessor.Dynamic._scrollOrientation = orientation; SizeF factor = new(((float)deviceDpiNew) / deviceDpiOld, ((float)deviceDpiNew) / deviceDpiOld); control.ScaleControl(factor, factor); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/TabControlTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/TabControlTests.cs index a51fc96b20f..1e7f5ad0496 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/TabControlTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/TabControlTests.cs @@ -5692,7 +5692,7 @@ public void TabControl_Invokes_SetToolTip_IfExternalToolTipIsSet() using ToolTip toolTip = new(); control.CreateControl(); - dynamic tabControl = control.TestAccessor().Dynamic; + dynamic tabControl = control.TestAccessor.Dynamic; string actual = tabControl._controlTipText; Assert.Empty(actual); @@ -5718,7 +5718,7 @@ public void TabControl_WmSelChange_SelectedTabIsNull_DoesNotThrowException() form.Show(); control.SelectedIndex = 0; - Action act = () => control.TestAccessor().Dynamic.WmSelChange(); + Action act = () => control.TestAccessor.Dynamic.WmSelChange(); act.Should().NotThrow(); control.TabPages.Clear(); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/TabPageTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/TabPageTests.cs index 60bddfa1645..f258e917188 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/TabPageTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/TabPageTests.cs @@ -5002,7 +5002,7 @@ public void TabPage_InternalToolTip_IsSet_IfNoExternalIsSet() string text = "Some test text"; control.ToolTipText = text; - ToolTip internalToolTip = control.TestAccessor().Dynamic._internalToolTip; + ToolTip internalToolTip = control.TestAccessor.Dynamic._internalToolTip; string actual = internalToolTip.GetCaptionForTool(control); Assert.Equal(text, actual); @@ -5020,7 +5020,7 @@ public void TabPage_InternalToolTip_IsNotSet_IfExternalIsSet() Assert.NotEqual(IntPtr.Zero, toolTip.Handle); // A workaround to create the tooltip native window Handle toolTip.SetToolTip(control, text); - ToolTip internalToolTip = control.TestAccessor().Dynamic._internalToolTip; + ToolTip internalToolTip = control.TestAccessor.Dynamic._internalToolTip; string actual = internalToolTip.GetCaptionForTool(control); Assert.Null(actual); @@ -5058,7 +5058,7 @@ public void TabPage_SetToolTip_ManagesAssociatedToolTips_ForOneToolTipInstance(b string text = "Some test text"; control.ToolTipText = text; - dynamic tabPageDynamic = control.TestAccessor().Dynamic; + dynamic tabPageDynamic = control.TestAccessor.Dynamic; ToolTip internalToolTip = tabPageDynamic._internalToolTip; ToolTip externalToolTip = tabPageDynamic._externalToolTip; List associatedToolTips = tabPageDynamic._associatedToolTips; @@ -5090,7 +5090,7 @@ public void TabPage_SetToolTip_ManagesInternalAndAssociatedToolTips_ForTwoToolTi string text = "Some test text"; control.ToolTipText = text; - dynamic tabPageDynamic = control.TestAccessor().Dynamic; + dynamic tabPageDynamic = control.TestAccessor.Dynamic; ToolTip internalToolTip = tabPageDynamic._internalToolTip; ToolTip externalToolTip = tabPageDynamic._externalToolTip; List associatedToolTips = tabPageDynamic._associatedToolTips; @@ -5126,7 +5126,7 @@ public void TabPage_RemoveToolTip_ManagesAssociatedToolTips_ForOneToolTipInstanc string text = "Some test text"; control.ToolTipText = text; - dynamic tabPageDynamic = control.TestAccessor().Dynamic; + dynamic tabPageDynamic = control.TestAccessor.Dynamic; ToolTip internalToolTip = tabPageDynamic._internalToolTip; ToolTip externalToolTip = tabPageDynamic._externalToolTip; @@ -5157,7 +5157,7 @@ public void TabPage_RemoveToolTip_ManagesAssociatedToolTips_ForTwoToolTipInstanc string text = "Some test text"; control.ToolTipText = text; - dynamic tabPageDynamic = control.TestAccessor().Dynamic; + dynamic tabPageDynamic = control.TestAccessor.Dynamic; ToolTip internalToolTip = tabPageDynamic._internalToolTip; using ToolTip toolTip1 = new(); @@ -5183,7 +5183,7 @@ public void TabPage_RemoveToolTip_ManagesAssociatedToolTips_ForThreeToolTipInsta string text = "Some test text"; control.ToolTipText = text; - dynamic tabPageDynamic = control.TestAccessor().Dynamic; + dynamic tabPageDynamic = control.TestAccessor.Dynamic; ToolTip internalToolTip = tabPageDynamic._internalToolTip; ToolTip externalToolTip = tabPageDynamic._externalToolTip; diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/TestAccessors.KeyboardToolTipStateMachineTestAccessor.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/TestAccessors.KeyboardToolTipStateMachineTestAccessor.cs index 2fb20a5f91c..6d1ccf4b395 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/TestAccessors.KeyboardToolTipStateMachineTestAccessor.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/TestAccessors.KeyboardToolTipStateMachineTestAccessor.cs @@ -15,6 +15,8 @@ public KeyboardToolTipStateMachineTestAccessor(KeyboardToolTipStateMachine insta internal bool IsToolTracked(IKeyboardToolTip sender) => (bool)Dynamic.IsToolTracked(sender); } - internal static KeyboardToolTipStateMachineTestAccessor TestAccessor(this KeyboardToolTipStateMachine instance) - => new(instance); + extension(KeyboardToolTipStateMachine instance) + { + internal KeyboardToolTipStateMachineTestAccessor TestAccessor => new(instance); + } } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/TextBoxAutoCompleteSourceConverterTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/TextBoxAutoCompleteSourceConverterTests.cs index 60f3c9d5772..9f051677673 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/TextBoxAutoCompleteSourceConverterTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/TextBoxAutoCompleteSourceConverterTests.cs @@ -20,7 +20,7 @@ public void TextBoxAutoCompleteSourceConverter_GetStandardValues_HasContext_Retu valuesCollection.Count.Should().Be(8); - List value = valuesCollection.TestAccessor().Dynamic._values; + List value = valuesCollection.TestAccessor.Dynamic._values; value.Should().Contain(AutoCompleteSource.AllUrl); value.Should().Contain(AutoCompleteSource.AllSystemSources); value.Should().Contain(AutoCompleteSource.CustomSource); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripButtonTests.Rendering.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripButtonTests.Rendering.cs index 487835b576b..f7ccf254b52 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripButtonTests.Rendering.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripButtonTests.Rendering.cs @@ -29,7 +29,7 @@ public void ToolStripButton_RendersTextCorrectly() Rectangle bounds = toolStripButton.Bounds; using PaintEventArgs e = new(emf, bounds); - toolStripButton.TestAccessor().Dynamic.OnPaint(e); + toolStripButton.TestAccessor.Dynamic.OnPaint(e); emf.Validate( state, @@ -52,7 +52,7 @@ public void ToolStripButton_RendersBackgroundCorrectly() DeviceContextState state = new(emf); Rectangle bounds = toolStripButton.Bounds; using PaintEventArgs e = new(emf, bounds); - toolStripButton.TestAccessor().Dynamic.OnPaint(e); + toolStripButton.TestAccessor.Dynamic.OnPaint(e); emf.Validate( state, @@ -77,7 +77,7 @@ public void ToolStripButton_Selected_RendersBackgroundCorrectly_HighContrast() DeviceContextState state = new(emf); Rectangle bounds = toolStripButton.Bounds; using PaintEventArgs e = new(emf, bounds); - toolStripButton.TestAccessor().Dynamic.OnPaint(e); + toolStripButton.TestAccessor.Dynamic.OnPaint(e); emf.Validate( state, @@ -103,7 +103,7 @@ public void ToolStripButton_Indeterminate_RendersBackgroundCorrectly_HighContras DeviceContextState state = new(emf); Rectangle bounds = toolStripButton.Bounds; using PaintEventArgs e = new(emf, bounds); - toolStripButton.TestAccessor().Dynamic.OnPaint(e); + toolStripButton.TestAccessor.Dynamic.OnPaint(e); emf.Validate( state, @@ -129,7 +129,7 @@ public void ToolStripButton_DropDownButton_Selected_RendersBackgroundCorrectly_H DeviceContextState state = new(emf); Rectangle bounds = toolStripDropDownButton.Bounds; using PaintEventArgs e = new(emf, bounds); - toolStripDropDownButton.TestAccessor().Dynamic.OnPaint(e); + toolStripDropDownButton.TestAccessor.Dynamic.OnPaint(e); emf.Validate( state, @@ -156,7 +156,7 @@ public void ToolStripButton_SplitButton_Selected_RendersBackgroundCorrectly_High DeviceContextState state = new(emf); Rectangle bounds = toolStripDropDownButton.Bounds; using PaintEventArgs e = new(emf, bounds); - toolStripDropDownButton.TestAccessor().Dynamic.OnPaint(e); + toolStripDropDownButton.TestAccessor.Dynamic.OnPaint(e); emf.Validate( state, diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripComboBox.ToolStripComboBoxControl.ToolStripComboBoxFlatComboAdapterTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripComboBox.ToolStripComboBoxControl.ToolStripComboBoxFlatComboAdapterTests.cs index 085db71de85..74b00654011 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripComboBox.ToolStripComboBoxControl.ToolStripComboBoxFlatComboAdapterTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripComboBox.ToolStripComboBoxControl.ToolStripComboBoxFlatComboAdapterTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Drawing; @@ -29,7 +29,7 @@ public void UseBaseAdapter_ReturnsTrue_ForToolStripComboBoxControl() { using ToolStripComboBox.ToolStripComboBoxControl comboBox = new(); bool result = (bool)typeof(ToolStripComboBox.ToolStripComboBoxControl.ToolStripComboBoxFlatComboAdapter) - .TestAccessor().Dynamic.UseBaseAdapter(comboBox); + .TestAccessor.Dynamic.UseBaseAdapter(comboBox); result.Should().BeTrue(); } @@ -37,7 +37,7 @@ public void UseBaseAdapter_ReturnsTrue_ForToolStripComboBoxControl() [WinFormsFact] public void GetColorTable_ReturnsExpected() { - var colorTable = (ProfessionalColorTable)_adapter.TestAccessor().Dynamic.GetColorTable(_comboBox); + var colorTable = (ProfessionalColorTable)_adapter.TestAccessor.Dynamic.GetColorTable(_comboBox); colorTable.Should().NotBeNull(); colorTable.Should().BeOfType(); @@ -50,7 +50,7 @@ public void GetOuterBorderColor_ReturnsExpected(bool enabled, KnownColor expecte { _comboBox.Enabled = enabled; - Color result = (Color)_adapter.TestAccessor().Dynamic.GetOuterBorderColor(_comboBox); + Color result = (Color)_adapter.TestAccessor.Dynamic.GetOuterBorderColor(_comboBox); result.Should().Be(Color.FromKnownColor(expectedColor)); } @@ -64,7 +64,7 @@ public void GetPopupOuterBorderColor_ReturnsExpected(bool enabled, bool focused, { _comboBox.Enabled = enabled; - Color result = (Color)_adapter.TestAccessor().Dynamic.GetPopupOuterBorderColor(_comboBox, focused); + Color result = (Color)_adapter.TestAccessor.Dynamic.GetPopupOuterBorderColor(_comboBox, focused); result.Should().Be(Color.FromKnownColor(expectedColor)); } @@ -76,7 +76,7 @@ public void DrawFlatComboDropDown_DrawsCorrectly() using Graphics graphics = Graphics.FromImage(bitmap); Rectangle dropDownRect = new(0, 0, 100, 100); - _adapter.TestAccessor().Dynamic.DrawFlatComboDropDown(_comboBox, graphics, dropDownRect); + _adapter.TestAccessor.Dynamic.DrawFlatComboDropDown(_comboBox, graphics, dropDownRect); bitmap.GetPixel(50, 50).Should().NotBe(Color.Empty); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripComboBoxTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripComboBoxTests.cs index 270947a7fc4..82e7ab9f637 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripComboBoxTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripComboBoxTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Drawing; @@ -241,12 +241,12 @@ public void ToolStripComboBox_DropDown_EventRaised() EventHandler handler = (sender, e) => eventCount++; _toolStripComboBox.DropDown += handler; - _toolStripComboBox.ComboBox.TestAccessor().Dynamic.OnDropDown(EventArgs.Empty); + _toolStripComboBox.ComboBox.TestAccessor.Dynamic.OnDropDown(EventArgs.Empty); eventCount.Should().Be(1); eventCount = 0; _toolStripComboBox.DropDown -= handler; - _toolStripComboBox.ComboBox.TestAccessor().Dynamic.OnDropDown(EventArgs.Empty); + _toolStripComboBox.ComboBox.TestAccessor.Dynamic.OnDropDown(EventArgs.Empty); eventCount.Should().Be(0); } @@ -257,12 +257,12 @@ public void ToolStripComboBox_DropDownClosed_EventRaised() EventHandler handler = (sender, e) => eventCount++; _toolStripComboBox.DropDownClosed += handler; - _toolStripComboBox.ComboBox.TestAccessor().Dynamic.OnDropDownClosed(EventArgs.Empty); + _toolStripComboBox.ComboBox.TestAccessor.Dynamic.OnDropDownClosed(EventArgs.Empty); eventCount.Should().Be(1); eventCount = 0; _toolStripComboBox.DropDownClosed -= handler; - _toolStripComboBox.ComboBox.TestAccessor().Dynamic.OnDropDownClosed(EventArgs.Empty); + _toolStripComboBox.ComboBox.TestAccessor.Dynamic.OnDropDownClosed(EventArgs.Empty); eventCount.Should().Be(0); } @@ -275,12 +275,12 @@ public void ToolStripComboBox_DropDownStyleChanged_Event_AddRemove() EventHandler handler = (sender, e) => eventCount++; _toolStripComboBox.DropDownStyleChanged += handler; - _toolStripComboBox.ComboBox.TestAccessor().Dynamic.OnDropDownStyleChanged(EventArgs.Empty); + _toolStripComboBox.ComboBox.TestAccessor.Dynamic.OnDropDownStyleChanged(EventArgs.Empty); eventCount.Should().Be(1); eventCount = 0; _toolStripComboBox.DropDownStyleChanged -= handler; - _toolStripComboBox.ComboBox.TestAccessor().Dynamic.OnDropDownStyleChanged(EventArgs.Empty); + _toolStripComboBox.ComboBox.TestAccessor.Dynamic.OnDropDownStyleChanged(EventArgs.Empty); eventCount.Should().Be(0); _toolStripComboBox.DropDownStyle = ComboBoxStyle.DropDownList; @@ -312,12 +312,12 @@ public void ToolStripComboBox_TextUpdate_Event_AddRemove() EventHandler handler = (sender, e) => eventCount++; _toolStripComboBox.TextUpdate += handler; - _toolStripComboBox.ComboBox.TestAccessor().Dynamic.OnTextUpdate(EventArgs.Empty); + _toolStripComboBox.ComboBox.TestAccessor.Dynamic.OnTextUpdate(EventArgs.Empty); eventCount.Should().Be(1); eventCount = 0; _toolStripComboBox.TextUpdate -= handler; - _toolStripComboBox.ComboBox.TestAccessor().Dynamic.OnTextUpdate(EventArgs.Empty); + _toolStripComboBox.ComboBox.TestAccessor.Dynamic.OnTextUpdate(EventArgs.Empty); eventCount.Should().Be(0); } @@ -360,12 +360,12 @@ public void ToolStripComboBox_DoubleClick_EventRaised() EventHandler handler = (sender, e) => eventCount++; _toolStripComboBox.DoubleClick += handler; - _toolStripComboBox.ComboBox.TestAccessor().Dynamic.OnDoubleClick(EventArgs.Empty); + _toolStripComboBox.ComboBox.TestAccessor.Dynamic.OnDoubleClick(EventArgs.Empty); eventCount.Should().Be(1); eventCount = 0; _toolStripComboBox.DoubleClick -= handler; - _toolStripComboBox.ComboBox.TestAccessor().Dynamic.OnDoubleClick(EventArgs.Empty); + _toolStripComboBox.ComboBox.TestAccessor.Dynamic.OnDoubleClick(EventArgs.Empty); eventCount.Should().Be(0); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripItemCollectionTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripItemCollectionTests.cs index a5847aaab3d..32dd7e35a3c 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripItemCollectionTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripItemCollectionTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Drawing; @@ -258,7 +258,7 @@ public void ToolStripItemCollection_IsValidIndex_ValidIndex_ReturnsTrue() ToolStripItem[] items = CreateToolStripItems(("key1", "Item1"), ("key2", "Item2")); ToolStripItemCollection collection = new(toolStrip, items); - dynamic accessor = collection.TestAccessor().Dynamic; + dynamic accessor = collection.TestAccessor.Dynamic; ((bool)accessor.IsValidIndex(0)).Should().BeTrue(); ((bool)accessor.IsValidIndex(1)).Should().BeTrue(); @@ -271,7 +271,7 @@ public void ToolStripItemCollection_IsValidIndex_InvalidIndex_ReturnsFalse() ToolStripItem[] items = CreateToolStripItems(("key1", "Item1"), ("key2", "Item2")); ToolStripItemCollection collection = new(toolStrip, items); - dynamic accessor = collection.TestAccessor().Dynamic; + dynamic accessor = collection.TestAccessor.Dynamic; ((bool)accessor.IsValidIndex(-1)).Should().BeFalse(); ((bool)accessor.IsValidIndex(2)).Should().BeFalse(); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripItemTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripItemTests.cs index aeedefc5cb4..f918753acb8 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripItemTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripItemTests.cs @@ -15629,7 +15629,7 @@ public ToolStripDropDownItemWithAccessibleObjectFieldAccessor() : base() { } public bool IsAccessibleObjectCleared() { - var key = this.TestAccessor().Dynamic.s_accessibilityProperty; + var key = this.TestAccessor.Dynamic.s_accessibilityProperty; return !Properties.ContainsKey(key); } } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripLabelTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripLabelTests.cs index f3ac70e0dab..6a2a4488850 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripLabelTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripLabelTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Drawing; @@ -93,7 +93,7 @@ public void ToolStripLabel_ConstructorWithTextImageIsLinkAndOnClick_SetsTextImag [WinFormsFact] public void ToolStripLabel_ActiveLinkColor_DefaultValue() { - var defaultColor = _toolStripLabel.TestAccessor().Dynamic.IEActiveLinkColor; + var defaultColor = _toolStripLabel.TestAccessor.Dynamic.IEActiveLinkColor; _toolStripLabel.ActiveLinkColor.Should().Be(defaultColor); } @@ -148,7 +148,7 @@ public void ToolStripLabel_VisitedLinkColor_SetAndGet() [WinFormsFact] public void ToolStripLabel_VisitedLinkColor_DefaultValue() { - var accessor = _toolStripLabel.TestAccessor().Dynamic; + var accessor = _toolStripLabel.TestAccessor.Dynamic; Color defaultColor = accessor.IEVisitedLinkColor; _toolStripLabel.VisitedLinkColor.Should().Be(defaultColor); @@ -166,7 +166,7 @@ public void ToolStripLabel_LinkColor_SetAndGet() [WinFormsFact] public void ToolStripLabel_InvalidateLinkFonts_DisposesFonts() { - var accessor = _toolStripLabel.TestAccessor().Dynamic; + var accessor = _toolStripLabel.TestAccessor.Dynamic; accessor._linkFont = new Font("Arial", 10); accessor._hoverLinkFont = new Font("Arial", 10, FontStyle.Underline); @@ -179,7 +179,7 @@ public void ToolStripLabel_InvalidateLinkFonts_DisposesFonts() [WinFormsFact] public void ToolStripLabel_OnFontChanged_InvokesInvalidateLinkFonts() { - var accessor = _toolStripLabel.TestAccessor().Dynamic; + var accessor = _toolStripLabel.TestAccessor.Dynamic; accessor._linkFont = new Font("Arial", 10); accessor._hoverLinkFont = new Font("Arial", 10, FontStyle.Underline); @@ -194,7 +194,7 @@ public void ToolStripLabel_ResetActiveLinkColor_SetsActiveLinkColorToDefault() { _toolStripLabel.ActiveLinkColor = Color.Red; - var accessor = _toolStripLabel.TestAccessor().Dynamic; + var accessor = _toolStripLabel.TestAccessor.Dynamic; accessor.ResetActiveLinkColor(); Color defaultColor = accessor.IEActiveLinkColor; @@ -207,7 +207,7 @@ public void ToolStripLabel_ResetLinkColor_SetsLinkColorToDefault() { _toolStripLabel.LinkColor = Color.Blue; - var accessor = _toolStripLabel.TestAccessor().Dynamic; + var accessor = _toolStripLabel.TestAccessor.Dynamic; accessor.ResetLinkColor(); Color defaultColor = accessor.IELinkColor; @@ -233,7 +233,7 @@ public void ToolStripLabel_ShouldSerializeColor_ReturnsExpected(string propertyN var property = typeof(ToolStripLabel).GetProperty(propertyName); property!.SetValue(_toolStripLabel, color); - var accessor = _toolStripLabel.TestAccessor().Dynamic; + var accessor = _toolStripLabel.TestAccessor.Dynamic; bool result = propertyName switch { nameof(ToolStripLabel.ActiveLinkColor) => accessor.ShouldSerializeActiveLinkColor(), diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripManagerModalMenuFilterHostedWindowsFormsMessageHookTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripManagerModalMenuFilterHostedWindowsFormsMessageHookTests.cs index 8edd408c2a7..9cfdeaefccb 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripManagerModalMenuFilterHostedWindowsFormsMessageHookTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripManagerModalMenuFilterHostedWindowsFormsMessageHookTests.cs @@ -32,13 +32,13 @@ public void UninstallMessageHook_DoesNotThrow_WhenCalledTwice() object? hook = Activator.CreateInstance(hookType, nonPublic: true); - hook?.TestAccessor().Dynamic.UninstallMessageHook(); - hook?.TestAccessor().Dynamic.UninstallMessageHook(); + hook?.TestAccessor.Dynamic.UninstallMessageHook(); + hook?.TestAccessor.Dynamic.UninstallMessageHook(); - bool isHooked = hook?.TestAccessor().Dynamic._isHooked; + bool isHooked = hook?.TestAccessor.Dynamic._isHooked; isHooked.Should().BeFalse(); - IntPtr messageHookHandle = hook?.TestAccessor().Dynamic._messageHookHandle; + IntPtr messageHookHandle = hook?.TestAccessor.Dynamic._messageHookHandle; messageHookHandle.Should().Be(IntPtr.Zero); } } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripMenuItemTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripMenuItemTests.cs index 2451ded50ca..795a8f9f921 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripMenuItemTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripMenuItemTests.cs @@ -114,7 +114,7 @@ public void ToolStripMenuItem_GetNativeMenuItemImage_ReturnsExpected(int nativeM HMENU hmenu = PInvoke.GetSystemMenu(form, bRevert: false); using SubToolStripMenuItem menuItem = new(hmenu, nativeMenuCommandID, form); - using Bitmap bitmap = menuItem.TestAccessor().Dynamic.GetNativeMenuItemImage(); + using Bitmap bitmap = menuItem.TestAccessor.Dynamic.GetNativeMenuItemImage(); Assert.NotNull(bitmap); } @@ -212,7 +212,7 @@ public void ToolStripMenuItem_Ctor_WithTextImageOnClickName_ShouldInitializeCorr item.Text.Should().Be(text); item.Image.Should().Be(image); item.Name.Should().Be(name); - item.TestAccessor().Dynamic.OnClick(null); + item.TestAccessor.Dynamic.OnClick(null); wasClicked.Should().BeTrue(); } @@ -229,7 +229,7 @@ public void ToolStripMenuItem_Ctor_WithTextImageOnClickShortcutKeys_ShouldInitia item.Text.Should().Be(text); item.Image.Should().Be(image); - item.TestAccessor().Dynamic.OnClick(null); + item.TestAccessor.Dynamic.OnClick(null); wasClicked.Should().BeTrue(); item.ShortcutKeys.Should().Be(shortcutKeys); } @@ -355,7 +355,7 @@ public void ToolStripMenuItem_Clone_ShouldReturnExpected() public void ToolStripMenuItem_SetDeviceDpi_ShouldUpdateDpiAndDisposeImages() { using ToolStripMenuItem item = new(); - dynamic accessor = item.TestAccessor().Dynamic; + dynamic accessor = item.TestAccessor.Dynamic; accessor.DeviceDpi = 96; diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripPanel.ToolStripPanelRowCollectionTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripPanel.ToolStripPanelRowCollectionTests.cs index c5a55fe0303..f87768afaf7 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripPanel.ToolStripPanelRowCollectionTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripPanel.ToolStripPanelRowCollectionTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using static System.Windows.Forms.ToolStripPanel; @@ -34,7 +34,7 @@ private void DisposeRows(ToolStripPanelRow[]? rows) [WinFormsFact] public void ToolStripPanelRowCollection_ConstructorWithOwner_SetsOwner() { - using ToolStripPanel toolStripPanel = _toolStripPanelRowCollection.TestAccessor().Dynamic._owner; + using ToolStripPanel toolStripPanel = _toolStripPanelRowCollection.TestAccessor.Dynamic._owner; toolStripPanel.Should().BeSameAs(_toolStripPanel); } @@ -44,7 +44,7 @@ public void ToolStripPanelRowCollection_ConstructorWithOwnerAndRows_SetsOwnerAnd using ToolStripPanelRow toolStripPanelRow1 = new(_toolStripPanel); ToolStripPanelRow[] toolStripPanelRowArray = [toolStripPanelRow1]; ToolStripPanelRowCollection toolStripPanelRowCollection = new(_toolStripPanel, toolStripPanelRowArray); - ToolStripPanel toolStripPanel = toolStripPanelRowCollection.TestAccessor().Dynamic._owner; + ToolStripPanel toolStripPanel = toolStripPanelRowCollection.TestAccessor.Dynamic._owner; toolStripPanel.Should().BeSameAs(_toolStripPanel); toolStripPanelRowCollection.Count.Should().Be(1); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripProfessionalLowResolutionRendererTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripProfessionalLowResolutionRendererTests.cs index cabe69ff44b..f7cb9b4849c 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripProfessionalLowResolutionRendererTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripProfessionalLowResolutionRendererTests.cs @@ -25,7 +25,7 @@ public void OnRenderToolStripBackground_DoesNotThrow_ForNonDropDown() using Graphics g = Graphics.FromImage(bmp); ToolStripRenderEventArgs args = new(g, toolStrip); - Action action = () => _toolStripProfessionalLowResolutionRenderer.TestAccessor().Dynamic.OnRenderToolStripBackground(args); + Action action = () => _toolStripProfessionalLowResolutionRenderer.TestAccessor.Dynamic.OnRenderToolStripBackground(args); action.Should().NotThrow(); } @@ -38,7 +38,7 @@ public void OnRenderToolStripBackground_CallsBase_ForDropDown() using Graphics g = Graphics.FromImage(bmp); ToolStripRenderEventArgs args = new(g, dropDown); - Action action = () => _toolStripProfessionalLowResolutionRenderer.TestAccessor().Dynamic.OnRenderToolStripBackground(args); + Action action = () => _toolStripProfessionalLowResolutionRenderer.TestAccessor.Dynamic.OnRenderToolStripBackground(args); action.Should().NotThrow(); } @@ -55,7 +55,7 @@ public void OnRenderToolStripBorder_DoesNotThrow_ForAllToolStrips(Type toolStrip using Graphics g = Graphics.FromImage(bmp); ToolStripRenderEventArgs args = new(g, toolStrip); - Action action = () => _toolStripProfessionalLowResolutionRenderer.TestAccessor().Dynamic.OnRenderToolStripBorder(args); + Action action = () => _toolStripProfessionalLowResolutionRenderer.TestAccessor.Dynamic.OnRenderToolStripBorder(args); action.Should().NotThrow(); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripSplitButtonTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripSplitButtonTests.cs index 6383e3656e6..870c2c25058 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripSplitButtonTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripSplitButtonTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Drawing; @@ -78,7 +78,7 @@ public void ToolStripSplitButton_Ctor_Default() _toolStripSplitButton.Text.Should().BeEmpty(); _toolStripSplitButton.Image.Should().BeNull(); - toolStripSplitButton.DropDownButtonWidth.Should().Be(toolStripSplitButton.TestAccessor().Dynamic.DefaultDropDownButtonWidth); + toolStripSplitButton.DropDownButtonWidth.Should().Be(toolStripSplitButton.TestAccessor.Dynamic.DefaultDropDownButtonWidth); } [WinFormsFact] @@ -88,7 +88,7 @@ public void ToolStripSplitButton_Ctor_String() toolStripSplitButton.Text.Should().Be("Test"); _toolStripSplitButton.Image.Should().BeNull(); - toolStripSplitButton.DropDownButtonWidth.Should().Be(toolStripSplitButton.TestAccessor().Dynamic.DefaultDropDownButtonWidth); + toolStripSplitButton.DropDownButtonWidth.Should().Be(toolStripSplitButton.TestAccessor.Dynamic.DefaultDropDownButtonWidth); } [WinFormsFact] @@ -99,7 +99,7 @@ public void ToolStripSplitButton_Ctor_Image() toolStripSplitButton.Text.Should().BeNull(); toolStripSplitButton.Image.Should().Be(image); - toolStripSplitButton.DropDownButtonWidth.Should().Be(toolStripSplitButton.TestAccessor().Dynamic.DefaultDropDownButtonWidth); + toolStripSplitButton.DropDownButtonWidth.Should().Be(toolStripSplitButton.TestAccessor.Dynamic.DefaultDropDownButtonWidth); } [WinFormsFact] @@ -110,7 +110,7 @@ public void ToolStripSplitButton_Ctor_String_Image() toolStripSplitButton.Text.Should().Be("Test"); toolStripSplitButton.Image.Should().Be(image); - toolStripSplitButton.DropDownButtonWidth.Should().Be(toolStripSplitButton.TestAccessor().Dynamic.DefaultDropDownButtonWidth); + toolStripSplitButton.DropDownButtonWidth.Should().Be(toolStripSplitButton.TestAccessor.Dynamic.DefaultDropDownButtonWidth); } [WinFormsFact] @@ -124,7 +124,7 @@ public void ToolStripSplitButton_Ctor_String_Image_EventHandler() toolStripSplitButton.Text.Should().Be("Test"); toolStripSplitButton.Image.Should().Be(image); - toolStripSplitButton.DropDownButtonWidth.Should().Be(toolStripSplitButton.TestAccessor().Dynamic.DefaultDropDownButtonWidth); + toolStripSplitButton.DropDownButtonWidth.Should().Be(toolStripSplitButton.TestAccessor.Dynamic.DefaultDropDownButtonWidth); toolStripSplitButton.PerformClick(); clickInvoked.Should().BeTrue(); @@ -142,7 +142,7 @@ public void ToolStripSplitButton_Ctor_String_Image_EventHandler_Name() toolStripSplitButton.Text.Should().Be("Test"); toolStripSplitButton.Image.Should().Be(image); toolStripSplitButton.Name.Should().Be("TestButton"); - toolStripSplitButton.DropDownButtonWidth.Should().Be(toolStripSplitButton.TestAccessor().Dynamic.DefaultDropDownButtonWidth); + toolStripSplitButton.DropDownButtonWidth.Should().Be(toolStripSplitButton.TestAccessor.Dynamic.DefaultDropDownButtonWidth); toolStripSplitButton.PerformClick(); clickInvoked.Should().BeTrue(); @@ -160,7 +160,7 @@ public void ToolStripSplitButton_Ctor_String_Image_DropDownItems() toolStripSplitButton.Text.Should().Be("Test"); toolStripSplitButton.Image.Should().Be(image); toolStripSplitButton.DropDownItems.Cast().Should().ContainInOrder(new[] { item1, item2 }); - toolStripSplitButton.DropDownButtonWidth.Should().Be(toolStripSplitButton.TestAccessor().Dynamic.DefaultDropDownButtonWidth); + toolStripSplitButton.DropDownButtonWidth.Should().Be(toolStripSplitButton.TestAccessor.Dynamic.DefaultDropDownButtonWidth); } [WinFormsFact] @@ -185,19 +185,19 @@ public void ToolStripSplitButton_AutoToolTip_Set_GetReturnsExpected(bool value) [WinFormsFact] public void ToolStripSplitButton_ButtonBounds_ReturnsExpected() { - _toolStripSplitButton.ButtonBounds.Should().Be(_toolStripSplitButton.TestAccessor().Dynamic.SplitButtonButton.Bounds); + _toolStripSplitButton.ButtonBounds.Should().Be(_toolStripSplitButton.TestAccessor.Dynamic.SplitButtonButton.Bounds); } [WinFormsFact] public void ToolStripSplitButton_ButtonPressed_ReturnsExpected() { - _toolStripSplitButton.ButtonPressed.Should().Be(_toolStripSplitButton.TestAccessor().Dynamic.SplitButtonButton.Pressed); + _toolStripSplitButton.ButtonPressed.Should().Be(_toolStripSplitButton.TestAccessor.Dynamic.SplitButtonButton.Pressed); } [WinFormsFact] public void ToolStripSplitButton_ButtonSelected_ReturnsExpected() { - _toolStripSplitButton.ButtonSelected.Should().Be(_toolStripSplitButton.TestAccessor().Dynamic.SplitButtonButton.Selected); + _toolStripSplitButton.ButtonSelected.Should().Be(_toolStripSplitButton.TestAccessor.Dynamic.SplitButtonButton.Selected); } [WinFormsFact] @@ -337,7 +337,7 @@ public void ToolStripSplitButton_OnButtonClick_TriggersButtonClickEvent() bool eventTriggered = false; _toolStripSplitButton.ButtonClick += (sender, e) => eventTriggered = true; - _toolStripSplitButton.TestAccessor().Dynamic.OnButtonClick(EventArgs.Empty); + _toolStripSplitButton.TestAccessor.Dynamic.OnButtonClick(EventArgs.Empty); eventTriggered.Should().BeTrue(); } @@ -350,7 +350,7 @@ public void ToolStripSplitButton_OnButtonClick_RoutesClickToDefaultItem() defaultItem.Click += (sender, e) => eventTriggered = true; _toolStripSplitButton.DefaultItem = defaultItem; - _toolStripSplitButton.TestAccessor().Dynamic.OnButtonClick(EventArgs.Empty); + _toolStripSplitButton.TestAccessor.Dynamic.OnButtonClick(EventArgs.Empty); eventTriggered.Should().BeTrue(); } @@ -412,7 +412,7 @@ public void ToolStripSplitButton_ResetDropDownButtonWidth_SetsToDefault(int init _toolStripSplitButton.ResetDropDownButtonWidth(); - _toolStripSplitButton.DropDownButtonWidth.Should().Be(_toolStripSplitButton.TestAccessor().Dynamic.DefaultDropDownWidth); + _toolStripSplitButton.DropDownButtonWidth.Should().Be(_toolStripSplitButton.TestAccessor.Dynamic.DefaultDropDownWidth); } [WinFormsFact] diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripSplitStackDragDropHandlerTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripSplitStackDragDropHandlerTests.cs index b44c8190d17..8a6ca9f3e6c 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripSplitStackDragDropHandlerTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripSplitStackDragDropHandlerTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Drawing; @@ -114,7 +114,7 @@ public void OnDropItem_AddsItemWhenToolStripIsEmpty() using ToolStripButton newToolStripItem = new(); Point point = new(10, 10); - _toolStripSplitStackDragDropHandler.TestAccessor().Dynamic.OnDropItem(newToolStripItem, point); + _toolStripSplitStackDragDropHandler.TestAccessor.Dynamic.OnDropItem(newToolStripItem, point); _toolStrip.Items[0].Should().Be(newToolStripItem); } @@ -123,7 +123,7 @@ public void OnDropItem_AddsItemWhenToolStripIsEmpty() public void ShowItemDropPoint_ReturnsTrue_WhenToolStripIsEmpty() { Point point = new(10, 10); - var result = _toolStripSplitStackDragDropHandler.TestAccessor().Dynamic.ShowItemDropPoint(point); + var result = _toolStripSplitStackDragDropHandler.TestAccessor.Dynamic.ShowItemDropPoint(point); ((bool)result).Should().BeTrue(); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripStatusLabelTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripStatusLabelTests.cs index ded6c1398c8..4eb92d4670c 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripStatusLabelTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripStatusLabelTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Drawing; @@ -59,7 +59,7 @@ public void ToolStripStatusLabel_ConstructorWithTextImageAndOnClick_InitializesC label.Text.Should().Be(sampleText); label.Image.Should().Be(sampleImage); - label.TestAccessor().Dynamic.OnClick(null); + label.TestAccessor.Dynamic.OnClick(null); clickInvoked.Should().BeTrue(); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripTests.Rendering.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripTests.Rendering.cs index bd3051155d8..157f4add056 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripTests.Rendering.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripTests.Rendering.cs @@ -30,7 +30,7 @@ public void ToolStrip_RendersBackgroundCorrectly() Rectangle bounds = toolStrip.Bounds; using PaintEventArgs e = new(emf, bounds); - toolStrip.TestAccessor().Dynamic.OnPaintBackground(e); + toolStrip.TestAccessor.Dynamic.OnPaintBackground(e); Rectangle bitBltBounds = new(bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripTests.cs index 399936d9432..ed7bfffc426 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripTests.cs @@ -4817,7 +4817,7 @@ public void ToolStrip_GetNextItem_ReturnsForwardItem(RightToLeft rightToLeft, bo if (useTabKey) { - toolStrip.TestAccessor().Dynamic.LastKeyData = Keys.Tab; + toolStrip.TestAccessor.Dynamic.LastKeyData = Keys.Tab; } ToolStripItem actual = toolStrip.GetNextItem(toolStrip.Items[0], ArrowDirection.Right); @@ -4838,7 +4838,7 @@ public void ToolStrip_GetNextItem_CyclesForwardExpected(RightToLeft rightToLeft, if (useTabKey) { - toolStrip.TestAccessor().Dynamic.LastKeyData = Keys.Tab; + toolStrip.TestAccessor.Dynamic.LastKeyData = Keys.Tab; } ToolStripItem nextToolStripItem1 = toolStrip.GetNextItem(toolStripButton1, ArrowDirection.Right); @@ -4863,7 +4863,7 @@ public void ToolStrip_GetNextItem_ReturnsBackwardItem(RightToLeft rightToLeft, b if (useTabKey) { - toolStrip.TestAccessor().Dynamic.LastKeyData = Keys.Shift | Keys.Tab; + toolStrip.TestAccessor.Dynamic.LastKeyData = Keys.Shift | Keys.Tab; } ToolStripItem actual = toolStrip.GetNextItem(toolStrip.Items[0], ArrowDirection.Left); @@ -4884,7 +4884,7 @@ public void ToolStrip_GetNextItem_CyclesBackwardExpected(RightToLeft rightToLeft if (useTabKey) { - toolStrip.TestAccessor().Dynamic.LastKeyData = Keys.Shift | Keys.Tab; + toolStrip.TestAccessor.Dynamic.LastKeyData = Keys.Shift | Keys.Tab; } ToolStripItem previousToolStripItem1 = toolStrip.GetNextItem(toolStripButton1, ArrowDirection.Left); @@ -7296,7 +7296,7 @@ public void ToolStrip_GetNextItem_ItemsBackwardExpected(ToolStripLayoutStyle too using ToolStripMenuItem toolStripMenuItem3 = new(); toolStrip.Items.AddRange((ToolStripItem[])[toolStripMenuItem1, toolStripMenuItem2, toolStripMenuItem3]); - toolStrip.TestAccessor().Dynamic.LastKeyData = Keys.Left; + toolStrip.TestAccessor.Dynamic.LastKeyData = Keys.Left; ToolStripItem previousToolStripItem1 = toolStrip.GetNextItem(start: null, ArrowDirection.Left); Assert.Equal(toolStrip.Items[2], previousToolStripItem1); @@ -7313,7 +7313,7 @@ public async Task ToolStrip_MouseHoverTimerStartSuccess() using MenuStrip menuStrip = new(); using ToolStripItem toolStripItem = menuStrip.Items.Add("toolStripItem"); toolStripItem.MouseHover += (sender, e) => cancellationTokenSource.Cancel(); - ((MouseHoverTimer)menuStrip.TestAccessor().Dynamic.MouseHoverTimer).Start(toolStripItem); + ((MouseHoverTimer)menuStrip.TestAccessor.Dynamic.MouseHoverTimer).Start(toolStripItem); await Assert.ThrowsAsync(() => Task.Delay(SystemInformation.MouseHoverTime * 2, cancellationTokenSource.Token)); } @@ -7322,7 +7322,7 @@ public void ToolStrip_MouseHoverTimer_ItemDispose() { WeakReference currentItemWR; using MenuStrip menuStrip = new(); - MouseHoverTimer mouseHoverTimer = (MouseHoverTimer)menuStrip.TestAccessor().Dynamic.MouseHoverTimer; + MouseHoverTimer mouseHoverTimer = (MouseHoverTimer)menuStrip.TestAccessor.Dynamic.MouseHoverTimer; TimerStartAndItemDispose(); GC.Collect(); GC.WaitForPendingFinalizers(); @@ -7334,7 +7334,7 @@ void TimerStartAndItemDispose() { using ToolStripItem toolStripItem = menuStrip.Items.Add("toolStripItem"); mouseHoverTimer.Start(toolStripItem); - currentItemWR = mouseHoverTimer.TestAccessor().Dynamic._currentItem; + currentItemWR = mouseHoverTimer.TestAccessor.Dynamic._currentItem; Assert.True(currentItemWR.TryGetTarget(out _)); } } @@ -7383,7 +7383,7 @@ public void ToolStrip_ResetGripMargin_SetsGripMarginToDefault() var defaultMargin = toolStrip.Grip.DefaultMargin; toolStrip.GripMargin = new Padding(10, 10, 10, 10); - toolStrip.TestAccessor().Dynamic.ResetGripMargin(); + toolStrip.TestAccessor.Dynamic.ResetGripMargin(); toolStrip.GripMargin.Should().Be(defaultMargin); } @@ -7422,18 +7422,18 @@ public void ToolStrip_ShouldSerializeLayoutStyle_Invoke_ReturnsExpected() public void ToolStrip_ShouldSerializeGripMargin_Invoke_ReturnsExpected() { using ToolStrip toolStrip = new() { GripMargin = new Padding(1) }; - ((bool)toolStrip.TestAccessor().Dynamic.ShouldSerializeGripMargin()).Should().BeTrue(); + ((bool)toolStrip.TestAccessor.Dynamic.ShouldSerializeGripMargin()).Should().BeTrue(); - var defaultGripMargin = (Padding)toolStrip.TestAccessor().Dynamic.DefaultGripMargin; + var defaultGripMargin = (Padding)toolStrip.TestAccessor.Dynamic.DefaultGripMargin; toolStrip.GripMargin = defaultGripMargin; - ((bool)toolStrip.TestAccessor().Dynamic.ShouldSerializeGripMargin()).Should().BeFalse(); + ((bool)toolStrip.TestAccessor.Dynamic.ShouldSerializeGripMargin()).Should().BeFalse(); } public void Dispose() { // LastKeyData is a static state read and written by tests. // To ensure tests are isolated correctly, we reset it after each test. - typeof(ToolStrip).TestAccessor().Dynamic.LastKeyData = Keys.None; + typeof(ToolStrip).TestAccessor.Dynamic.LastKeyData = Keys.None; } private class SubAxHost : AxHost diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripTextBoxTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripTextBoxTests.cs index c7ee42340ee..0267372e261 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripTextBoxTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStripTextBoxTests.cs @@ -125,7 +125,7 @@ public void ToolStripTextBox_HandleTextBoxTextAlignChanged_RaisesEvent() { bool eventRaised = false; _toolStripTextBox.TextBoxTextAlignChanged += (sender, e) => eventRaised = true; - _toolStripTextBox.TestAccessor().Dynamic.HandleTextBoxTextAlignChanged(null, EventArgs.Empty); + _toolStripTextBox.TestAccessor.Dynamic.HandleTextBoxTextAlignChanged(null, EventArgs.Empty); eventRaised.Should().BeTrue(); } @@ -135,7 +135,7 @@ public void ToolStripTextBox_OnAcceptsTabChanged_RaisesEvent() { bool eventRaised = false; _toolStripTextBox.AcceptsTabChanged += (sender, e) => eventRaised = true; - _toolStripTextBox.TestAccessor().Dynamic.OnAcceptsTabChanged(EventArgs.Empty); + _toolStripTextBox.TestAccessor.Dynamic.OnAcceptsTabChanged(EventArgs.Empty); eventRaised.Should().BeTrue(); } @@ -145,7 +145,7 @@ public void ToolStripTextBox_OnBorderStyleChanged_RaisesEvent() { bool eventRaised = false; _toolStripTextBox.BorderStyleChanged += (sender, e) => eventRaised = true; - _toolStripTextBox.TestAccessor().Dynamic.OnBorderStyleChanged(EventArgs.Empty); + _toolStripTextBox.TestAccessor.Dynamic.OnBorderStyleChanged(EventArgs.Empty); eventRaised.Should().BeTrue(); } @@ -155,7 +155,7 @@ public void ToolStripTextBox_OnHideSelectionChanged_RaisesEvent() { bool eventRaised = false; _toolStripTextBox.HideSelectionChanged += (sender, e) => eventRaised = true; - _toolStripTextBox.TestAccessor().Dynamic.OnHideSelectionChanged(EventArgs.Empty); + _toolStripTextBox.TestAccessor.Dynamic.OnHideSelectionChanged(EventArgs.Empty); eventRaised.Should().BeTrue(); } @@ -165,7 +165,7 @@ public void ToolStripTextBox_OnModifiedChanged_RaisesEvent() { bool eventRaised = false; _toolStripTextBox.ModifiedChanged += (sender, e) => eventRaised = true; - _toolStripTextBox.TestAccessor().Dynamic.OnModifiedChanged(EventArgs.Empty); + _toolStripTextBox.TestAccessor.Dynamic.OnModifiedChanged(EventArgs.Empty); eventRaised.Should().BeTrue(); } @@ -175,7 +175,7 @@ public void ToolStripTextBox_OnMultilineChanged_RaisesEvent() { bool eventRaised = false; _toolStripTextBox.MultilineChanged += (sender, e) => eventRaised = true; - _toolStripTextBox.TestAccessor().Dynamic.OnMultilineChanged(EventArgs.Empty); + _toolStripTextBox.TestAccessor.Dynamic.OnMultilineChanged(EventArgs.Empty); eventRaised.Should().BeTrue(); } @@ -184,11 +184,11 @@ public void ToolStripTextBox_OnMultilineChanged_RaisesEvent() public void ToolStripTextBox_ShouldSerializeFont_ReturnsExpected() { _toolStripTextBox.Font = ToolStripManager.DefaultFont; - bool result = _toolStripTextBox.TestAccessor().Dynamic.ShouldSerializeFont(); + bool result = _toolStripTextBox.TestAccessor.Dynamic.ShouldSerializeFont(); result.Should().BeFalse(); _toolStripTextBox.Font = new Font("Arial", 8.25f); - result = _toolStripTextBox.TestAccessor().Dynamic.ShouldSerializeFont(); + result = _toolStripTextBox.TestAccessor.Dynamic.ShouldSerializeFont(); result.Should().BeTrue(); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolTipTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolTipTests.cs index 4c1dce3afaa..ae99fe6ab56 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolTipTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolTipTests.cs @@ -900,7 +900,7 @@ public unsafe void ToolTip_TTTOOLINFOW_Struct_Size_IsExpected() { TTTOOLINFOW toolInfo = default; int size = (int)&toolInfo.lParam - (int)&toolInfo + sizeof(LPARAM); - int expected = (int)default(ToolInfoWrapper).TestAccessor().Dynamic.TTTOOLINFO_V2_Size; + int expected = (int)default(ToolInfoWrapper).TestAccessor.Dynamic.TTTOOLINFO_V2_Size; size.Should().Be(expected); } diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/TreeNodeTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/TreeNodeTests.cs index 1ac9c3a65b8..6fc60ea9d19 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/TreeNodeTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/TreeNodeTests.cs @@ -4630,8 +4630,8 @@ public void TreeNode_InvokeAdd_WithoutTree_DoesNotAddNodeToTrackList() TreeNode treeSubNode = new(); treeNode.Nodes.Add(treeSubNode); - Assert.False((bool)KeyboardToolTipStateMachine.Instance.TestAccessor().Dynamic.IsToolTracked(treeNode)); - Assert.False((bool)KeyboardToolTipStateMachine.Instance.TestAccessor().Dynamic.IsToolTracked(treeSubNode)); + Assert.False((bool)KeyboardToolTipStateMachine.Instance.TestAccessor.Dynamic.IsToolTracked(treeNode)); + Assert.False((bool)KeyboardToolTipStateMachine.Instance.TestAccessor.Dynamic.IsToolTracked(treeSubNode)); } [WinFormsTheory] diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/TreeViewImageIndexConverterTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/TreeViewImageIndexConverterTests.cs index 5d00f529ae5..2ae891d082e 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/TreeViewImageIndexConverterTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/TreeViewImageIndexConverterTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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; @@ -13,7 +13,7 @@ public class TreeViewImageIndexConverterTests [Fact] public void TreeViewImageIndexConverter_IncludeNoneAsStandardValue_ReturnsFalse() { - Assert.False(new TreeViewImageIndexConverter().TestAccessor().Dynamic.IncludeNoneAsStandardValue); + Assert.False(new TreeViewImageIndexConverter().TestAccessor.Dynamic.IncludeNoneAsStandardValue); } [Fact] diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/TreeViewTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/TreeViewTests.cs index d00f093de4e..230d7b81490 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/TreeViewTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/TreeViewTests.cs @@ -6657,7 +6657,7 @@ public void TreeView_InvokeAdd_AddNodeToTrackList(bool showNodeToolTips) TreeNode treeNode = new(); treeView.Nodes.Add(treeNode); - Assert.True(KeyboardToolTipStateMachine.Instance.TestAccessor().IsToolTracked(treeNode)); + Assert.True(KeyboardToolTipStateMachine.Instance.TestAccessor.IsToolTracked(treeNode)); treeView.Nodes.Remove(treeNode); } @@ -6671,7 +6671,7 @@ public void TreeView_InvokeAddRange_AddNodesToTrackList(bool showNodeToolTips) TreeNode treeNode1 = new(); TreeNode treeNode2 = new(); TreeNode treeNode3 = new(); - var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor(); + var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor; treeView.Nodes.AddRange([treeNode1, treeNode2, treeNode3]); @@ -6690,7 +6690,7 @@ public void TreeView_InvokeAdd_AddSubNodeToTrackList(bool showNodeToolTips) TreeNode treeNode = new(); TreeNode treeSubNodeLevel1 = new(); TreeNode treeSubNodeLevel2 = new(); - var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor(); + var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor; treeView.Nodes.Add(treeNode); treeNode.Nodes.Add(treeSubNodeLevel1); treeSubNodeLevel1.Nodes.Add(treeSubNodeLevel2); @@ -6711,7 +6711,7 @@ public void TreeView_InvokeAdd_AddNodeAndSubNodeToTrackList(bool showNodeToolTip TreeNode treeNode = new(); TreeNode treeSubNodeLevel1 = new(); TreeNode treeSubNodeLevel2 = new(); - var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor(); + var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor; treeNode.Nodes.Add(treeSubNodeLevel1); treeSubNodeLevel1.Nodes.Add(treeSubNodeLevel2); treeView.Nodes.Add(treeNode); @@ -6730,7 +6730,7 @@ public void TreeView_InvokeRemove_RemoveNodeFromTrackList(bool showNodeToolTips) using TreeView treeView = new(); treeView.ShowNodeToolTips = showNodeToolTips; TreeNode treeNode = new(); - var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor(); + var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor; treeView.Nodes.Add(treeNode); Assert.True(accessor.IsToolTracked(treeNode)); @@ -6750,7 +6750,7 @@ public void TreeView_InvokeRemove_RemoveNodeAndSubNodesFromTrackList(bool showNo TreeNode treeNode = new(); TreeNode treeSubNodeLevel1 = new(); TreeNode treeSubNodeLevel2 = new(); - var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor(); + var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor; treeNode.Nodes.Add(treeSubNodeLevel1); treeSubNodeLevel1.Nodes.Add(treeSubNodeLevel2); treeView.Nodes.Add(treeNode); @@ -6777,7 +6777,7 @@ public void TreeView_InvokeInsert_AddNodeToTrackList(bool showNodeToolTips) treeView.Nodes.Insert(0, treeNode); - Assert.True(KeyboardToolTipStateMachine.Instance.TestAccessor().IsToolTracked(treeNode)); + Assert.True(KeyboardToolTipStateMachine.Instance.TestAccessor.IsToolTracked(treeNode)); } [WinFormsTheory] @@ -6790,7 +6790,7 @@ public void TreeView_InvokeDispose_RemoveNodesFromTrackList(bool showNodeToolTip TreeNode treeNode = new(); TreeNode treeSubNodeLevel1 = new(); TreeNode treeSubNodeLevel2 = new(); - var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor(); + var accessor = KeyboardToolTipStateMachine.Instance.TestAccessor; treeNode.Nodes.Add(treeSubNodeLevel1); treeSubNodeLevel1.Nodes.Add(treeSubNodeLevel2); treeView.Nodes.Add(treeNode); @@ -6814,7 +6814,7 @@ public void TreeView_Invokes_SetToolTip_IfExternalToolTipIsSet() using ToolTip toolTip = new(); treeView.CreateControl(); - dynamic listViewDynamic = treeView.TestAccessor().Dynamic; + dynamic listViewDynamic = treeView.TestAccessor.Dynamic; string actual = listViewDynamic._controlToolTipText; Assert.Null(actual); @@ -7470,7 +7470,7 @@ public void TreeView_ResetIndent_Invoke_Success() using TreeView treeView = new(); treeView.Indent = 10; - var accessor = treeView.TestAccessor(); + var accessor = treeView.TestAccessor; accessor.Dynamic.ResetIndent(); treeView.Indent.Should().Be(19); @@ -7482,7 +7482,7 @@ public void TreeView_ResetItemHeight_Invoke_Success() using TreeView treeView = new(); treeView.ItemHeight = 10; - var accessor = treeView.TestAccessor(); + var accessor = treeView.TestAccessor; accessor.Dynamic.ResetItemHeight(); treeView.ItemHeight.Should().Be(19); @@ -7493,7 +7493,7 @@ public void TreeView_ShouldSerializeIndent_Invoke_ReturnsExpected() { using TreeView treeView = new(); - var accessor = treeView.TestAccessor(); + var accessor = treeView.TestAccessor; bool result = accessor.Dynamic.ShouldSerializeIndent(); result.Should().BeFalse(); @@ -7509,7 +7509,7 @@ public void TreeView_ShouldSerializeItemHeight_Invoke_ReturnsExpected() { using TreeView treeView = new(); - var accessor = treeView.TestAccessor(); + var accessor = treeView.TestAccessor; bool result = accessor.Dynamic.ShouldSerializeItemHeight(); result.Should().BeFalse(); diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/WebBrowserContainerTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/WebBrowserContainerTests.cs index 71a330ad913..687f021f57b 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/WebBrowserContainerTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/WebBrowserContainerTests.cs @@ -35,7 +35,7 @@ public void RemoveControl_RemovesControlFromCache() Name = "controlToRemove" }; - HashSet containerCache = container.TestAccessor().Dynamic._containerCache; + HashSet containerCache = container.TestAccessor.Dynamic._containerCache; container.AddControl(control); containerCache.Contains(control).Should().BeTrue(); diff --git a/src/test/unit/System.Windows.Forms/TestAccessorTests.cs b/src/test/unit/System.Windows.Forms/TestAccessorTests.cs index 4097ace62ae..f19de0cc377 100644 --- a/src/test/unit/System.Windows.Forms/TestAccessorTests.cs +++ b/src/test/unit/System.Windows.Forms/TestAccessorTests.cs @@ -13,7 +13,7 @@ public class TestAccessorTests public void TestAccessor_DynamicAccess_InstanceField() { PrivateTestClass testClass = new(); - dynamic access = testClass.TestAccessor().Dynamic; + dynamic access = testClass.TestAccessor.Dynamic; access._integer = 5; Assert.Equal(5, access._integer); } @@ -23,18 +23,18 @@ public void TestAccessor_DynamicAccess_StaticField() { // Don't need to create an instance to access a static, can // use typeof instead - dynamic access = typeof(PrivateTestClass).TestAccessor().Dynamic; + dynamic access = typeof(PrivateTestClass).TestAccessor.Dynamic; access.s_integer = 16; Assert.Equal(16, access.s_integer); // Attempt using an instance as well PrivateTestClass testClass = new(); - access = testClass.TestAccessor().Dynamic; + access = testClass.TestAccessor.Dynamic; access.s_integer = 18; Assert.Equal(18, access.s_integer); // Try the static class version - access = typeof(PrivateStaticTestClass).TestAccessor().Dynamic; + access = typeof(PrivateStaticTestClass).TestAccessor.Dynamic; access.s_integer = 21; Assert.Equal(21, access.s_integer); } @@ -43,7 +43,7 @@ public void TestAccessor_DynamicAccess_StaticField() public void TestAccessor_DynamicAccess_ReadOnlyInstanceField() { PrivateTestClass testClass = new(); - dynamic access = testClass.TestAccessor().Dynamic; + dynamic access = testClass.TestAccessor.Dynamic; access._readOnlyInteger = 7; Assert.Equal(7, access._readOnlyInteger); } @@ -52,7 +52,7 @@ public void TestAccessor_DynamicAccess_ReadOnlyInstanceField() public void TestAccessor_DynamicAccess_ObjectInstanceField() { PrivateTestClass testClass = new(); - dynamic access = testClass.TestAccessor().Dynamic; + dynamic access = testClass.TestAccessor.Dynamic; List list = access._list; Assert.NotNull(list); Assert.Single(list); @@ -63,7 +63,7 @@ public void TestAccessor_DynamicAccess_ObjectInstanceField() public void TestAccessor_DynamicAccess_InstanceProperty() { PrivateTestClass testClass = new(); - dynamic access = testClass.TestAccessor().Dynamic; + dynamic access = testClass.TestAccessor.Dynamic; access.Long = 1970; Assert.Equal(1970, access.Long); } @@ -72,17 +72,17 @@ public void TestAccessor_DynamicAccess_InstanceProperty() public void TestAccessor_DynamicAccess_StaticProperty() { PrivateTestClass testClass = new(); - dynamic access = testClass.TestAccessor().Dynamic; + dynamic access = testClass.TestAccessor.Dynamic; access.Int = 1989; Assert.Equal(1989, access.Int); // Now try without an instance - access = typeof(PrivateTestClass).TestAccessor().Dynamic; + access = typeof(PrivateTestClass).TestAccessor.Dynamic; access.Int = 1988; Assert.Equal(1988, access.Int); // Try the static class version - access = typeof(PrivateStaticTestClass).TestAccessor().Dynamic; + access = typeof(PrivateStaticTestClass).TestAccessor.Dynamic; access.Int = 1991; Assert.Equal(1991, access.Int); } @@ -91,7 +91,7 @@ public void TestAccessor_DynamicAccess_StaticProperty() public void TestAccessor_DynamicAccess_PublicField() { PrivateTestClass testClass = new(); - dynamic access = testClass.TestAccessor().Dynamic; + dynamic access = testClass.TestAccessor.Dynamic; // If the API is public we want to access "normally", so we prevent this. Assert.Throws(() => access.PublicField = 1918); @@ -101,7 +101,7 @@ public void TestAccessor_DynamicAccess_PublicField() public void TestAccessor_DynamicAccess_PublicProperty() { PrivateTestClass testClass = new(); - dynamic access = testClass.TestAccessor().Dynamic; + dynamic access = testClass.TestAccessor.Dynamic; // If the API is public we want to access "normally", so we prevent this. Assert.Throws(() => access.PublicProperty = "What?"); @@ -111,15 +111,15 @@ public void TestAccessor_DynamicAccess_PublicProperty() public void TestAccessor_DynamicAccess_InstanceMethod() { PrivateTestClass testClass = new(); - Assert.Equal(4, testClass.TestAccessor().Dynamic.ToStringLength(2001)); - Assert.Equal(7, testClass.TestAccessor().Dynamic.ToStringLength("Flubber")); + Assert.Equal(4, testClass.TestAccessor.Dynamic.ToStringLength(2001)); + Assert.Equal(7, testClass.TestAccessor.Dynamic.ToStringLength("Flubber")); } [Fact] public void TestAccessor_FuncDelegateAccess_InstanceMethod() { PrivateTestClass testClass = new(); - ITestAccessor accessor = testClass.TestAccessor(); + ITestAccessor accessor = testClass.TestAccessor; Assert.Equal(4, accessor.CreateDelegate>("ToStringLength")(2001)); Assert.Equal(7, accessor.CreateDelegate>("ToStringLength")("Flubber")); } @@ -128,7 +128,7 @@ public void TestAccessor_FuncDelegateAccess_InstanceMethod() public void TestAccessor_NamedDelegateAccess_InstanceMethod() { PrivateTestClass testClass = new(); - ITestAccessor accessor = testClass.TestAccessor(); + ITestAccessor accessor = testClass.TestAccessor; Assert.Equal(5, accessor.CreateDelegate()("25624")); } @@ -136,27 +136,27 @@ public void TestAccessor_NamedDelegateAccess_InstanceMethod() public void TestAccessor_DynamicAccess_StaticMethod() { PrivateTestClass testClass = new(); - Assert.Equal(2, testClass.TestAccessor().Dynamic.AddOne(1)); + Assert.Equal(2, testClass.TestAccessor.Dynamic.AddOne(1)); // Hit the static class version - Assert.Equal(3, typeof(PrivateStaticTestClass).TestAccessor().Dynamic.AddOne(2)); + Assert.Equal(3, typeof(PrivateStaticTestClass).TestAccessor.Dynamic.AddOne(2)); } [Fact] public void TestAccessor_FuncDelegateAccess_StaticMethod() { PrivateTestClass testClass = new(); - Assert.Equal(2000, testClass.TestAccessor().CreateDelegate>("AddOne")(1999)); + Assert.Equal(2000, testClass.TestAccessor.CreateDelegate>("AddOne")(1999)); // Hit the static class version - Assert.Equal(21, typeof(PrivateStaticTestClass).TestAccessor().CreateDelegate>("AddOne")(20)); + Assert.Equal(21, typeof(PrivateStaticTestClass).TestAccessor.CreateDelegate>("AddOne")(20)); } [Fact] public void TestAccessor_DynamicAccess_UpcastType() { A a = new B(); - dynamic accessor = a.TestAccessor().Dynamic; + dynamic accessor = a.TestAccessor.Dynamic; accessor._b = 3; Assert.Equal(3, accessor._b); } @@ -165,7 +165,7 @@ public void TestAccessor_DynamicAccess_UpcastType() public void TestAccessor_DynamicAccess_BaseClassField() { A a = new B(); - dynamic accessor = a.TestAccessor().Dynamic; + dynamic accessor = a.TestAccessor.Dynamic; accessor._a = 5; Assert.Equal(5, accessor._a); } @@ -174,7 +174,7 @@ public void TestAccessor_DynamicAccess_BaseClassField() public void TestAccessor_DynamicAccess_BaseClassMethod() { A a = new B(); - dynamic accessor = a.TestAccessor().Dynamic; + dynamic accessor = a.TestAccessor.Dynamic; Assert.Equal(42, (int)accessor.AMethod()); } diff --git a/src/test/unit/System.Windows.Forms/TextBoxBaseTests.cs b/src/test/unit/System.Windows.Forms/TextBoxBaseTests.cs index dab6165267f..47cfba21256 100644 --- a/src/test/unit/System.Windows.Forms/TextBoxBaseTests.cs +++ b/src/test/unit/System.Windows.Forms/TextBoxBaseTests.cs @@ -757,12 +757,12 @@ public void TextBoxBase_Dispose_ClearsTextProvider() using TextBox control = new(); control.CreateControl(); var textBoxBaseAccessibleObject = (TextBoxBase.TextBoxBaseAccessibleObject)control.AccessibilityObject; - TextBoxBase.TextBoxBaseUiaTextProvider provider = textBoxBaseAccessibleObject.TestAccessor().Dynamic._textProvider; + TextBoxBase.TextBoxBaseUiaTextProvider provider = textBoxBaseAccessibleObject.TestAccessor.Dynamic._textProvider; Assert.IsType(provider); control.Dispose(); - provider = textBoxBaseAccessibleObject.TestAccessor().Dynamic._textProvider; + provider = textBoxBaseAccessibleObject.TestAccessor.Dynamic._textProvider; Assert.Null(provider); } @@ -772,12 +772,12 @@ public void TextBoxBase_RecreateControl_DoesntClearTextProvider() { using TextBox control = new(); control.CreateControl(); - TextBoxBase.TextBoxBaseUiaTextProvider provider = control.AccessibilityObject.TestAccessor().Dynamic._textProvider; + TextBoxBase.TextBoxBaseUiaTextProvider provider = control.AccessibilityObject.TestAccessor.Dynamic._textProvider; Assert.IsType(provider); control.RecreateHandleCore(); - provider = control.AccessibilityObject.TestAccessor().Dynamic._textProvider; + provider = control.AccessibilityObject.TestAccessor.Dynamic._textProvider; // The control's accessible object and its providers shouldn't be cleaned when recreating of the control // because this object and all its providers will continue to be used. diff --git a/src/test/unit/System.Windows.Forms/TextBoxTests.Rendering.cs b/src/test/unit/System.Windows.Forms/TextBoxTests.Rendering.cs index ff658c11542..c0392691d68 100644 --- a/src/test/unit/System.Windows.Forms/TextBoxTests.Rendering.cs +++ b/src/test/unit/System.Windows.Forms/TextBoxTests.Rendering.cs @@ -31,7 +31,7 @@ public void TextBox_Disabled_PlaceholderText_RendersBackgroundCorrectly() using EmfScope emf = new(); DeviceContextState state = new(emf); - textBox.TestAccessor().Dynamic.DrawPlaceholderText(emf.HDC); + textBox.TestAccessor.Dynamic.DrawPlaceholderText(emf.HDC); emf.Validate( state, diff --git a/src/test/unit/System.Windows.Forms/TextBoxTests.cs b/src/test/unit/System.Windows.Forms/TextBoxTests.cs index a0e7d24b2e8..bca56df4083 100644 --- a/src/test/unit/System.Windows.Forms/TextBoxTests.cs +++ b/src/test/unit/System.Windows.Forms/TextBoxTests.cs @@ -386,7 +386,7 @@ public void TextBox_ShouldRenderPlaceHolderText(string text, bool isUserPaint, b { using SubTextBox textBox = new() { PlaceholderText = text, IsUserPaint = isUserPaint, IsFocused = isIsFocused, TextCount = textCount }; - bool result = textBox.TestAccessor().Dynamic.ShouldRenderPlaceHolderText(); + bool result = textBox.TestAccessor.Dynamic.ShouldRenderPlaceHolderText(); Assert.Equal(expected, result); } diff --git a/src/test/util/System.Windows.Forms/AnchorLayoutV2Scope.cs b/src/test/util/System.Windows.Forms/AnchorLayoutV2Scope.cs index bba826fd967..e0765c0f58e 100644 --- a/src/test/util/System.Windows.Forms/AnchorLayoutV2Scope.cs +++ b/src/test/util/System.Windows.Forms/AnchorLayoutV2Scope.cs @@ -34,6 +34,6 @@ public void Dispose() } public static bool GetDefaultValue() => - typeof(LocalAppContextSwitches).TestAccessor() + typeof(LocalAppContextSwitches).TestAccessor .CreateDelegate>("GetSwitchDefaultValue")(WinFormsAppContextSwitchNames.AnchorLayoutV2); } diff --git a/src/test/util/System.Windows.Forms/ApplyParentFontToMenusScope.cs b/src/test/util/System.Windows.Forms/ApplyParentFontToMenusScope.cs index 22907a86edd..ada7d86e67f 100644 --- a/src/test/util/System.Windows.Forms/ApplyParentFontToMenusScope.cs +++ b/src/test/util/System.Windows.Forms/ApplyParentFontToMenusScope.cs @@ -34,6 +34,6 @@ public void Dispose() } public static bool GetDefaultValue() => - typeof(LocalAppContextSwitches).TestAccessor() + typeof(LocalAppContextSwitches).TestAccessor .CreateDelegate>("GetSwitchDefaultValue")(WinFormsAppContextSwitchNames.ApplyParentFontToMenus); } diff --git a/src/test/util/System.Windows.Forms/DataGridViewUIAStartRowCountAtZeroScope.cs b/src/test/util/System.Windows.Forms/DataGridViewUIAStartRowCountAtZeroScope.cs index 96837ed6718..6bbeae1fdae 100644 --- a/src/test/util/System.Windows.Forms/DataGridViewUIAStartRowCountAtZeroScope.cs +++ b/src/test/util/System.Windows.Forms/DataGridViewUIAStartRowCountAtZeroScope.cs @@ -33,6 +33,6 @@ public void Dispose() } public static bool GetDefaultValue() => - typeof(LocalAppContextSwitches).TestAccessor() + typeof(LocalAppContextSwitches).TestAccessor .CreateDelegate>("GetSwitchDefaultValue")(WinFormsAppContextSwitchNames.DataGridViewUIAStartRowCountAtZero); } diff --git a/src/test/util/System.Windows.Forms/NoClientNotificationsScope.cs b/src/test/util/System.Windows.Forms/NoClientNotificationsScope.cs index 305daa6da5d..d547364f0c6 100644 --- a/src/test/util/System.Windows.Forms/NoClientNotificationsScope.cs +++ b/src/test/util/System.Windows.Forms/NoClientNotificationsScope.cs @@ -34,6 +34,6 @@ public void Dispose() } public static bool GetDefaultValue() => - typeof(LocalAppContextSwitches).TestAccessor() + typeof(LocalAppContextSwitches).TestAccessor .CreateDelegate>("GetSwitchDefaultValue")(WinFormsAppContextSwitchNames.NoClientNotifications); } diff --git a/src/test/util/System.Windows.Forms/PropertyGridInternal/SubPropertyGrid.cs b/src/test/util/System.Windows.Forms/PropertyGridInternal/SubPropertyGrid.cs index abe34d3b4b9..5ce6a6f7412 100644 --- a/src/test/util/System.Windows.Forms/PropertyGridInternal/SubPropertyGrid.cs +++ b/src/test/util/System.Windows.Forms/PropertyGridInternal/SubPropertyGrid.cs @@ -16,7 +16,7 @@ namespace System.Windows.Forms.PropertyGridInternal.TestUtilities; { private static MessageId WM_DELAYEDEXECUTION { get; } = PInvoke.RegisterWindowMessage("WinFormsSubPropertyGridDelayedExecution"); - internal PropertyGridView GridView => this.TestAccessor().Dynamic._gridView; + internal PropertyGridView GridView => this.TestAccessor.Dynamic._gridView; [DisallowNull] internal GridEntry? SelectedEntry @@ -64,7 +64,7 @@ public void PopupEditorAndClose(Action? onClosingAction = null) try { PInvokeCore.PostMessage(this, WM_DELAYEDEXECUTION, lParam: GCHandle.ToIntPtr(callbackHandle)); - GridView.PopupEditor(GridView.TestAccessor().Dynamic._selectedRow); + GridView.PopupEditor(GridView.TestAccessor.Dynamic._selectedRow); } finally { diff --git a/src/test/util/System.Windows.Forms/ScaleTopLevelFormMinMaxSizeForDpiScope.cs b/src/test/util/System.Windows.Forms/ScaleTopLevelFormMinMaxSizeForDpiScope.cs index 680465e267a..f45ad173f4a 100644 --- a/src/test/util/System.Windows.Forms/ScaleTopLevelFormMinMaxSizeForDpiScope.cs +++ b/src/test/util/System.Windows.Forms/ScaleTopLevelFormMinMaxSizeForDpiScope.cs @@ -34,6 +34,6 @@ public void Dispose() } public static bool GetDefaultValue() => - typeof(LocalAppContextSwitches).TestAccessor() + typeof(LocalAppContextSwitches).TestAccessor .CreateDelegate>("GetSwitchDefaultValue")(WinFormsAppContextSwitchNames.ScaleTopLevelFormMinMaxSizeForDpi); } diff --git a/src/test/util/System.Windows.Forms/ServicePointManagerCheckCrlScope.cs b/src/test/util/System.Windows.Forms/ServicePointManagerCheckCrlScope.cs index ae74fd34bf4..6145c7d6c5a 100644 --- a/src/test/util/System.Windows.Forms/ServicePointManagerCheckCrlScope.cs +++ b/src/test/util/System.Windows.Forms/ServicePointManagerCheckCrlScope.cs @@ -34,6 +34,6 @@ public void Dispose() } public static bool GetDefaultValue() => - typeof(LocalAppContextSwitches).TestAccessor() + typeof(LocalAppContextSwitches).TestAccessor .CreateDelegate>("GetSwitchDefaultValue")(WinFormsAppContextSwitchNames.ServicePointManagerCheckCrl); } diff --git a/src/test/util/System.Windows.Forms/TreeNodeCollectionAddRangeRespectsSortOrderScope.cs b/src/test/util/System.Windows.Forms/TreeNodeCollectionAddRangeRespectsSortOrderScope.cs index ee4ec700747..52c508b479b 100644 --- a/src/test/util/System.Windows.Forms/TreeNodeCollectionAddRangeRespectsSortOrderScope.cs +++ b/src/test/util/System.Windows.Forms/TreeNodeCollectionAddRangeRespectsSortOrderScope.cs @@ -34,6 +34,6 @@ public void Dispose() } public static bool GetDefaultValue() => - typeof(LocalAppContextSwitches).TestAccessor() + typeof(LocalAppContextSwitches).TestAccessor .CreateDelegate>("GetSwitchDefaultValue")(WinFormsAppContextSwitchNames.TreeNodeCollectionAddRangeRespectsSortOrder); }