mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-27 00:07:58 +01:00
* tweaked version # for v1.0.0-beta.10 * tweaked version # for v1.0.0-beta.11 * Updated readme and revision history for 1.0 * excluding test results * Added support for viewing code coverage results with Fine Code Coverage * add generating CC to CI/CD * refactored unit test namespaces * more refactoring. commented out failing test. * Removed UnitTests and UICatalog from code coverage reporting * made Application and test more deterministic * disabled Multi_Thread_Toplevels because it is currently broken and don't understand why * updated threading test per @bdisp * testing cc badge stuff * another test * using coverlet.settings * trying copy * trying cp. duh. * trying mv. * wrong path * print * chaging badge output for testing * yaml error * fixed code coverage * moved dimtests to core
92 lines
2.0 KiB
C#
92 lines
2.0 KiB
C#
using System;
|
|
using Xunit;
|
|
|
|
namespace Terminal.Gui.Types {
|
|
public class SizeTests {
|
|
[Fact]
|
|
public void Size_New ()
|
|
{
|
|
var size = new Size ();
|
|
Assert.True (size.IsEmpty);
|
|
|
|
size = new Size (new Point ());
|
|
Assert.True (size.IsEmpty);
|
|
|
|
size = new Size (3, 4);
|
|
Assert.False (size.IsEmpty);
|
|
|
|
Action action = () => new Size (-3, 4);
|
|
var ex = Assert.Throws<ArgumentException> (action);
|
|
Assert.Equal ("Either Width and Height must be greater or equal to 0.", ex.Message);
|
|
|
|
action = () => new Size (3, -4);
|
|
ex = Assert.Throws<ArgumentException> (action);
|
|
Assert.Equal ("Either Width and Height must be greater or equal to 0.", ex.Message);
|
|
|
|
action = () => new Size (-3, -4);
|
|
ex = Assert.Throws<ArgumentException> (action);
|
|
Assert.Equal ("Either Width and Height must be greater or equal to 0.", ex.Message);
|
|
|
|
}
|
|
|
|
[Fact]
|
|
public void Size_SetsValue ()
|
|
{
|
|
var size = new Size () {
|
|
Width = 0,
|
|
Height = 0
|
|
};
|
|
Assert.True (size.IsEmpty);
|
|
|
|
size = new Size () {
|
|
Width = 3,
|
|
Height = 4
|
|
};
|
|
Assert.False (size.IsEmpty);
|
|
|
|
Action action = () => {
|
|
size = new Size () {
|
|
Width = -3,
|
|
Height = 4
|
|
};
|
|
};
|
|
var ex = Assert.Throws<ArgumentException> (action);
|
|
Assert.Equal ("Width must be greater or equal to 0.", ex.Message);
|
|
|
|
action = () => {
|
|
size = new Size () {
|
|
Width = 3,
|
|
Height = -4
|
|
};
|
|
};
|
|
ex = Assert.Throws<ArgumentException> (action);
|
|
Assert.Equal ("Height must be greater or equal to 0.", ex.Message);
|
|
|
|
action = () => {
|
|
size = new Size () {
|
|
Width = -3,
|
|
Height = -4
|
|
};
|
|
};
|
|
ex = Assert.Throws<ArgumentException> (action);
|
|
Assert.Equal ("Width must be greater or equal to 0.", ex.Message);
|
|
}
|
|
|
|
[Fact]
|
|
public void Size_Equals ()
|
|
{
|
|
var size1 = new Size ();
|
|
var size2 = new Size ();
|
|
Assert.Equal (size1, size2);
|
|
|
|
size1 = new Size (3, 4);
|
|
size2 = new Size (3, 4);
|
|
Assert.Equal (size1, size2);
|
|
|
|
size1 = new Size (3, 4);
|
|
size2 = new Size (4, 4);
|
|
Assert.NotEqual (size1, size2);
|
|
}
|
|
}
|
|
}
|