/// <summary> /// Tests that a global accessibility resource copy is not modified /// from the original given a partial accessibility resource that /// contains all of the select elements /// </summary> [Fact] public void TestToAccessibilityResourceNoChanges() { AccessibilityResource globalResource = Resources[1]; AccessibilityFamilyResource partialResource = new AccessibilityFamilyResource( resourceCode: "ACC1", selections: ImmutableArray.Create( AccessibilityFamilySelection.Create(code: "ACC2_SEL1"), AccessibilityFamilySelection.Create(code: "ACC2_SEL2")), disabled: false, defaultSelection: null); AccessibilityResource outputResource = AccessibilityResourceTranslation .MergeGlobalResource(partialResource, globalResource); Assert.Equal(globalResource.CurrentSelectionCode, outputResource.CurrentSelectionCode); Assert.Equal(globalResource.Disabled, outputResource.Disabled); Assert.Equal(globalResource.Label, outputResource.Label); Assert.Equal(globalResource.DefaultSelection, outputResource.DefaultSelection); Assert.Equal(globalResource.Selections.Count(), outputResource.Selections.Count()); }
public void TestToAccessibilityDisabledSomeSelections() { AccessibilityResource globalResource = Resources[1]; AccessibilityFamilyResource partialResource = new AccessibilityFamilyResource( resourceCode: "TDS_CC", disabled: false, defaultSelection: null, selections: ImmutableArray.Create(AccessibilityFamilySelection.Create(code: "ACC2_SEL1"))); AccessibilityResource outputResource = AccessibilityResourceTranslation .MergeGlobalResource(partialResource, globalResource); Assert.Equal("ACC2_SEL1", outputResource.CurrentSelectionCode); Assert.Equal(false, outputResource.Disabled); Assert.Equal(globalResource.Label, outputResource.Label); // Check that default selection was also updated Assert.Equal("ACC2_SEL1", outputResource.DefaultSelection); Assert.Equal(globalResource.Selections.Length, outputResource.Selections.Length); Assert.Equal(false, outputResource.Selections[0].Disabled); Assert.Equal(true, outputResource.Selections[1].Disabled); }
public void TestToAccessibilityDisabledResource() { AccessibilityResource globalResource = Resources[1]; AccessibilityFamilyResource partialResource = new AccessibilityFamilyResource( resourceCode: "ACC2", disabled: true, defaultSelection: null, selections: ImmutableArray.Create( AccessibilityFamilySelection.Create(code: "ACC2_SEL1"), AccessibilityFamilySelection.Create(code: "ACC2_SEL2"))); AccessibilityResource outputResource = AccessibilityResourceTranslation.MergeGlobalResource(partialResource, globalResource); Assert.Equal(globalResource.CurrentSelectionCode, outputResource.CurrentSelectionCode); Assert.True(outputResource.Disabled); Assert.Equal(globalResource.Label, outputResource.Label); Assert.Equal(globalResource.DefaultSelection, outputResource.DefaultSelection); Assert.Equal(globalResource.Selections.Length, outputResource.Selections.Length); foreach (var sel in outputResource.Selections) { Assert.True(sel.Disabled); } }