export class PageMock implements Xrm . FormContext { public context : Xrm . GlobalContext ; public data : Xrm . Data ; public ui : Xrm . Ui ; constructor ( context , formContext ) { this . context = context ; this . data = formContext . data ; this . ui = formContext . ui ; } public getAttribute < T extends Xrm . Attributes . Attribute > ( attributeNameOrIndex ) ; public getAttribute < T extends Xrm . Attributes . Attribute > ( delegateFunction ? ) ; public getAttribute < T extends Xrm . Attributes . Attribute > ( param ? ) { if ( ! arguments . length ) { return this . data . entity . attributes . get ( ) ; } else if ( param && typeof param === "string" ) { return this . data . entity . attributes . get < T > ( param ) ; } else if ( typeof param === "number" ) { return this . data . entity . attributes . get ( param ) as T ; } else if ( typeof param === "function" ) { return this . data . entity . attributes . get ( param as Xrm . Collection . MatchingDelegate < T > ) as T [ ] ; } throw new Error ( `Collection.Get called with unknown parameter type: ${ typeof param }` ) ; } public getControl < T extends Xrm . Controls . Control > ( controlNameOrIndex ) ; public getControl < T extends Xrm . Controls . Control > ( delegateFunction ? ) ; public getControl < T extends Xrm . Controls . Control > ( param ? ) { if ( ! arguments . length || param === undefined || param === null ) { return this . ui . controls . get ( ) as T [ ] ; } else if ( typeof param === "string" ) { return this . ui . controls . get < T > ( param ) ; } else if ( typeof param === "number" ) { return this . ui . controls . get ( param ) as T ; } else if ( typeof param === "function" ) { return this . ui . controls . get ( param as Xrm . Collection . MatchingDelegate < T > ) as T [ ] ; } throw new Error ( `Collection.Get called with unknown parameter type: ${ typeof param }` ) ; } }