aboutsummaryrefslogtreecommitdiff
path: root/MindBox.Tests/TriangleCreateTests.cs
blob: 1e498ccfd5851bde8e8b8c17b1881f3341767340 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
namespace MindBox.Tests;

public class TriangleCreateTests
{
	[TestCase(-1.0, 1.0, 1.0)]
	[TestCase(1.0, -1.0, 1.0)]
	[TestCase(1.0, 1.0, -1.0)]
	public void NegativeSide(double a, double b, double c)
	{
		Assert.Throws<ArgumentException>(() => new Triangle(a, b, c));
	}

	[TestCase(0.0, 1.0, 1.0)]
	[TestCase(1.0, 0.0, 1.0)]
	[TestCase(1.0, 1.0, 0.0)]
	public void ZeroSide(double a, double b, double c)
	{
		Assert.Throws<ArgumentException>(() => new Triangle(a, b, c));
	}

	[TestCase(4, 5, 9)]
	[TestCase(4, 5, 10)]
	public void WrongSides(double a, double b, double c)
	{
		Assert.Throws<ArgumentException>(() => new Triangle(a, b, c));
	}
}

public class TriangleRightTests
{
	[Test]
	public void IsRight()
	{
		Assert.IsTrue(new Triangle(3.0, 4.0, 5.0).IsRight());
	}

	[Test]
	public void IsNotRight()
	{
		Assert.IsFalse(new Triangle(1.0, 1.0, 1.0).IsRight());
	}
}