42 lines
875 B
C#
42 lines
875 B
C#
|
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());
|
||
|
}
|
||
|
}
|