unit tests are done

This commit is contained in:
Brady
2019-10-25 23:25:50 -06:00
parent 62c09e84d6
commit b64540c812
22 changed files with 569 additions and 115 deletions

View File

@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using NUnit.Framework;
using Shapes;
using static Shapes.Validator;
namespace Tests
{
public class ValidatorTests
{
[SetUp]
public void SetUp()
{
}
[Test]
public void ValidatePositiveDoubleTest()
{
Assert.That(()=> ValidatePositiveDouble(-10, "Error"), Throws.TypeOf<ShapeException>()
.With.Message.EqualTo("Error"));
}
[Test]
public void ValidateDoubleTest()
{
Assert.That(()=> ValidateDouble(Double.NaN, "Error"), Throws.TypeOf<ShapeException>()
.With.Message.EqualTo("Error"));
}
[Test]
public void ValidateRectangleTest()
{
List<Point> points = new List<Point>();
points.Add(new Point(30, 30));
points.Add(new Point(30, 30));
points.Add(new Point(30, 30));
points.Add(new Point(30, 30));
Assert.That(()=> ValidateRectangle(points, "Error"), Throws.TypeOf<ShapeException>()
.With.Message.EqualTo("Error"));
}
}
}