🚚 Move X10D tests to Core namespace

This commit is contained in:
Oliver Booth 2020-07-15 14:32:59 +01:00
parent ad1c2f5e7c
commit 600b37fe82
12 changed files with 200 additions and 200 deletions

View File

@ -1,4 +1,4 @@
namespace X10D.Tests
namespace X10D.Tests.Core
{
using Microsoft.VisualStudio.TestTools.UnitTesting;
@ -8,6 +8,105 @@ namespace X10D.Tests
[TestClass]
public class BooleanTests
{
/// <summary>
/// Tests for <see cref="BooleanExtensions.And" />.
/// </summary>
[TestMethod]
public void And()
{
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.And(b));
Assert.IsFalse(b.And(c));
Assert.IsFalse(c.And(d));
}
/// <summary>
/// Tests for <see cref="BooleanExtensions.NAnd" />.
/// </summary>
[TestMethod]
public void NAnd()
{
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.NAnd(b));
Assert.IsTrue(b.NAnd(c));
Assert.IsTrue(c.NAnd(d));
}
/// <summary>
/// Tests for <see cref="BooleanExtensions.NOr" />.
/// </summary>
[TestMethod]
public void NOr()
{
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.NOr(b));
Assert.IsFalse(b.NOr(c));
Assert.IsTrue(c.NOr(d));
}
/// <summary>
/// Tests for <see cref="BooleanExtensions.Not" />.
/// </summary>
[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());
}
/// <summary>
/// Tests for <see cref="BooleanExtensions.Or" />.
/// </summary>
[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));
}
/// <summary>
/// Tests for <see cref="BooleanExtensions.ToByte" />.
/// </summary>
@ -71,25 +170,10 @@ namespace X10D.Tests
}
/// <summary>
/// Tests for <see cref="BooleanExtensions.Not"/>.
/// Tests for <see cref="BooleanExtensions.XNOr" />.
/// </summary>
[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());
}
/// <summary>
/// Tests for <see cref="BooleanExtensions.And"/>.
/// </summary>
[TestMethod]
public void And()
public void XNOr()
{
const bool a = true;
const bool b = true;
@ -101,30 +185,9 @@ namespace X10D.Tests
Assert.IsFalse(c);
Assert.IsFalse(d);
Assert.IsTrue(a.And(b));
Assert.IsFalse(b.And(c));
Assert.IsFalse(c.And(d));
}
/// <summary>
/// Tests for <see cref="BooleanExtensions.Or"/>.
/// </summary>
[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));
Assert.IsTrue(a.XNOr(b));
Assert.IsFalse(b.XNOr(c));
Assert.IsTrue(c.XNOr(d));
}
/// <summary>
@ -147,68 +210,5 @@ namespace X10D.Tests
Assert.IsTrue(b.XOr(c));
Assert.IsFalse(c.XOr(d));
}
/// <summary>
/// Tests for <see cref="BooleanExtensions.NAnd"/>.
/// </summary>
[TestMethod]
public void NAnd()
{
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.NAnd(b));
Assert.IsTrue(b.NAnd(c));
Assert.IsTrue(c.NAnd(d));
}
/// <summary>
/// Tests for <see cref="BooleanExtensions.NOr"/>.
/// </summary>
[TestMethod]
public void NOr()
{
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.NOr(b));
Assert.IsFalse(b.NOr(c));
Assert.IsTrue(c.NOr(d));
}
/// <summary>
/// Tests for <see cref="BooleanExtensions.XNOr"/>.
/// </summary>
[TestMethod]
public void XNOr()
{
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.XNOr(b));
Assert.IsFalse(b.XNOr(c));
Assert.IsTrue(c.XNOr(d));
}
}
}

View File

@ -1,4 +1,4 @@
namespace X10D.Tests
namespace X10D.Tests.Core
{
using System.Collections.Generic;
using System.Text;

View File

@ -1,4 +1,4 @@
namespace X10D.Tests
namespace X10D.Tests.Core
{
using System;
using System.Linq;

View File

@ -1,4 +1,4 @@
namespace X10D.Tests
namespace X10D.Tests.Core
{
using Microsoft.VisualStudio.TestTools.UnitTesting;

View File

@ -1,4 +1,4 @@
namespace X10D.Tests
namespace X10D.Tests.Core
{
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@ -34,6 +34,16 @@ namespace X10D.Tests
Assert.AreEqual(1.5f, f);
}
/// <summary>
/// Tests for <see cref="ConvertibleExtensions.ToOrNull{T}(System.IConvertible, System.IFormatProvider)" />.
/// </summary>
[TestMethod]
public void ToOrNull()
{
Assert.IsFalse("foo".ToOrNull(out ConvertibleTests t));
Assert.IsNull(t);
}
/// <summary>
/// Tests for <see cref="ConvertibleExtensions.ToOrOther{T}(System.IConvertible, T, System.IFormatProvider)" />.
/// </summary>
@ -44,15 +54,5 @@ namespace X10D.Tests
Assert.IsFalse("Foo".ToOrOther(out var d, 2.0));
Assert.AreEqual(2.0, d);
}
/// <summary>
/// Tests for <see cref="ConvertibleExtensions.ToOrNull{T}(System.IConvertible, System.IFormatProvider)"/>.
/// </summary>
[TestMethod]
public void ToOrNull()
{
Assert.IsFalse("foo".ToOrNull(out ConvertibleTests t));
Assert.IsNull(t);
}
}
}

View File

@ -1,4 +1,4 @@
namespace X10D.Tests
namespace X10D.Tests.Core
{
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@ -17,7 +17,7 @@ namespace X10D.Tests
{
// 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());
@ -41,7 +41,7 @@ namespace X10D.Tests
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);
@ -56,7 +56,7 @@ namespace X10D.Tests
{
{
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);
@ -85,7 +85,7 @@ namespace X10D.Tests
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);

View File

@ -1,4 +1,4 @@
namespace X10D.Tests
namespace X10D.Tests.Core
{
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;

View File

@ -1,4 +1,4 @@
namespace X10D.Tests
namespace X10D.Tests.Core
{
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

View File

@ -1,4 +1,4 @@
namespace X10D.Tests
namespace X10D.Tests.Core
{
using System.Collections.Generic;
using System.Linq;

View File

@ -1,4 +1,4 @@
namespace X10D.Tests
namespace X10D.Tests.Core
{
using System;
using System.ComponentModel;

View File

@ -1,4 +1,4 @@
namespace X10D.Tests
namespace X10D.Tests.Core
{
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

View File

@ -1,4 +1,4 @@
namespace X10D.Tests
namespace X10D.Tests.Core
{
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;