How to use the xrm-mock.EnumAttributeMock function in xrm-mock

To help you get started, we’ve selected a few xrm-mock examples, based on popular ways it is used in public projects.

github camelCaseDave / xrm-mock-generator / src / xrm-mock-generator / attribute.js View on Github external
Attribute.prototype.createOptionSet = function (name, options) {
        var optionSetOptions = [];
        if (options && options.length > 0) {
            for (var i = 0; i < options.length; i++) {
                var option = options[i];
                optionSetOptions.push(new XrmMock.OptionSetValueMock(option.name, option.value));
            }
        }

        var attribute = createAttribute(name, options[0]);
        var enumAttribute = new XrmMock.EnumAttributeMock(attribute);
        var optionSetAttribute = new XrmMock.OptionSetAttributeMock(enumAttribute, optionSetOptions);

        addAttribute(optionSetAttribute);
        return optionSetAttribute;
    };