mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-23 00:58:48 +00:00
[ci skip] Move AsArrayValue tests to CoreTests
This commit is contained in:
parent
8020e91647
commit
5a88a06551
@ -1,34 +1,11 @@
|
|||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using X10D.Collections;
|
using X10D.Collections;
|
||||||
using X10D.Core;
|
|
||||||
|
|
||||||
namespace X10D.Tests.Collections;
|
namespace X10D.Tests.Collections;
|
||||||
|
|
||||||
[TestClass]
|
[TestClass]
|
||||||
public class ArrayTests
|
public class ArrayTests
|
||||||
{
|
{
|
||||||
[TestMethod]
|
|
||||||
[DataRow(1)]
|
|
||||||
[DataRow("f")]
|
|
||||||
[DataRow(true)]
|
|
||||||
public void AsArrayShouldGiveLength1(object o)
|
|
||||||
{
|
|
||||||
object[] array = o.AsArrayValue()!;
|
|
||||||
Assert.IsNotNull(array);
|
|
||||||
Assert.IsTrue(array.Length == 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
[DataRow(1)]
|
|
||||||
[DataRow("f")]
|
|
||||||
[DataRow(true)]
|
|
||||||
public void AsArrayShouldContainObject(object o)
|
|
||||||
{
|
|
||||||
object[] array = o.AsArrayValue()!;
|
|
||||||
Assert.IsNotNull(array);
|
|
||||||
Assert.AreEqual(o, array[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void AsReadOnlyShouldBeReadOnly()
|
public void AsReadOnlyShouldBeReadOnly()
|
||||||
{
|
{
|
||||||
|
@ -7,20 +7,46 @@ namespace X10D.Tests.Core;
|
|||||||
public class CoreTests
|
public class CoreTests
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void AsArrayShouldBeLength1()
|
[DataRow(1)]
|
||||||
|
[DataRow("f")]
|
||||||
|
[DataRow(true)]
|
||||||
|
public void AsArrayValue_ShouldBeLength1_GivenValue(object o)
|
||||||
{
|
{
|
||||||
Assert.AreEqual(1, 0.AsArrayValue().Length);
|
object[] array = o.AsArrayValue()!;
|
||||||
Assert.AreEqual(1, string.Empty.AsArrayValue().Length);
|
Assert.IsNotNull(array);
|
||||||
Assert.AreEqual(1, true.AsArrayValue().Length);
|
Assert.IsTrue(array.Length == 1);
|
||||||
Assert.AreEqual(1, ((object?)null).AsArrayValue().Length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void AsEnumerableShouldBeLength1()
|
[DataRow(1)]
|
||||||
|
[DataRow("f")]
|
||||||
|
[DataRow(true)]
|
||||||
|
public void AsArrayValue_ShouldContainValue_Given_Value(object o)
|
||||||
{
|
{
|
||||||
Assert.AreEqual(1, 0.AsEnumerableValue().Count());
|
object[] array = o.AsArrayValue()!;
|
||||||
Assert.AreEqual(1, string.Empty.AsEnumerableValue().Count());
|
Assert.IsNotNull(array);
|
||||||
Assert.AreEqual(1, true.AsEnumerableValue().Count());
|
Assert.AreEqual(o, array[0]);
|
||||||
Assert.AreEqual(1, ((object?)null).AsEnumerableValue().Count());
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
[DataRow(1)]
|
||||||
|
[DataRow("f")]
|
||||||
|
[DataRow(true)]
|
||||||
|
public void AsEnumerableValue_ShouldBeLength1_GivenValue(object o)
|
||||||
|
{
|
||||||
|
IEnumerable<object> array = o.AsEnumerableValue()!;
|
||||||
|
Assert.IsNotNull(array);
|
||||||
|
Assert.IsTrue(array.Count() == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
[DataRow(1)]
|
||||||
|
[DataRow("f")]
|
||||||
|
[DataRow(true)]
|
||||||
|
public void AsEnumerableValue_ShouldContainValue_Given_Value(object o)
|
||||||
|
{
|
||||||
|
IEnumerable<object> array = o.AsEnumerableValue()!;
|
||||||
|
Assert.IsNotNull(array);
|
||||||
|
Assert.AreEqual(o, array.ElementAt(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user