Skip to content

Commit

Permalink
Adds code coverage for RichTextBoxActionList
Browse files Browse the repository at this point in the history
Related #10773

## Proposed changes

- Adds code coverage for `RichTextBoxActionList`
- Coverage for the `EditLines()` method could not be added. The
dependent method `EditorServiceContext.EditValue(_designer, Component!,
"Lines")` is static and could not be mocked, and the dialog that opens
during its execution requires manual intervention to close.

## Customer Impact

- None or succinct description

## Regression?

- No

## Risk

- Minimal

## Test methodology

- Unit tests

## Test environment(s)

- 9.0.100-preview.7.24407.12
  • Loading branch information
Ricardo Bossan (BEYONDSOFT CONSULTING INC) (from Dev Box) committed Sep 13, 2024
1 parent 935f877 commit ad6f07e
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#nullable enable

namespace System.Windows.Forms.Design.Tests;

public sealed class RichTextBoxActionListTests
{
[Fact]
public void GetSortedActions_WithNull_ThrowsException()
{
Action action = () => new RichTextBoxActionList(null!);
action.Should().Throw<Exception>();
}

[Fact]
public void GetSortedActions_WithDesigner_GetsCorrectItemsCount()
{
using RichTextBoxDesigner designer = new();
using RichTextBox richTextBox = new();
designer.Initialize(richTextBox);
var actionList = new RichTextBoxActionList(designer);

actionList.GetSortedActionItems().Count.Should().Be(1);
}
}

0 comments on commit ad6f07e

Please sign in to comment.