From 600b37fe82889ab9cfd515fcdd97454976a29eac Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Wed, 15 Jul 2020 14:32:59 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9A=20Move=20X10D=20tests=20to=20Core?= =?UTF-8?q?=20namespace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- X10D.Tests/src/{ => Core}/BooleanTests.cs | 250 +++++++++--------- X10D.Tests/src/{ => Core}/ByteTests.cs | 22 +- X10D.Tests/src/{ => Core}/CharTests.cs | 8 +- X10D.Tests/src/{ => Core}/ComparableTests.cs | 6 +- X10D.Tests/src/{ => Core}/ConvertibleTests.cs | 30 +-- X10D.Tests/src/{ => Core}/DateTimeTests.cs | 26 +- X10D.Tests/src/{ => Core}/DictionaryTests.cs | 8 +- X10D.Tests/src/{ => Core}/DoubleTests.cs | 18 +- X10D.Tests/src/{ => Core}/EnumerableTests.cs | 8 +- X10D.Tests/src/{ => Core}/ReflectionTests.cs | 10 +- X10D.Tests/src/{ => Core}/StringTests.cs | 8 +- .../src/{ => Core}/TimeSpanParserTests.cs | 6 +- 12 files changed, 200 insertions(+), 200 deletions(-) rename X10D.Tests/src/{ => Core}/BooleanTests.cs (85%) rename X10D.Tests/src/{ => Core}/ByteTests.cs (76%) rename X10D.Tests/src/{ => Core}/CharTests.cs (78%) rename X10D.Tests/src/{ => Core}/ComparableTests.cs (72%) rename X10D.Tests/src/{ => Core}/ConvertibleTests.cs (72%) rename X10D.Tests/src/{ => Core}/DateTimeTests.cs (76%) rename X10D.Tests/src/{ => Core}/DictionaryTests.cs (78%) rename X10D.Tests/src/{ => Core}/DoubleTests.cs (76%) rename X10D.Tests/src/{ => Core}/EnumerableTests.cs (87%) rename X10D.Tests/src/{ => Core}/ReflectionTests.cs (80%) rename X10D.Tests/src/{ => Core}/StringTests.cs (77%) rename X10D.Tests/src/{ => Core}/TimeSpanParserTests.cs (83%) diff --git a/X10D.Tests/src/BooleanTests.cs b/X10D.Tests/src/Core/BooleanTests.cs similarity index 85% rename from X10D.Tests/src/BooleanTests.cs rename to X10D.Tests/src/Core/BooleanTests.cs index f571dca..15bad0f 100644 --- a/X10D.Tests/src/BooleanTests.cs +++ b/X10D.Tests/src/Core/BooleanTests.cs @@ -1,92 +1,15 @@ -namespace X10D.Tests +namespace X10D.Tests.Core { using Microsoft.VisualStudio.TestTools.UnitTesting; /// - /// Tests for . + /// Tests for . /// [TestClass] public class BooleanTests { /// - /// Tests for . - /// - [TestMethod] - public void ToByte() - { - const bool a = true; - const bool b = false; - const byte c = 1; - const byte d = 0; - - Assert.IsTrue(a); - Assert.IsFalse(b); - Assert.AreEqual(c, a.ToByte()); - Assert.AreEqual(d, b.ToByte()); - } - - /// - /// Tests for . - /// - [TestMethod] - public void ToInt16() - { - const bool a = true; - const bool b = false; - - Assert.IsTrue(a); - Assert.IsFalse(b); - Assert.AreEqual(1, a.ToInt16()); - Assert.AreEqual(0, b.ToInt16()); - } - - /// - /// Tests for . - /// - [TestMethod] - public void ToInt32() - { - const bool a = true; - const bool b = false; - - Assert.IsTrue(a); - Assert.IsFalse(b); - Assert.AreEqual(1, a.ToInt32()); - Assert.AreEqual(0, b.ToInt32()); - } - - /// - /// Tests for . - /// - [TestMethod] - public void ToInt64() - { - const bool a = true; - const bool b = false; - - Assert.IsTrue(a); - Assert.IsFalse(b); - Assert.AreEqual(1L, a.ToInt64()); - Assert.AreEqual(0L, b.ToInt64()); - } - - /// - /// Tests for . - /// - [TestMethod] - public void Not() - { - const bool a = true; - const bool b = false; - - Assert.IsTrue(a); - Assert.IsFalse(b); - Assert.IsFalse(a.Not()); - Assert.IsTrue(b.Not()); - } - - /// - /// Tests for . + /// Tests for . /// [TestMethod] public void And() @@ -107,49 +30,7 @@ namespace X10D.Tests } /// - /// Tests for . - /// - [TestMethod] - public void Or() - { - const bool a = true; - const bool b = true; - const bool c = false; - const bool d = false; - - Assert.IsTrue(a); - Assert.IsTrue(b); - Assert.IsFalse(c); - Assert.IsFalse(d); - - Assert.IsTrue(a.Or(b)); - Assert.IsTrue(b.Or(c)); - Assert.IsFalse(c.Or(d)); - } - - /// - /// Tests for . - /// - [TestMethod] - public void XOr() - { - const bool a = true; - const bool b = true; - const bool c = false; - const bool d = false; - - Assert.IsTrue(a); - Assert.IsTrue(b); - Assert.IsFalse(c); - Assert.IsFalse(d); - - Assert.IsFalse(a.XOr(b)); - Assert.IsTrue(b.XOr(c)); - Assert.IsFalse(c.XOr(d)); - } - - /// - /// Tests for . + /// Tests for . /// [TestMethod] public void NAnd() @@ -170,7 +51,7 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void NOr() @@ -191,7 +72,105 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . + /// + [TestMethod] + public void Not() + { + const bool a = true; + const bool b = false; + + Assert.IsTrue(a); + Assert.IsFalse(b); + Assert.IsFalse(a.Not()); + Assert.IsTrue(b.Not()); + } + + /// + /// Tests for . + /// + [TestMethod] + public void Or() + { + const bool a = true; + const bool b = true; + const bool c = false; + const bool d = false; + + Assert.IsTrue(a); + Assert.IsTrue(b); + Assert.IsFalse(c); + Assert.IsFalse(d); + + Assert.IsTrue(a.Or(b)); + Assert.IsTrue(b.Or(c)); + Assert.IsFalse(c.Or(d)); + } + + /// + /// Tests for . + /// + [TestMethod] + public void ToByte() + { + const bool a = true; + const bool b = false; + const byte c = 1; + const byte d = 0; + + Assert.IsTrue(a); + Assert.IsFalse(b); + Assert.AreEqual(c, a.ToByte()); + Assert.AreEqual(d, b.ToByte()); + } + + /// + /// Tests for . + /// + [TestMethod] + public void ToInt16() + { + const bool a = true; + const bool b = false; + + Assert.IsTrue(a); + Assert.IsFalse(b); + Assert.AreEqual(1, a.ToInt16()); + Assert.AreEqual(0, b.ToInt16()); + } + + /// + /// Tests for . + /// + [TestMethod] + public void ToInt32() + { + const bool a = true; + const bool b = false; + + Assert.IsTrue(a); + Assert.IsFalse(b); + Assert.AreEqual(1, a.ToInt32()); + Assert.AreEqual(0, b.ToInt32()); + } + + /// + /// Tests for . + /// + [TestMethod] + public void ToInt64() + { + const bool a = true; + const bool b = false; + + Assert.IsTrue(a); + Assert.IsFalse(b); + Assert.AreEqual(1L, a.ToInt64()); + Assert.AreEqual(0L, b.ToInt64()); + } + + /// + /// Tests for . /// [TestMethod] public void XNOr() @@ -210,5 +189,26 @@ namespace X10D.Tests Assert.IsFalse(b.XNOr(c)); Assert.IsTrue(c.XNOr(d)); } + + /// + /// Tests for . + /// + [TestMethod] + public void XOr() + { + const bool a = true; + const bool b = true; + const bool c = false; + const bool d = false; + + Assert.IsTrue(a); + Assert.IsTrue(b); + Assert.IsFalse(c); + Assert.IsFalse(d); + + Assert.IsFalse(a.XOr(b)); + Assert.IsTrue(b.XOr(c)); + Assert.IsFalse(c.XOr(d)); + } } } diff --git a/X10D.Tests/src/ByteTests.cs b/X10D.Tests/src/Core/ByteTests.cs similarity index 76% rename from X10D.Tests/src/ByteTests.cs rename to X10D.Tests/src/Core/ByteTests.cs index 5bf145e..e97061a 100644 --- a/X10D.Tests/src/ByteTests.cs +++ b/X10D.Tests/src/Core/ByteTests.cs @@ -1,17 +1,17 @@ -namespace X10D.Tests +namespace X10D.Tests.Core { using System.Collections.Generic; using System.Text; using Microsoft.VisualStudio.TestTools.UnitTesting; /// - /// Tests for . + /// Tests for . /// [TestClass] public class ByteTests { /// - /// Tests for . + /// Tests for . /// [TestMethod] public void AsString() @@ -21,7 +21,7 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void GetInt16() @@ -31,7 +31,7 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void GetInt32() @@ -41,7 +41,7 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void GetInt64() @@ -51,7 +51,7 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void GetString() @@ -61,7 +61,7 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void GetStringAscii() @@ -71,7 +71,7 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void GetUInt16() @@ -81,7 +81,7 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void GetUInt32() @@ -91,7 +91,7 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void GetUInt64() diff --git a/X10D.Tests/src/CharTests.cs b/X10D.Tests/src/Core/CharTests.cs similarity index 78% rename from X10D.Tests/src/CharTests.cs rename to X10D.Tests/src/Core/CharTests.cs index c0f328d..d462d59 100644 --- a/X10D.Tests/src/CharTests.cs +++ b/X10D.Tests/src/Core/CharTests.cs @@ -1,17 +1,17 @@ -namespace X10D.Tests +namespace X10D.Tests.Core { using System; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; /// - /// Tests for . + /// Tests for . /// [TestClass] public class CharTests { /// - /// Tests for . + /// Tests for . /// [TestMethod] public void Random() @@ -24,7 +24,7 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void Repeat() diff --git a/X10D.Tests/src/ComparableTests.cs b/X10D.Tests/src/Core/ComparableTests.cs similarity index 72% rename from X10D.Tests/src/ComparableTests.cs rename to X10D.Tests/src/Core/ComparableTests.cs index 7d27db9..c477f9d 100644 --- a/X10D.Tests/src/ComparableTests.cs +++ b/X10D.Tests/src/Core/ComparableTests.cs @@ -1,15 +1,15 @@ -namespace X10D.Tests +namespace X10D.Tests.Core { using Microsoft.VisualStudio.TestTools.UnitTesting; /// - /// Tests for . + /// Tests for . /// [TestClass] public class ComparableTests { /// - /// Tests for . + /// Tests for . /// [TestMethod] public void Between() diff --git a/X10D.Tests/src/ConvertibleTests.cs b/X10D.Tests/src/Core/ConvertibleTests.cs similarity index 72% rename from X10D.Tests/src/ConvertibleTests.cs rename to X10D.Tests/src/Core/ConvertibleTests.cs index c366aea..cc11fc2 100644 --- a/X10D.Tests/src/ConvertibleTests.cs +++ b/X10D.Tests/src/Core/ConvertibleTests.cs @@ -1,16 +1,16 @@ -namespace X10D.Tests +namespace X10D.Tests.Core { using System; using Microsoft.VisualStudio.TestTools.UnitTesting; /// - /// Tests for . + /// Tests for . /// [TestClass] public class ConvertibleTests { /// - /// Tests for . + /// Tests for . /// [TestMethod] public void To() @@ -21,7 +21,7 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void ToOrDefault() @@ -35,7 +35,17 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . + /// + [TestMethod] + public void ToOrNull() + { + Assert.IsFalse("foo".ToOrNull(out ConvertibleTests t)); + Assert.IsNull(t); + } + + /// + /// Tests for . /// [TestMethod] public void ToOrOther() @@ -44,15 +54,5 @@ namespace X10D.Tests Assert.IsFalse("Foo".ToOrOther(out var d, 2.0)); Assert.AreEqual(2.0, d); } - - /// - /// Tests for . - /// - [TestMethod] - public void ToOrNull() - { - Assert.IsFalse("foo".ToOrNull(out ConvertibleTests t)); - Assert.IsNull(t); - } } } diff --git a/X10D.Tests/src/DateTimeTests.cs b/X10D.Tests/src/Core/DateTimeTests.cs similarity index 76% rename from X10D.Tests/src/DateTimeTests.cs rename to X10D.Tests/src/Core/DateTimeTests.cs index c7b6502..a670af9 100644 --- a/X10D.Tests/src/DateTimeTests.cs +++ b/X10D.Tests/src/Core/DateTimeTests.cs @@ -1,30 +1,30 @@ -namespace X10D.Tests +namespace X10D.Tests.Core { using System; using Microsoft.VisualStudio.TestTools.UnitTesting; /// - /// Tests for . + /// Tests for . /// [TestClass] public class DateTimeTests { /// - /// Tests for . + /// Tests for . /// [TestMethod] public void Age() { // no choice but to create dynamic based on today's date. // age varies with time - DateTime now = DateTime.Now; + var now = DateTime.Now; var dt = new DateTime(now.Year - 18, 1, 1); Assert.AreEqual(18, dt.Age()); } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void First() @@ -35,13 +35,13 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void FirstDayOfMonth() { var dt = new DateTime(2018, 6, 20); - DateTime first = dt.FirstDayOfMonth(); + var first = dt.FirstDayOfMonth(); Assert.AreEqual(dt.Year, first.Year); Assert.AreEqual(dt.Month, first.Month); @@ -49,14 +49,14 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void Last() { { var dt = new DateTime(2019, 12, 1); - DateTime last = dt.Last(DayOfWeek.Wednesday); + var last = dt.Last(DayOfWeek.Wednesday); Assert.AreEqual(dt.Year, last.Year); Assert.AreEqual(dt.Month, last.Month); @@ -65,7 +65,7 @@ namespace X10D.Tests { var dt = new DateTime(2020, 4, 14); - DateTime last = dt.Last(DayOfWeek.Friday); + var last = dt.Last(DayOfWeek.Friday); Assert.AreEqual(dt.Year, last.Year); Assert.AreEqual(dt.Month, last.Month); @@ -79,13 +79,13 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void LastDayOfMonth() { var dt = new DateTime(2016, 2, 4); - DateTime last = dt.LastDayOfMonth(); + var last = dt.LastDayOfMonth(); Assert.AreEqual(dt.Year, last.Year); Assert.AreEqual(dt.Month, last.Month); @@ -93,7 +93,7 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void ToUnixTimestamp() diff --git a/X10D.Tests/src/DictionaryTests.cs b/X10D.Tests/src/Core/DictionaryTests.cs similarity index 78% rename from X10D.Tests/src/DictionaryTests.cs rename to X10D.Tests/src/Core/DictionaryTests.cs index e85b895..983fc9b 100644 --- a/X10D.Tests/src/DictionaryTests.cs +++ b/X10D.Tests/src/Core/DictionaryTests.cs @@ -1,16 +1,16 @@ -namespace X10D.Tests +namespace X10D.Tests.Core { using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; /// - /// Tests for . + /// Tests for . /// [TestClass] public class DictionaryTests { /// - /// Tests for . + /// Tests for . /// [TestMethod] public void ToConnectionString() @@ -25,7 +25,7 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void ToGetParameters() diff --git a/X10D.Tests/src/DoubleTests.cs b/X10D.Tests/src/Core/DoubleTests.cs similarity index 76% rename from X10D.Tests/src/DoubleTests.cs rename to X10D.Tests/src/Core/DoubleTests.cs index 9f7a25a..9990370 100644 --- a/X10D.Tests/src/DoubleTests.cs +++ b/X10D.Tests/src/Core/DoubleTests.cs @@ -1,16 +1,16 @@ -namespace X10D.Tests +namespace X10D.Tests.Core { using System; using Microsoft.VisualStudio.TestTools.UnitTesting; /// - /// Tests for . + /// Tests for . /// [TestClass] public class DoubleTests { /// - /// Tests for . + /// Tests for . /// [TestMethod] public void Clamp() @@ -20,7 +20,7 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void DegreesToRadians() @@ -30,7 +30,7 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void GetBytes() @@ -41,7 +41,7 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void IsEven() @@ -51,7 +51,7 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void IsOdd() @@ -61,7 +61,7 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void RadiansToDegrees() @@ -71,7 +71,7 @@ namespace X10D.Tests } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void Round() diff --git a/X10D.Tests/src/EnumerableTests.cs b/X10D.Tests/src/Core/EnumerableTests.cs similarity index 87% rename from X10D.Tests/src/EnumerableTests.cs rename to X10D.Tests/src/Core/EnumerableTests.cs index c87ef8a..6da9ac3 100644 --- a/X10D.Tests/src/EnumerableTests.cs +++ b/X10D.Tests/src/Core/EnumerableTests.cs @@ -1,17 +1,17 @@ -namespace X10D.Tests +namespace X10D.Tests.Core { using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; /// - /// Tests for . + /// Tests for . /// [TestClass] public class EnumerableTests { /// - /// Tests for using an array of . + /// Tests for using an array of . /// [TestMethod] public void SplitByte() @@ -32,7 +32,7 @@ } /// - /// Tests for using an array of . + /// Tests for using an array of . /// [TestMethod] public void SplitInt32() diff --git a/X10D.Tests/src/ReflectionTests.cs b/X10D.Tests/src/Core/ReflectionTests.cs similarity index 80% rename from X10D.Tests/src/ReflectionTests.cs rename to X10D.Tests/src/Core/ReflectionTests.cs index da95110..b182a4b 100644 --- a/X10D.Tests/src/ReflectionTests.cs +++ b/X10D.Tests/src/Core/ReflectionTests.cs @@ -1,17 +1,17 @@ -namespace X10D.Tests +namespace X10D.Tests.Core { using System; using System.ComponentModel; using Microsoft.VisualStudio.TestTools.UnitTesting; /// - /// Tests for . + /// Tests for . /// [TestClass] public class ReflectionTests { /// - /// Test for . + /// Test for . /// [TestMethod] public void GetDefaultValue() @@ -25,7 +25,7 @@ } /// - /// Test for . + /// Test for . /// [TestMethod] public void GetDescription() @@ -39,7 +39,7 @@ } /// - /// Test for . + /// Test for . /// [TestMethod] public void SelectFromCustomAttribute() diff --git a/X10D.Tests/src/StringTests.cs b/X10D.Tests/src/Core/StringTests.cs similarity index 77% rename from X10D.Tests/src/StringTests.cs rename to X10D.Tests/src/Core/StringTests.cs index b4ccf4f..32d6fb4 100644 --- a/X10D.Tests/src/StringTests.cs +++ b/X10D.Tests/src/Core/StringTests.cs @@ -1,16 +1,16 @@ -namespace X10D.Tests +namespace X10D.Tests.Core { using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; /// - /// Tests for . + /// Tests for . /// [TestClass] public class StringTests { /// - /// Tests for . + /// Tests for . /// [TestMethod] public void Repeat() @@ -19,7 +19,7 @@ } /// - /// Tests for . + /// Tests for . /// [TestMethod] public void Split() diff --git a/X10D.Tests/src/TimeSpanParserTests.cs b/X10D.Tests/src/Core/TimeSpanParserTests.cs similarity index 83% rename from X10D.Tests/src/TimeSpanParserTests.cs rename to X10D.Tests/src/Core/TimeSpanParserTests.cs index a952280..bbbb5e7 100644 --- a/X10D.Tests/src/TimeSpanParserTests.cs +++ b/X10D.Tests/src/Core/TimeSpanParserTests.cs @@ -1,16 +1,16 @@ -namespace X10D.Tests +namespace X10D.Tests.Core { using System; using Microsoft.VisualStudio.TestTools.UnitTesting; /// - /// Tests for . + /// Tests for . /// [TestClass] public class TimeSpanParserTests { /// - /// Tests for . + /// Tests for . /// [TestMethod] public void TestParser()