From ae24d94da2b778479cc0fbeba40011929185bad8 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Fri, 22 Apr 2022 09:42:58 +0100 Subject: [PATCH] Add tests for AsArray/AsEnumerable --- X10D.Tests/src/Core/CoreTests.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 X10D.Tests/src/Core/CoreTests.cs diff --git a/X10D.Tests/src/Core/CoreTests.cs b/X10D.Tests/src/Core/CoreTests.cs new file mode 100644 index 0000000..1ce041e --- /dev/null +++ b/X10D.Tests/src/Core/CoreTests.cs @@ -0,0 +1,27 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using X10D.Core; +using X10D.Text; + +namespace X10D.Tests.Core; + +[TestClass] +public class CoreTests +{ + [TestMethod] + public void AsArrayShouldBeLength1() + { + Assert.AreEqual(1, 0.AsArray().Length); + Assert.AreEqual(1, string.Empty.AsArray().Length); + Assert.AreEqual(1, true.AsArray().Length); + Assert.AreEqual(1, ((object?)null).AsArray().Length); + } + + [TestMethod] + public void AsEnumerableShouldBeLength1() + { + Assert.AreEqual(1, 0.AsEnumerable().Count()); + Assert.AreEqual(1, string.Empty.AsEnumerable().Count()); + Assert.AreEqual(1, true.AsEnumerable().Count()); + Assert.AreEqual(1, ((object?)null).AsEnumerable().Count()); + } +}