Skip to content

Commit

Permalink
Add ComboBoxDesigner tests (#10772)
Browse files Browse the repository at this point in the history
  • Loading branch information
gpetrou authored Jan 31, 2024
1 parent 843bbc5 commit d152b3c
Showing 1 changed file with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace System.Windows.Forms.Design.Tests.System.Windows.Forms.Design;

public sealed class ComboBoxDesignerTests
{
[Fact]
public void AutoResizeHandles_WithInitialize_ShouldBeTrue()
{
using ComboBoxDesigner comboBoxDesigner = new();
using ComboBox comboBox = new();
comboBoxDesigner.Initialize(comboBox);

comboBoxDesigner.AutoResizeHandles.Should().BeTrue();
}

[Fact]
public void SnapLines_WithDefaultComboBox_ShouldReturnExpectedCount()
{
using ComboBoxDesigner comboBoxDesigner = new();
using ComboBox comboBox = new();
comboBoxDesigner.Initialize(comboBox);

comboBoxDesigner.SnapLines.Count.Should().Be(9);
}

[Fact]
public void SelectionRules_WithDefaultComboBox_ShouldThrowNullReferenceException()
{
using ComboBoxDesigner comboBoxDesigner = new();
using ComboBox comboBox = new();
comboBoxDesigner.Initialize(comboBox);

Action action = () => _ = comboBoxDesigner.SelectionRules;

action.Should().ThrowExactly<NullReferenceException>();
}

[Fact]
public void ActionLists_WithDefaultComboBox_ShouldReturnExpectedCount()
{
using ComboBoxDesigner comboBoxDesigner = new();
using ComboBox comboBox = new();
comboBoxDesigner.Initialize(comboBox);

comboBoxDesigner.ActionLists.Count.Should().Be(1);
}
}

0 comments on commit d152b3c

Please sign in to comment.