diff --git a/assertsharp/assertsharp-tests.ts b/assertsharp/assertsharp-tests.ts new file mode 100644 index 0000000000..484e3ac774 --- /dev/null +++ b/assertsharp/assertsharp-tests.ts @@ -0,0 +1,16 @@ +/// + +import Assert from "assertsharp"; + +Assert.AreEqual(0, 0, "Pass"); +Assert.AreNotEqual(0, 1, "Pass"); +Assert.AreNotSame(new Date(), new Date(), "Pass"); +Assert.AreSequenceEqual([0], [0], (x, y) => x === y, "Pass"); +Assert.Fail("Should fail"); +Assert.IsFalse(false, "Pass"); +Assert.IsInstanceOfType(new Date(), Date, "Pass"); +Assert.IsNotInstanceOfType(true, Date, "Pass"); +Assert.IsNotNull(new Date(), "Pass"); +Assert.IsNull(null, "Pass"); +Assert.IsTrue(true, "Pass"); +Assert.Throws(() => { throw ""; }, "Pass"); diff --git a/assertsharp/assertsharp.d.ts b/assertsharp/assertsharp.d.ts new file mode 100644 index 0000000000..c57e10077e --- /dev/null +++ b/assertsharp/assertsharp.d.ts @@ -0,0 +1,16 @@ +declare module "assertsharp" { + export default class Assert { + static AreEqual(expected: T, actual: T, message?: string): void; + static AreNotEqual(notExpected: T, actual: T, message?: string): void; + static AreNotSame(notExpected: T, actual: T, message?: string): void; + static AreSequenceEqual(expected: T[], actual: T[], equals?: (x, y) => boolean, message?: string): void; + static Fail(message?: string): void; + static IsFalse(actual: boolean, message?: string): void; + static IsInstanceOfType(actual: any, expectedType: Function, message?: string): void; + static IsNotInstanceOfType(actual: any, wrongType: Function, message?: string): void; + static IsNotNull(actual: any, message?: string): void; + static IsNull(actual: any, message?: string): void; + static IsTrue(actual: boolean, message?: string): void; + static Throws(fn: () => void, message?: string): void; + } +}