private static CoreStandards ApplyPatchToCoreStandards(StandardIdentifier identifier, CoreStandards coreStandards, CoreStandardsXml standardsXml, ItemPatch patch) { string claimNumber = Regex.Match(input: patch.Claim, pattern: @"\d+").Value; if (identifier == null) { identifier = StandardIdentifier.Create(claim: claimNumber, target: patch.Target); } else { string target = (!string.IsNullOrEmpty(patch.Target)) ? patch.Target : identifier.Target; claimNumber = (!string.IsNullOrEmpty(claimNumber)) ? claimNumber : identifier.Claim; identifier = identifier.WithClaimAndTarget(claimNumber, target); } string targetDesc = (!string.IsNullOrEmpty(patch.TargetDescription)) ? patch.TargetDescription : coreStandards?.TargetDescription; string ccssDesc = (!string.IsNullOrEmpty(patch.CCSSDescription)) ? patch.CCSSDescription : coreStandards?.CommonCoreStandardsDescription; coreStandards = StandardIdentifierTranslation.CoreStandardFromIdentifier(standardsXml, identifier); coreStandards = coreStandards.WithTargetCCSSDescriptions(targetDesc, ccssDesc); return(coreStandards); }
public static CoreStandards CoreStandardFromIdentifier( CoreStandardsXml standardsXml, StandardIdentifier itemIdentifier) { CoreStandardsRow targetRow = null; CoreStandardsRow ccssRow = null; if (standardsXml != null && standardsXml.TargetRows.Any()) { targetRow = standardsXml.TargetRows .FirstOrDefault(t => StandardIdentifierTargetComparer.Instance.Equals(t.StandardIdentifier, itemIdentifier)); } if (standardsXml != null && standardsXml.CcssRows.Any()) { ccssRow = standardsXml.CcssRows .FirstOrDefault(t => StandardIdentifierCcssComparer.Instance.Equals(t.StandardIdentifier, itemIdentifier)); } return(CoreStandards.Create( targetId: itemIdentifier?.Target, targetIdLabel: itemIdentifier?.ToTargetId(), commonCoreStandardsId: itemIdentifier?.CommonCoreStandard, commonCoreStandardsDescription: ccssRow?.Description, targetDescription: targetRow?.Description, claimId: itemIdentifier?.ToClaimId(), publication: itemIdentifier?.Publication)); }
public void TestCoreStandardFromIdentifier() { StandardIdentifier identifier = StandardIdentifierTranslation.StandardStringToStandardIdentifier(elaStandardString); 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); CoreStandards core = StandardIdentifierTranslation.CoreStandardFromIdentifier(coreStandardsXml, identifier); Assert.NotNull(core); Assert.Equal(core.CommonCoreStandardsId, "6.SL.2"); Assert.Equal(core.TargetId, "4-6"); Assert.Equal(core.TargetIdLabel, "4"); Assert.Equal(core.TargetDescription, "Target Desc"); Assert.Equal(core.CommonCoreStandardsDescription, "CCSS Desc"); }
public void TestNullCoreStandardToIdentifier() { CoreStandardsRow coreStandardsRow = new CoreStandardsRow("", "3-l", null, null, null, null); StandardIdentifier identifier = StandardIdentifierTranslation.CoreStandardToIdentifier(coreStandardsRow); Assert.Null(identifier); }
public void TestElaV1Translation() { StandardIdentifier identifier = StandardIdentifierTranslation.StandardStringToStandardIdentifier(elaStandardString); Assert.Equal("3-L", identifier.Claim); Assert.Equal("4-6", identifier.Target); Assert.Equal("6.SL.2", identifier.CommonCoreStandard); }
public void TestMathNotEqualCCSS() { StandardIdentifier x = DefaultWith(subjectCode: subjectMath); StandardIdentifier y = DefaultWith(subjectCode: subjectMath, commonCoreStandard: Ccss2); Assert.False(StandardIdentifierCcssComparer.Instance.Equals(x, y)); Assert.True(StandardIdentifierTargetComparer.Instance.Equals(x, y)); }
public void TestMathNotEqualEmphasis() { StandardIdentifier x = DefaultWith(subjectCode: subjectMath); StandardIdentifier y = DefaultWith(subjectCode: subjectMath, contentDomain: emphasis2); Assert.False(StandardIdentifierCcssComparer.Instance.Equals(x, y)); Assert.False(StandardIdentifierTargetComparer.Instance.Equals(x, y)); }
public void TestElaNotEqualTarget() { StandardIdentifier x = DefaultWith(subjectCode: subjectEla); StandardIdentifier y = DefaultWith(subjectCode: subjectEla, target: target2); Assert.False(StandardIdentifierCcssComparer.Instance.Equals(x, y)); Assert.False(StandardIdentifierTargetComparer.Instance.Equals(x, y)); }
public void TestElaCoreStandardToTarget() { StandardIdentifier identifier = StandardIdentifierTranslation.ElaCoreStandardToTarget(new string[] { "4-6", "3-6" }); Assert.Equal("4-6", identifier.Claim); Assert.Equal("3-6", identifier.Target); Assert.Equal("ELA", identifier.SubjectCode); }
public void TestInvalidMathV1String() { StandardIdentifier identifier = StandardIdentifierTranslation.StandardStringToStandardIdentifier(invalidMathV1StandardString); Assert.Equal("1", identifier.Claim); Assert.Equal(string.Empty, identifier.Target); Assert.Equal(string.Empty, identifier.CommonCoreStandard); }
public void TestMathEqual() { StandardIdentifier x = DefaultWith(subjectMath); StandardIdentifier y = DefaultWith(subjectMath); Assert.True(StandardIdentifierCcssComparer.Instance.Equals(x, y)); Assert.True(StandardIdentifierTargetComparer.Instance.Equals(x, y)); }
public void TestMathCoreStandardToTarget() { StandardIdentifier identifier = StandardIdentifierTranslation.MathCoreStandardToTarget(new string[] { "1", "NBT", "E-3" }); Assert.Equal("1", identifier.Claim); Assert.Equal("NBT", identifier.ContentDomain); Assert.Equal("E-3", identifier.Target); Assert.Equal("MATH", identifier.SubjectCode); }
public void TestInvalidMathV6String() { StandardIdentifier identifier = StandardIdentifierTranslation.StandardStringToStandardIdentifier(invalidMathV6StandardString); Assert.Equal("3", identifier.Claim); Assert.Equal(string.Empty, identifier.ContentCategory); Assert.Equal(string.Empty, identifier.TargetSet); Assert.Equal(string.Empty, identifier.TargetSet); }
public static StandardIdentifier ElaV1Standard(string[] parts, string publication) { return(StandardIdentifier.Create( claim: GetStandardPartOrDefault(parts, 0), target: GetStandardPartOrDefault(parts, 1), commonCoreStandard: GetStandardPartOrDefault(parts, 2), subjectCode: "ELA", publication: publication)); }
public void TestMathV6Translation() { StandardIdentifier identifier = StandardIdentifierTranslation.StandardStringToStandardIdentifier(mathV6StandardString); Assert.Equal("3", identifier.Claim); Assert.Equal("D-6", identifier.Target); Assert.Equal("P", identifier.ContentCategory); Assert.Equal("TS04", identifier.TargetSet); }
public void TestMathV1Translation() { StandardIdentifier identifier = StandardIdentifierTranslation.StandardStringToStandardIdentifier(mathv1StandardString); Assert.Equal("1", identifier.Claim); Assert.Equal("NBT", identifier.ContentDomain); Assert.Equal("E-3", identifier.Target); Assert.Equal("3.NBT.2", identifier.CommonCoreStandard); }
public void TestCoreStandardToIdentifierELATarget() { CoreStandardsRow coreStandardsRow = new CoreStandardsRow("ELA", "4-6|3-6", "", "", "Target", null); StandardIdentifier identifier = StandardIdentifierTranslation.CoreStandardToIdentifier(coreStandardsRow); Assert.Equal("4-6", identifier.Claim); Assert.Equal("3-6", identifier.Target); Assert.Equal("ELA", identifier.SubjectCode); }
public void TestCoreStandardToIdentifierMathTarget() { CoreStandardsRow coreStandardsRow = new CoreStandardsRow("MATH", "1|NBT|E-3", "", "", "Target", null); StandardIdentifier identifier = StandardIdentifierTranslation.CoreStandardToIdentifier(coreStandardsRow); Assert.Equal("1", identifier.Claim); Assert.Equal("NBT", identifier.ContentDomain); Assert.Equal("E-3", identifier.Target); Assert.Equal("MATH", identifier.SubjectCode); }
public static StandardIdentifier MaV6Standard(string[] parts, string publication) { return(StandardIdentifier.Create( claim: GetStandardPartOrDefault(parts, 0), target: GetStandardPartOrDefault(parts, 3), contentCategory: GetStandardPartOrDefault(parts, 1), targetSet: GetStandardPartOrDefault(parts, 2), subjectCode: "MATH", publication: publication)); }
public void TestMathV5Translation() { StandardIdentifier identifier = StandardIdentifierTranslation.StandardStringToStandardIdentifier(mathV5StandardString); Assert.Equal("2", identifier.Claim); Assert.Equal("D-6", identifier.Target); Assert.Equal("6.NS.6c", identifier.CommonCoreStandard); Assert.Equal("NS", identifier.ContentDomain); Assert.Equal("m", identifier.Emphasis); }
public void TestInvalidMathV5String() { StandardIdentifier identifier = StandardIdentifierTranslation.StandardStringToStandardIdentifier(invalidMathV5StandardString); Assert.Equal("2", identifier.Claim); Assert.Equal("6.NS.6c", identifier.CommonCoreStandard); Assert.Equal(string.Empty, identifier.Target); Assert.Equal(string.Empty, identifier.ContentDomain); Assert.Equal(string.Empty, identifier.Emphasis); }
public void TestCoreStandardToIdentifierMathCcss() { CoreStandardsRow coreStandardsRow = new CoreStandardsRow("MATH", "1|NBT|E-3|a/s|3.NBT.2", "", "", "CCSS", null); StandardIdentifier identifier = StandardIdentifierTranslation.CoreStandardToIdentifier(coreStandardsRow); Assert.Equal("1", identifier.Claim); Assert.Equal("NBT", identifier.ContentDomain); Assert.Equal("E-3", identifier.Target); Assert.Equal("3.NBT.2", identifier.CommonCoreStandard); }
public void TestCoreStandardToIdentifierELACcss() { CoreStandardsRow coreStandardsRow = new CoreStandardsRow("ELA", "3-l|4-6|6.SL.2", "", "", "CCSS", null); StandardIdentifier identifier = StandardIdentifierTranslation.CoreStandardToIdentifier(coreStandardsRow); Assert.Equal("3-l", identifier.Claim); Assert.Equal("4-6", identifier.Target); Assert.Equal("6.SL.2", identifier.CommonCoreStandard); Assert.Equal("ELA", identifier.SubjectCode); }
public void TestMathCoreStandardToCcss() { StandardIdentifier identifier = StandardIdentifierTranslation.MathCoreStandardToCcss(new string[] { "4-6", "NS", "3-6", "m", "6.NS.6c" }); Assert.Equal("4-6", identifier.Claim); Assert.Equal("3-6", identifier.Target); Assert.Equal("6.NS.6c", identifier.CommonCoreStandard); Assert.Equal("NS", identifier.ContentDomain); Assert.Equal("MATH", identifier.SubjectCode); }
/* * Locate and parse the standard, claim, and target from the metadata * * Claim and target are specified in one of the following formats: * SBAC-ELA-v1 (there is only one alignment for ELA, this is used for delivery) * Claim|Assessment Target|Common Core Standard * SBAC-MA-v6 (Math, based on the blueprint hierarchy, primary alignment and does not go to standard level, THIS IS USED FOR DELIVERY, should be the same as SBAC-MA-v4) * Claim|Content Category|Target Set|Assessment Target * SBAC-MA-v5 (Math, based on the content specifications hierarchy secondary alignment to the standard level) * Claim|Content Domain|Target|Emphasis|Common Core Standard * SBAC-MA-v4 (Math, based on the content specifications hierarchy primary alignment to the standard level) * Claim|Content Domain|Target|Emphasis|Common Core Standard */ public static StandardIdentifier StandardStringToStandardIdentifier(string standards) { if (string.IsNullOrEmpty(standards)) { // TODO: log error return(null); } string[] publicationAndKey = standards.Split(':'); if (publicationAndKey.Length < 2) { return(null); // TODO: log error instead //throw new ArgumentException("The standards string does not contain a publication and claim spearated by a colon."); } StandardIdentifier standardIdentifier = null; string publication = publicationAndKey[0]; string[] parts = publicationAndKey[1].Split('|'); switch (publication) { case "SBAC-ELA-v1": standardIdentifier = ElaV1Standard(parts, standards); break; case "SBAC-MA-v1": standardIdentifier = MaV1Standard(parts, standards); break; case "SBAC-MA-v4": standardIdentifier = MaV4Standard(parts, standards); break; case "SBAC-MA-v5": standardIdentifier = MaV5Standard(parts, standards); break; case "SBAC-MA-v6": standardIdentifier = MaV6Standard(parts, standards); break; } if (standardIdentifier == null) { standardIdentifier = StandardIdentifier.Create( claim: parts[0]); } return(standardIdentifier); }
public static StandardIdentifier MaV5Standard(string[] parts, string publication) { return(StandardIdentifier.Create( claim: GetStandardPartOrDefault(parts, 0), target: GetStandardPartOrDefault(parts, 2), contentDomain: GetStandardPartOrDefault(parts, 1), emphasis: GetStandardPartOrDefault(parts, 3), commonCoreStandard: GetStandardPartOrDefault(parts, 4), subjectCode: "MATH", publication: publication)); }
public void TestToTargetId() { StandardIdentifier identifier = StandardIdentifierTranslation.StandardStringToStandardIdentifier(elaStandardString); var targetId = StandardIdentifierTranslation.ToTargetId(identifier); identifier = StandardIdentifierTranslation.StandardStringToStandardIdentifier(noTargetString); var noTargetId = StandardIdentifierTranslation.ToTargetId(identifier); Assert.Equal("4", targetId); Assert.Equal(string.Empty, noTargetId); }
public void TestToClaimId() { StandardIdentifier identifier = StandardIdentifierTranslation.StandardStringToStandardIdentifier(elaStandardString); var claimId = StandardIdentifierTranslation.ToClaimId(identifier); identifier = StandardIdentifierTranslation.StandardStringToStandardIdentifier(noClaimString); var noClaimId = StandardIdentifierTranslation.ToClaimId(identifier); Assert.Equal("3", claimId); Assert.Equal(string.Empty, noClaimId); }
public static StandardIdentifier ElaCoreStandardToTarget(string[] parts) { if (parts == null || parts.Length != 2) { return(null); } return(StandardIdentifier.Create( claim: parts[0], target: parts[1], subjectCode: "ELA")); }
public void TestToStandardIdentifierGoodDigest() { ItemDigest digest = ItemDigestTranslation.ToItemDigest(metadata, contents, appSettings); StandardIdentifier identifier = StandardIdentifierTranslation.ToStandardIdentifier(digest, new string[] { "SBAC-MA-v1" }); Assert.NotNull(identifier); Assert.Equal(digest.SubjectCode, identifier.SubjectCode); Assert.Equal("1", identifier.Claim); Assert.Equal("3.NBT.2", identifier.CommonCoreStandard); Assert.Equal("NBT", identifier.ContentDomain); Assert.Equal("E-3", identifier.Target); }