"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
const internal_1 = require("../../../internal");
const testHelper_1 = require("../../testHelper");
/**
 * Unit test for CardinalitySetting functions
 */
describe('Cdm/Projection/CardinalitySettingUnitTest', () => {
    /**
     * The path between TestDataPath and TestName.
     */
    const testsSubpath = 'Cdm/Projection/TestCardinalitySetting';
    /**
     * Unit test for CardinalitySetting.IsMinimumValid
     */
    it('TestMinimum', () => {
        const testName = 'TestMinimum';
        const corpus = testHelper_1.testHelper.getLocalCorpus(testsSubpath, testName);
        corpus.setEventCallback((statusLevel, message) => {
            if (message.indexOf('CardinalitySettings | Invalid minimum cardinality -1.') === -1) {
                throw new Error(`Some unexpected failure - ${message}!`);
            }
        }, internal_1.cdmStatusLevel.warning);
        // Create Dummy Type Attribute
        const attribute = corpus.MakeObject(internal_1.cdmObjectType.typeAttributeDef, "dummyAttribute", false);
        attribute.cardinality = new internal_1.CardinalitySettings(attribute);
        attribute.cardinality.minimum = '-1';
    });
    /**
     * Unit test for CardinalitySetting.IsMaximumValid
     */
    it('TestMaximum', () => {
        const testName = 'TestMaximum';
        const corpus = testHelper_1.testHelper.getLocalCorpus(testsSubpath, testName);
        corpus.setEventCallback((statusLevel, message) => {
            if (message.indexOf('CardinalitySettings | Invalid maximum cardinality Abc.') === -1) {
                throw new Error(`Some unexpected failure - ${message}!`);
            }
        }, internal_1.cdmStatusLevel.warning);
        // Create Dummy Type Attribute
        const attribute = corpus.MakeObject(internal_1.cdmObjectType.typeAttributeDef, "dummyAttribute", false);
        attribute.cardinality = new internal_1.CardinalitySettings(attribute);
        attribute.cardinality.maximum = 'Abc';
    });
});
//# sourceMappingURL=CardinalitySetting.test.js.map