UNPKG

@drozdik.m/unit-test

Version:

Unit test with test cases with Assert functions. Simple and easy.

79 lines (78 loc) 2.42 kB
export declare class Assert { private static errorCount; /** * Returns error count * */ static ErrorCount(): number; /** * Resets error count * */ static ResetErrorCount(): void; /** * Handles occured error * */ static ErrorOccured(): void; /** * Testing method. If input is false, error is thrown. * @param input Testing sample (boolean) */ static Assert(input: boolean): void; /** * Testing method. If parameter1 == parameter2 is false, error is thrown. * @param expected Expected result * @param actual Actual result */ static AreEqual(expected: any, actual: any): void; /** * Testing method. If parameter1 != parameter2 is false, error is thrown. * @param notExpected Not expected result * @param actual Actual result */ static AreNotEqual(notExpected: any, actual: any): void; /** * Testing method. If type of parameter 1 == type of parameter 2 is false, error is thrown. * @param expected Expected type * @param actual Actual type */ static AreSame(expected: any, actual: any): void; /** * Testing method. If type of parameter 1 != type of parameter 2 is false, error is thrown. * @param notExpected Not expected type * @param actual Actual type */ static AreNotSame(notExpected: any, actual: any): void; /** * Testing method. If the input is not null, error is thrown. * @param input Input */ static IsNull(input: any): void; /** * Testing method. If the input is null, error is thrown. * @param input Input */ static IsNotNull(input: any): void; /** * Testing method. If the input is not undefined, error is thrown. * @param input */ static IsUndefined(input: any): void; /** * Testing method. If the input is undefined, error is thrown. * @param input */ static IsDefined(input: any): void; /** * Testing method. If the input is false, error is called. * @param input Input */ static IsTrue(input: boolean): void; /** * Testing method. If the input is true, error is called. * @param input Input */ static IsFalse(input: boolean): void; /** * Fails an assert. * */ static Fail(): void; }