Exemplo n.º 1
0
        private static AccessibilitySelection MergeSelection(AccessibilitySelection sel, AccessibilityFamilyResource familyResource)
        {
            var    familySel   = familyResource.Selections.SingleOrDefault(fs => fs.Code == sel.SelectionCode);
            var    selDisabled = familyResource.Disabled || familySel == null || familySel.Hidden;
            string label       = (!string.IsNullOrEmpty(familySel?.Label)) ? familySel.Label : sel.Label;

            var newSelection = new AccessibilitySelection(
                code: sel.SelectionCode,
                label: label,
                order: sel.Order,
                disabled: selDisabled,
                hidden: familySel?.Hidden ?? sel.Hidden);

            return(newSelection);
        }
Exemplo n.º 2
0
        public AccessibilityTranslationTests()
        {
            Resources = new List <AccessibilityResource>
            {
                AccessibilityResource.Create(
                    resourceCode: "ACC1",
                    order: 1,
                    disabled: false,
                    defaultSelection: "ACC1_SEL1",
                    currentSelectionCode:  "ACC1_SEL1",
                    label: "Accessibility 1",
                    description: "Accessibility Selection One",
                    selections: ImmutableArray.Create(
                        new AccessibilitySelection(
                            code: "ACC1_SEL1",
                            order: 1,
                            disabled: false,
                            label: "Selection 1",
                            hidden: false))),
                AccessibilityResource.Create(
                    resourceCode: "ACC2",
                    order: 2,
                    disabled: false,
                    defaultSelection: "ACC2_SEL2",
                    currentSelectionCode:  "ACC2_SEL2",
                    label: "Accessibility 2",
                    description: "Accessibility Selection Two",
                    selections: ImmutableArray.Create(
                        new AccessibilitySelection(
                            code: "ACC2_SEL1",
                            order: 1,
                            disabled: false,
                            label: "Selection 1",
                            hidden: false),
                        new AccessibilitySelection(
                            code: "ACC2_SEL2",
                            order: 2,
                            disabled: false,
                            label: "Selection 2",
                            hidden: false)))
            };

            PartialResources = new List <AccessibilityResource>
            {
                AccessibilityResource.Create(
                    resourceCode: "ACC1",
                    selections: ImmutableArray.Create(
                        AccessibilitySelection.Create(
                            code: "ACC1_SEL1",
                            label: "Selection 1"))),
                AccessibilityResource.Create(
                    resourceCode: "ACC2",
                    selections: ImmutableArray.Create(
                        AccessibilitySelection.Create(
                            code: "ACC1_SEL1",
                            label: "Selection 1"),
                        AccessibilitySelection.Create(
                            code: "ACC1_SEL2",
                            label: "Selection 2"))),
            };

            familyResource = new AccessibilityFamilyResource(
                resourceCode: "TDS_CC",
                selections: ImmutableArray <AccessibilityFamilySelection> .Empty,
                disabled: false,
                defaultSelection: null);

            globalResource = new AccessibilityResource(
                resourceCode: "TDS_CC",
                currentSelectionCode: "TDS_CC0",
                order: 5,
                defaultSelection: "TDS_CC0",
                selections: ImmutableArray.Create(
                    new AccessibilitySelection("TDS_CC0", "Black on White", 2, false, false),
                    new AccessibilitySelection("TDS_CCInvert", "Reverse Contrast", 2, false, false),
                    new AccessibilitySelection("TDS_CCMagenta", "Black on Rose", 2, false, false),
                    new AccessibilitySelection("TDS_CCMedGrayLtGray", "Medium Gray on Light Gray", 2, false, false)),
                label: "globalResource",
                description: "globalResource",
                disabled: false,
                resourceType: "globalResource Type");
        }