X10D/X10D.Tests/src/Math/Int32Tests.Wrap.cs

105 lines
2.5 KiB
C#
Raw Normal View History

using Microsoft.VisualStudio.TestTools.UnitTesting;
using X10D.Math;
namespace X10D.Tests.Math;
public partial class Int32Tests
{
[TestClass]
public class WrapTests
{
[TestMethod]
public void Wrap_ShouldReturnLow_WhenValueIsEqualToLow()
{
const int value = 10;
const int low = 10;
const int high = 20;
int result = value.Wrap(low, high);
Assert.AreEqual(low, result);
}
[TestMethod]
public void Wrap_ShouldReturnHigh_WhenValueIsEqualToHigh()
{
const int value = 20;
const int low = 10;
const int high = 20;
int result = value.Wrap(low, high);
Assert.AreEqual(low, result);
}
[TestMethod]
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanHigh()
{
const int value = 30;
const int low = 10;
const int high = 20;
int result = value.Wrap(low, high);
Assert.AreEqual(low, result);
}
[TestMethod]
public void Wrap_ShouldReturnCorrectResult_WhenValueIsLessThanLow()
{
const int value = 5;
const int low = 10;
const int high = 20;
int result = value.Wrap(low, high);
Assert.AreEqual(15, result);
}
[TestMethod]
public void Wrap_ShouldReturnCorrectResult_WhenValueIsInBetweenLowAndHigh()
{
const int value = 15;
const int low = 10;
const int high = 20;
int result = value.Wrap(low, high);
Assert.AreEqual(value, result);
}
[TestMethod]
public void Wrap_ShouldReturnZero_WhenValueIsEqualToLength()
{
const int value = 10;
const int length = 10;
int result = value.Wrap(length);
Assert.AreEqual(0, result);
}
[TestMethod]
public void Wrap_ShouldReturnValue_WhenValueIsLessThanLength()
{
const int value = 5;
const int length = 10;
int result = value.Wrap(length);
Assert.AreEqual(value, result);
}
[TestMethod]
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanLength()
{
const int value = 15;
const int length = 10;
int result = value.Wrap(length);
Assert.AreEqual(5, result);
}
}
}