camelCaseDave/xrm-mock

View on GitHub
src/xrm-mock-generator/formcontext.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import * as XrmMock from "../xrm-mock/index";
import { UiMock } from "../xrm-mock/ui/ui.mock";
import Ui from "./ui";

export default class FormContext {
    public static createFormContext(entity?: XrmMock.IEntityComponents, ui?: XrmMock.IUiComponents,
                                    process?: Xrm.ProcessFlow.ProcessManager): XrmMock.FormContextMock {
    return new XrmMock.FormContextMock(
      new XrmMock.DataMock(
        new XrmMock.EntityMock(entity), process),
        (ui as UiMock) || Ui.createUi(),
    );
  }
}