-
Notifications
You must be signed in to change notification settings - Fork 986
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add code coverage for DataGridViewCellStyleConverter (#12462)
* Add code coverage for DataGridViewCellStyleConverter * Handle FeedBacks * Handle FeedBacks
- Loading branch information
1 parent
680fcad
commit df46341
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
...Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewCellStyleConverterTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
#nullable enable | ||
|
||
using System.ComponentModel.Design.Serialization; | ||
using System.Globalization; | ||
|
||
namespace System.Windows.Forms.Tests; | ||
|
||
public class DataGridViewCellStyleConverterTests | ||
{ | ||
private readonly DataGridViewCellStyleConverter _converter; | ||
private readonly DataGridViewCellStyle _style; | ||
|
||
public DataGridViewCellStyleConverterTests() | ||
{ | ||
_converter = new(); | ||
_style = new(); | ||
} | ||
|
||
[WinFormsFact] | ||
public void CanConvertTo_InstanceDescriptor_ReturnsTrue() | ||
{ | ||
_converter.CanConvertTo(null, typeof(InstanceDescriptor)).Should().BeTrue(); | ||
} | ||
|
||
[WinFormsFact] | ||
public void CanConvertTo_OtherType_ReturnsFalse() | ||
{ | ||
_converter.CanConvertTo(null, typeof(int)).Should().BeFalse(); | ||
} | ||
|
||
[WinFormsFact] | ||
public void ConvertTo_InstanceDescriptor_ReturnsInstanceDescriptor() | ||
{ | ||
object? convertTo = _converter.ConvertTo(null, CultureInfo.InvariantCulture, _style, typeof(InstanceDescriptor)); | ||
convertTo.Should().NotBeNull(); | ||
convertTo.Should().BeOfType<InstanceDescriptor>(); | ||
} | ||
|
||
[WinFormsFact] | ||
public void ConvertTo_UnsupportedType_ThrowsNotSupportedException() | ||
{ | ||
Action action = () => _converter.ConvertTo(null, CultureInfo.InvariantCulture, _style, typeof(int)); | ||
action.Should().Throw<NotSupportedException>(); | ||
} | ||
} |