// ========================================================
namespace Kerosene.Tools.Test
{
using System;
// ====================================================
public class Test_Calendar
{
public static void Execute(bool pressEnter = true)
{
ConsoleHelper.Header(pressEnter, "\n\n=== {0} ...", MethodHelper.ThisMethod());
{
CalendarDate a = null;
CalendarDate b = null;
int c = CalendarDate.Compare(a, b);
if (c != 0) throw new Exception(string.Format("({0}) should be == ({1}), result: {2}", a, b, c));
}
{
CalendarDate a = new CalendarDate(2000, 1, 1);
CalendarDate b = null;
int c = CalendarDate.Compare(a, b);
if (c != +1) throw new Exception(string.Format("({0}) should be > ({1}), result: {2}", a, b, c));
}
{
CalendarDate a = null;
CalendarDate b = new CalendarDate(2000, 1, 1);
int c = CalendarDate.Compare(a, b);
if (c != -1) throw new Exception(string.Format("({0}) should be < ({1}), result: {2}", a, b, c));
}
{
CalendarDate a = new CalendarDate(2000, 1, 1);
CalendarDate b = new CalendarDate(2000, 1, 1);
int c = CalendarDate.Compare(a, b);
if (c != 0) throw new Exception(string.Format("({0}) should be == ({1}), result: {2}", a, b, c));
}
{
CalendarDate a = new CalendarDate(2000, 1, 2);
CalendarDate b = new CalendarDate(2000, 1, 1);
int c = CalendarDate.Compare(a, b);
if (c != +1) throw new Exception(string.Format("({0}) should be > ({1}), result: {2}", a, b, c));
}
{
CalendarDate a = new CalendarDate(2000, 1, 1);
CalendarDate b = new CalendarDate(2000, 1, 2);
int c = CalendarDate.Compare(a, b);
if (c != -1) throw new Exception(string.Format("({0}) should be < ({1}), result: {2}", a, b, c));
}
{
CalendarDate a = new CalendarDate(2000, 1, 1);
CalendarDate b = null;
int c = a.CompareTo(b);
if (c != +1) throw new Exception(string.Format("({0}) should be > ({1}), result: {2}", a, b, c));
}
{
CalendarDate a = new CalendarDate(2000, 1, 1);
CalendarDate b = new CalendarDate(2000, 1, 1);
int c = a.CompareTo(b);
if (c != 0) throw new Exception(string.Format("({0}) should be == ({1}), result: {2}", a, b, c));
}
{
CalendarDate a = new CalendarDate(2000, 1, 2);
CalendarDate b = new CalendarDate(2000, 1, 1);
int c = a.CompareTo(b);
if (c != +1) throw new Exception(string.Format("({0}) should be > ({1}), result: {2}", a, b, c));
}
{
CalendarDate a = new CalendarDate(2000, 1, 1);
CalendarDate b = new CalendarDate(2000, 1, 2);
int c = a.CompareTo(b);
if (c != -1) throw new Exception(string.Format("({0}) should be > ({1}), result: {2}", a, b, c));
}
{
CalendarDate a = null;
CalendarDate b = null;
bool c = (a == b);
if (!c) throw new Exception(string.Format("({0}) should be == ({1}), result: {2}", a, b, c));
}
{
CalendarDate a = new CalendarDate(2000, 1, 1);
CalendarDate b = new CalendarDate(2000, 1, 1);
bool c = (a == b);
if (!c) throw new Exception(string.Format("({0}) should be == ({1}), result: {2}", a, b, c));
}
{
CalendarDate a = null;
CalendarDate b = null;
bool c = (a != b);
if (c) throw new Exception(string.Format("({0}) should be == ({1}), result: {2}", a, b, c));
}
{
CalendarDate a = new CalendarDate(2000, 1, 1);
CalendarDate b = new CalendarDate(2000, 1, 1);
bool c = (a != b);
if (c) throw new Exception(string.Format("({0}) should be == ({1}), result: {2}", a, b, c));
}
{
CalendarDate a = new CalendarDate(2000, 1, 2);
CalendarDate b = new CalendarDate(2000, 1, 1);
bool c = (a > b);
if (!c) throw new Exception(string.Format("({0}) should be > ({1}), result: {2}", a, b, c));
}
{
CalendarDate a = new CalendarDate(2000, 1, 1);
CalendarDate b = new CalendarDate(2000, 1, 2);
bool c = (a > b);
if (c) throw new Exception(string.Format("({0}) should be < ({1}), result: {2}", a, b, c));
}
{
CalendarDate a = new CalendarDate(2000, 1, 2);
CalendarDate b = new CalendarDate(2000, 1, 1);
bool c = (a < b);
if (c) throw new Exception(string.Format("({0}) should be > ({1}), result: {2}", a, b, c));
}
{
CalendarDate a = new CalendarDate(2000, 1, 1);
CalendarDate b = new CalendarDate(2000, 1, 2);
bool c = (a < b);
if (!c) throw new Exception(string.Format("({0}) should be < ({1}), result: {2}", a, b, c));
}
{
CalendarDate a = new CalendarDate(2000, 1, 1);
CalendarDate b = new CalendarDate(2000, 1, 1);
bool c = (a >= b);
if (!c) throw new Exception(string.Format("({0}) should be >= ({1}), result: {2}", a, b, c));
}
{
CalendarDate a = new CalendarDate(2000, 1, 1);
CalendarDate b = new CalendarDate(2000, 1, 1);
bool c = (a <= b);
if (!c) throw new Exception(string.Format("({0}) should be <= ({1}), result: {2}", a, b, c));
}
}
}
}
// ========================================================