mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-14 17:05:42 +00:00
43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Drawing;
|
|
using NUnit.Framework;
|
|
using UnityEngine.TestTools;
|
|
using X10D.Unity.Drawing;
|
|
using Random = System.Random;
|
|
|
|
namespace X10D.Unity.Tests.Drawing
|
|
{
|
|
public class RectangleTests
|
|
{
|
|
[UnityTest]
|
|
public IEnumerator ToUnityRect_ShouldReturnRect_WithEquivalentMembers()
|
|
{
|
|
var random = new Random();
|
|
var rectangle = new Rectangle(random.Next(), random.Next(), random.Next(), random.Next());
|
|
var rect = rectangle.ToUnityRect();
|
|
|
|
Assert.AreEqual(rectangle.X, rect.x);
|
|
Assert.AreEqual(rectangle.Y, rect.y);
|
|
Assert.AreEqual(rectangle.Width, rect.width);
|
|
Assert.AreEqual(rectangle.Height, rect.height);
|
|
|
|
yield break;
|
|
}
|
|
|
|
[UnityTest]
|
|
public IEnumerator ToUnityRectInt_ShouldReturnRect_WithEquivalentMembers()
|
|
{
|
|
var random = new Random();
|
|
var rectangle = new Rectangle(random.Next(), random.Next(), random.Next(), random.Next());
|
|
var rect = rectangle.ToUnityRectInt();
|
|
|
|
Assert.AreEqual(rectangle.X, rect.x);
|
|
Assert.AreEqual(rectangle.Y, rect.y);
|
|
Assert.AreEqual(rectangle.Width, rect.width);
|
|
Assert.AreEqual(rectangle.Height, rect.height);
|
|
|
|
yield break;
|
|
}
|
|
}
|
|
}
|