Assert - acadet/oscar GitHub Wiki

Provides methods for asserting when testing.

In brief

class UserTest extends UnitTestClass {
    
    UserIdTest() : void {
        // Arrange
        var expected : number, outcome : number;
        var user : User;
            
        expected = 15;
        user = new User();
            
        // Act
        user.setId(expected);
        outcome = user.getId();

        // Assert
        Assert.areEqual(expected, outcome);
    }
}

References

public static isTrue(value : boolean) : void;

Asserts provided value is true.


public static isFalse(value : boolean) : void;

Asserts provided value is false.


public static isNull<T>(value : T) : void;

Asserts provided value is null.


public static isNotNull<T>(value : T) : void;

Asserts provided value is not null.


public static areEqual<T>(expected : T, value : T) : void;

Asserts provided values are equal.


public static areNotEqual<T>(unexpected : T, value : T) : void;

Asserts provided values are not equal.


public static throws(func : () => void) : void;

Asserts provided function throws an error.