|
| 1 | +// Licensed to the .NET Foundation under one or more agreements. |
| 2 | +// The .NET Foundation licenses this file to you under the MIT license. |
| 3 | + |
| 4 | +using System.Collections; |
| 5 | + |
| 6 | +namespace System.Windows.Forms.Design.Tests; |
| 7 | + |
| 8 | +public class ButtonBaseDesignerTests |
| 9 | +{ |
| 10 | + [Fact] |
| 11 | + public void ButtonBaseDesigner_Constructor_InitializesProperties() |
| 12 | + { |
| 13 | + using ButtonBaseDesigner buttonBaseDesigner = new(); |
| 14 | + using Button button = new(); |
| 15 | + buttonBaseDesigner.Initialize(button); |
| 16 | + bool autoResizeHandles = buttonBaseDesigner.AutoResizeHandles; |
| 17 | + |
| 18 | + buttonBaseDesigner.Should().NotBeNull(); |
| 19 | + autoResizeHandles.Should().Be(true); |
| 20 | + } |
| 21 | + |
| 22 | + public static IEnumerable<object[]> IDictionary_TestData() |
| 23 | + { |
| 24 | + yield return new object[] { null }; |
| 25 | + yield return new object[] { new Dictionary<string, object>() }; |
| 26 | + } |
| 27 | + |
| 28 | + [Theory] |
| 29 | + [MemberData(nameof(IDictionary_TestData))] |
| 30 | + public void ButtonBaseDesigner_InitializeNewComponent_WithDefaultButton(IDictionary defaultValues) |
| 31 | + { |
| 32 | + using ButtonBaseDesigner buttonBaseDesigner = new(); |
| 33 | + using Button button = new(); |
| 34 | + |
| 35 | + buttonBaseDesigner.Initialize(button); |
| 36 | + buttonBaseDesigner.InitializeNewComponent(defaultValues); |
| 37 | + } |
| 38 | + |
| 39 | + [Fact] |
| 40 | + public void ButtonBaseDesigner_SnapLinesWithDefaultButton_ShouldReturnExpectedCount() |
| 41 | + { |
| 42 | + using ButtonBaseDesigner buttonBaseDesigner = new(); |
| 43 | + using Button button = new(); |
| 44 | + buttonBaseDesigner.Initialize(button); |
| 45 | + |
| 46 | + buttonBaseDesigner.SnapLines.Count.Should().Be(9); |
| 47 | + } |
| 48 | +} |
0 commit comments