public void TestToAccessibilityResourceNotModified() { ImmutableArray <AccessibilityFamilyResource> resource = ImmutableArray.Create <AccessibilityFamilyResource>(); AccessibilityFamilyResource familyResource = new AccessibilityFamilyResource( resourceCode: "ACC1", selections: ImmutableArray <AccessibilityFamilySelection> .Empty, disabled: false, defaultSelection: null); resource.Add(familyResource); AccessibilityFamily noPartialResources = new AccessibilityFamily( subjects: new ImmutableArray <string>(), grades: GradeLevels.NA, resources: resource); AccessibilityResource inputResource = Resources[1]; List <AccessibilityResource> inputResources = new List <AccessibilityResource> { inputResource }; var resultResources = AccessibilityResourceTranslation.MergeGlobalResources(noPartialResources, inputResources); Assert.Equal(inputResources.Count, resultResources.Resources.Count()); AccessibilityResource outputResource = resultResources.Resources[0]; Assert.Equal(inputResource.CurrentSelectionCode, outputResource.CurrentSelectionCode); Assert.Equal(inputResource.Description, outputResource.Description); Assert.Equal(inputResource.Disabled, outputResource.Disabled); Assert.Equal(inputResource.DefaultSelection, outputResource.DefaultSelection); Assert.Equal(inputResource.Order, outputResource.Order); Assert.Equal(inputResource.Selections.Count(), outputResource.Selections.Length); }
private static ImmutableArray <MergedAccessibilityFamily> LoadAccessibility(string accessibilityPath) { var accessibilityDoc = XmlSerialization.GetXDocument(accessibilityPath); var accessibilityXml = accessibilityDoc.Element("Accessibility"); var mergedFamilies = AccessibilityResourceTranslation.CreateMergedFamilies(accessibilityXml); return(mergedFamilies); }
public void TestToAccessibilityResourcesMatchingPartialResource() { ImmutableArray <AccessibilityFamilyResource> resource = ImmutableArray.Create <AccessibilityFamilyResource>(); AccessibilityFamily noPartialResources = new AccessibilityFamily( subjects: new ImmutableArray <string>(), grades: GradeLevels.NA, resources: resource); var resultResources = AccessibilityResourceTranslation.MergeGlobalResources(noPartialResources, Resources); Assert.Equal(Resources.Count, resultResources.Resources.Length); }
public void TestToAccessibilityResourcesNotModified() { ImmutableArray <AccessibilityFamilyResource> noPartialResources = ImmutableArray.Create <AccessibilityFamilyResource>(); ImmutableArray <string> subject = new ImmutableArray <string>(); AccessibilityFamily noPartialResourcesFamily = new AccessibilityFamily( subjects: subject, grades: GradeLevels.NA, resources: noPartialResources); var resultResources = AccessibilityResourceTranslation.MergeGlobalResources(noPartialResourcesFamily, Resources); Assert.Equal(Resources.Count, resultResources.Resources.Length); }
/// <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 TestToAccessibilityDisabledAllSelections() { AccessibilityResource globalResource = Resources[1]; AccessibilityFamilyResource partialResource = new AccessibilityFamilyResource( resourceCode: "ACC2", selections: ImmutableArray <AccessibilityFamilySelection> .Empty, disabled: false, defaultSelection: null); AccessibilityResource outputResource = AccessibilityResourceTranslation .MergeGlobalResource(partialResource, globalResource); Assert.Equal(globalResource.CurrentSelectionCode, outputResource.CurrentSelectionCode); Assert.Equal(false, outputResource.Disabled); Assert.Equal(globalResource.Label, outputResource.Label); Assert.Equal(globalResource.Selections.Count(), outputResource.Selections.Count()); foreach (var sel in outputResource.Selections) { Assert.Equal(true, sel.Disabled); } }
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); } }
public void TestToSampleItems() { var digests = ImmutableArray.Create(digest); ImmutableArray <AccessibilityFamilyResource> noPartialResources = ImmutableArray.Create <AccessibilityFamilyResource>(); var subjectMath = ImmutableArray.Create("MATH"); AccessibilityFamily noPartialResourcesFamily = new AccessibilityFamily( subjects: subjectMath, grades: GradeLevels.Grade5, resources: noPartialResources); MergedAccessibilityFamily resourceFamily = AccessibilityResourceTranslation.MergeGlobalResources(noPartialResourcesFamily, Resources); var resourceFamilies = ImmutableArray.Create(resourceFamily); Claim1 = new Claim("claim1", "1", "ELA Claim 1"); Claim2 = new Claim("claim2", "2", "3"); ItMath = new InteractionType("2", "EQ", "", 2); ItEla = new InteractionType("1", "WER", "", 1); Math = Subject.Create("MATH", "Mathematics", "Math", ImmutableArray.Create(Claim2), ImmutableArray.Create(ItMath.Code)); Ela = Subject.Create("ELA", "English", "ELA", ImmutableArray.Create(Claim1), ImmutableArray.Create(ItEla.Code)); var interactionTypes = ImmutableArray.Create(ItEla, ItMath); var subjects = ImmutableArray.Create(Ela, Math); StandardIdentifier identifier = StandardIdentifierTranslation.StandardStringToStandardIdentifier("SBAC-ELA-v1:3-L|4-6|6.SL.2"); var coreStandardsRowCcss = ImmutableArray.Create( CoreStandardsRow.Create( subjectCode: "ELA", key: "3-l|4-6|6.SL.2", name: "", description: "CCSS Desc", levelType: "CCSS", identifier: identifier)); var coreStandardsRowTarget = ImmutableArray.Create( CoreStandardsRow.Create( subjectCode: "ELA", key: "4-6|3-6", name: "", description: "Target Desc", levelType: "Target", identifier: identifier)); CoreStandardsXml coreStandardsXml = new CoreStandardsXml(coreStandardsRowTarget, coreStandardsRowCcss); var itemPatch = ImmutableArray.Create(new ItemPatch()); var brailleFileInfo = new List <BrailleFileInfo>(); var items = SampleItemTranslation.ToSampleItems(digests, resourceFamilies, interactionTypes, subjects, coreStandardsXml, itemPatch, brailleFileInfo, appSettings); Assert.NotNull(items); Assert.Equal(items[0].AccessibilityResourceGroups[0].AccessibilityResources[0].Label, Resources[0].Label); Assert.Equal(items[0].AccessibilityResourceGroups[0].AccessibilityResources[0].Order, Resources[0].Order); Assert.Equal(items[0].AccessibilityResourceGroups[0].AccessibilityResources[0].ResourceCode, Resources[0].ResourceCode); Assert.Equal(items[0].AccessibilityResourceGroups[0].AccessibilityResources[0].ResourceTypeId, Resources[0].ResourceTypeId); Assert.Equal(items[0].SufficentEvidenceOfClaim, metadata.Metadata.SufficientEvidenceOfClaim); Assert.Equal(items[0].TargetAssessmentType, metadata.Metadata.TargetAssessmentType); Assert.Equal(items[0].Grade, GradeLevelsUtils.FromString(digest.GradeCode)); Assert.Equal(items[0].ItemKey, digest.ItemKey); Assert.Equal(items[0].BankKey, digest.BankKey); Assert.Equal(items[0].CoreStandards.CommonCoreStandardsDescription, coreStandardsRowCcss[0].Description); Assert.Equal(items[0].CoreStandards.TargetDescription, coreStandardsRowTarget[0].Description); Assert.Equal(items[0].InteractionType.Code, ItMath.Code); Assert.Equal(items[0].InteractionType.Label, ItMath.Label); Assert.Equal(items[0].Subject.Code, digest.SubjectCode); }
public void TestMergeWithThrowsOnNulls() { Assert.Throws <ArgumentNullException>(() => AccessibilityResourceTranslation.MergeGlobalResource(familyResource, null)); Assert.Throws <ArgumentNullException>(() => AccessibilityResourceTranslation.MergeGlobalResource(null, globalResource)); Assert.Throws <ArgumentNullException>(() => AccessibilityResourceTranslation.MergeGlobalResource(null, null)); }