forked from dotnet/winforms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests for NumericUpDownAcceleration (dotnet#12705)
Related dotnet#10453 Proposed changes Add unit tests for NumericUpDownAcceleration.cs to test its properties & methods Enable nullability in NumericUpDownAccelerationTests.cs
- Loading branch information
Syareel-Sukeri
authored and
Ricardo Bossan (BEYONDSOFT CONSULTING INC) (from Dev Box)
committed
Jan 9, 2025
1 parent
1f11886
commit a5462cd
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
...stem.Windows.Forms/tests/UnitTests/System/Windows/Forms/NumericUpDownAccelerationTests.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,37 @@ | ||
// 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; | ||
|
||
public class NumericUpDownAccelerationTests | ||
{ | ||
[WinFormsFact] | ||
public void NumericUpDownAcceleration_SecondsProperty_WorksAsExpected() | ||
{ | ||
NumericUpDownAcceleration acceleration = new(5, 1.0m); | ||
|
||
acceleration.Seconds.Should().Be(5); | ||
|
||
acceleration.Seconds = 10; | ||
acceleration.Seconds.Should().Be(10); | ||
|
||
Action act = () => acceleration.Seconds = -1; | ||
act.Should().Throw<ArgumentOutOfRangeException>(); | ||
} | ||
|
||
[WinFormsFact] | ||
public void NumericUpDownAcceleration_IncrementProperty_WorksAsExpected() | ||
{ | ||
NumericUpDownAcceleration acceleration = new(5, 1.0m); | ||
|
||
acceleration.Increment.Should().Be(1.0m); | ||
|
||
acceleration.Increment = 2.0m; | ||
acceleration.Increment.Should().Be(2.0m); | ||
|
||
Action act = () => acceleration.Increment = -1.0m; | ||
act.Should().Throw<ArgumentOutOfRangeException>(); | ||
} | ||
} |