Пример #1
0
        public void GetBprefsBadReturnsEmptyList()
        {
            // Arrange
            const string input     = "wormhole";
            const string publisher = "SBAC_PT";

            // Act
            var result = BpElementUtilities.GetBprefs(input, publisher);

            //Assert
            Assert.IsNotNull(result);
            Assert.IsEmpty(result);
        }
Пример #2
0
        public void GetBprefsGoodStandardNoPipesReturnsValidGroups()
        {
            // Arrange
            const string input     = "SBAC-ELA-v1:2-W";
            const string publisher = "SBAC_PT";

            // Act
            var result = BpElementUtilities.GetBprefs(input, publisher);

            //Assert
            Assert.IsNotNull(result);
            Assert.IsNotEmpty(result);
            Assert.AreEqual(result.Count, 1);
            Assert.AreEqual(result[0].Name.LocalName, "bpref");
            Assert.IsTrue(result[0].Value.Equals("SBAC_PT-2-W", StringComparison.OrdinalIgnoreCase));
        }
Пример #3
0
        public void GetBprefsGoodStandardWithDotsReturnsValidGroups()
        {
            // Arrange
            const string input     = "SBAC-ELA-v1:1-LT|7-3|3.L.5a";
            const string publisher = "SBAC_PT";

            // Act
            var result = BpElementUtilities.GetBprefs(input, publisher);

            //Assert
            Assert.IsNotNull(result);
            Assert.IsNotEmpty(result);
            Assert.AreEqual(result.Count, 3);
            Assert.IsTrue(result[0].Value.Equals("SBAC_PT-1-LT", StringComparison.OrdinalIgnoreCase));
            Assert.IsTrue(result[1].Value.Equals("SBAC_PT-1-LT|7-3", StringComparison.OrdinalIgnoreCase));
            Assert.IsTrue(result[2].Value.Equals("SBAC_PT-1-LT|7-3|3.L.5a", StringComparison.OrdinalIgnoreCase));
        }
Пример #4
0
        public static XElement Construct(AssessmentContent assessmentContent, Item itemInput, string publisher)
        {
            var itemElement = assessmentContent.MainDocument.XPathSelectElement("/itemrelease/item");
            var uniqueId    = $"{itemElement.Attribute("bankkey")?.Value}-{itemElement.Attribute("id")?.Value}";

            var result = new XElement("testitem",
                                      new XAttribute("filename",
                                                     $"item-{uniqueId}.xml"),
                                      new XAttribute("itemtype", itemElement.Attribute("format")?.Value),
                                      Identifier.Construct(uniqueId, itemElement.Attribute("version")?.Value),
                                      PoolProperty.Construct("--ITEMTYPE--", itemElement.Attribute("format")?.Value),
                                      PoolProperty.Construct("Language", "ENU"));
            var grade = itemElement.XPathSelectElement("//attrib[@attid='itm_att_Grade']/val")?.Value;

            if (grade != null)
            {
                result.Add(
                    PoolProperty.Construct("Grade", grade));
            }
            else
            {
                Logger.LogError(new ErrorReportItem
                {
                    Location = $"Test Item Construction: {uniqueId}",
                    Severity = LogLevel.Warn
                }, "Item contains no 'itm_att_Grade' element");
            }
            if (!string.IsNullOrEmpty(itemInput.AssociatedStimuliId))
            {
                result.Add(new XElement("passageref", itemInput.AssociatedStimuliId));
            }
            if (assessmentContent.MetaDocument != null)
            {
                var sXmlNs = new XmlNamespaceManager(new NameTable());
                sXmlNs.AddNamespace("sa", "http://www.smarterapp.org/ns/1/assessment_item_metadata");
                result.Add(assessmentContent.MetaDocument.XPathSelectElements(
                               "metadata/sa:smarterAppMetadata/sa:StandardPublication/sa:PrimaryStandard", sXmlNs)
                           .Select(x => BpElementUtilities.GetBprefs(x.Value, publisher)));
            }
            result.Add(new XElement("bpref", itemInput.SegmentId));
            result.Add(itemElement.XPathSelectElements("//content[@name='language']/@value")
                       .Select(x => PoolProperty.Construct("Language", x.Value)));
            result.Add(ConstructItemScoringNodes(itemInput));
            return(result);
        }
Пример #5
0
        public void GetBprefsGoodStandardWithSinglesReturnsValidGroups()
        {
            // Arrange
            const string input     = "SBAC-ELA-v1:2-W|1-3|G|6|R2D2|L-5";
            const string publisher = "SBAC_PT";

            // Act
            var result = BpElementUtilities.GetBprefs(input, publisher);

            //Assert
            Assert.IsNotNull(result);
            Assert.IsNotEmpty(result);
            Assert.AreEqual(result.Count, 6);
            Assert.IsTrue(result[0].Value.Equals("SBAC_PT-2-W", StringComparison.OrdinalIgnoreCase));
            Assert.IsTrue(result[1].Value.Equals("SBAC_PT-2-W|1-3", StringComparison.OrdinalIgnoreCase));
            Assert.IsTrue(result[2].Value.Equals("SBAC_PT-2-W|1-3|G", StringComparison.OrdinalIgnoreCase));
            Assert.IsTrue(result[3].Value.Equals("SBAC_PT-2-W|1-3|G|6", StringComparison.OrdinalIgnoreCase));
            Assert.IsTrue(result[4].Value.Equals("SBAC_PT-2-W|1-3|G|6|R2D2", StringComparison.OrdinalIgnoreCase));
            Assert.IsTrue(result[5].Value.Equals("SBAC_PT-2-W|1-3|G|6|R2D2|L-5", StringComparison.OrdinalIgnoreCase));
        }