public void GivenLinkWithIntIdInGroupType2WhenLoadThenCiTypeIsLongInt()
        {
            AddLgpAttributes("2");

            var attributeA = _doc.CreateAttribute("A");

            attributeA.Value = "CRT3";

            var attributeB = _doc.CreateAttribute("B");

            attributeB.Value = "8754";

            var attributeC = _doc.CreateAttribute("C");

            attributeC.Value = "http://www.johndeere.com";

            var lnk = _doc.CreateElement("LNK");

            lnk.Attributes.Append(attributeA);
            lnk.Attributes.Append(attributeB);
            lnk.Attributes.Append(attributeC);
            _lgp.AppendChild(lnk);

            var linkIds = LinkGroupLoader.Load(_doc.ChildNodes);

            Assert.AreEqual(IdTypeEnum.LongInt, linkIds[attributeA.Value].First().IdType);
        }
        public void GivenLinkWhenLoadThenSourceIsMapped()
        {
            AddLgpAttributes();

            var attributeA = _doc.CreateAttribute("A");

            attributeA.Value = "CRT3";

            var attributeB = _doc.CreateAttribute("B");

            attributeB.Value = Guid.NewGuid().ToString();

            var attributeC = _doc.CreateAttribute("C");

            attributeC.Value = "http://www.johndeere.com";

            var lnk = _doc.CreateElement("LNK");

            lnk.Attributes.Append(attributeA);
            lnk.Attributes.Append(attributeB);
            lnk.Attributes.Append(attributeC);
            _lgp.AppendChild(lnk);

            var linkIds = LinkGroupLoader.Load(_doc.ChildNodes);

            Assert.AreEqual(attributeC.Value, linkIds[attributeA.Value].First().Source);
        }
        public void GivenLinkGroupWithoutAttributeBWhenLoadThenEmpty()
        {
            var attributeA = _doc.CreateAttribute("A");

            attributeA.Value = "LGP1";
            _lgp.Attributes.Append(attributeA);

            var linkIds = LinkGroupLoader.Load(_doc.ChildNodes);

            Assert.AreEqual(0, linkIds.Count);
        }
        public void GivenLinkWithoutAttributeAWhenLoadThenEmpty()
        {
            AddLgpAttributes();

            var lnk = _doc.CreateElement("LNK");

            _lgp.AppendChild(lnk);

            var linkIds = LinkGroupLoader.Load(_doc.ChildNodes);

            Assert.AreEqual(0, linkIds.Count);
        }
        public void GivenLinkGroupWithoutAttributeCWithGroupType2WhenLoadThenEmpty()
        {
            var attributeA = _doc.CreateAttribute("A");

            attributeA.Value = "LGP1";
            _lgp.Attributes.Append(attributeA);

            var attributeB = _doc.CreateAttribute("B");

            attributeB.Value = "2";
            _lgp.Attributes.Append(attributeB);

            var linkIds = LinkGroupLoader.Load(_doc.ChildNodes);

            Assert.IsEmpty(linkIds);
        }
        public void GivenLinkWithoutAttributeBWhenLoadThenEmpty()
        {
            AddLgpAttributes();

            var attributeA = _doc.CreateAttribute("A");

            attributeA.Value = "RTR9";

            var lnk = _doc.CreateElement("LNK");

            lnk.Attributes.Append(attributeA);
            _lgp.AppendChild(lnk);

            var linkIds = LinkGroupLoader.Load(_doc.ChildNodes);

            Assert.AreEqual(0, linkIds.Count);
        }
示例#7
0
        private static Dictionary <string, List <UniqueId> > LoadLinkList(string currentPath)
        {
            var linkListFile = Path.Combine(currentPath, "TASKDATA", "LINKLIST.XML");

            if (!File.Exists(linkListFile))
            {
                return(new Dictionary <string, List <UniqueId> >());
            }

            var xmlDocument = new XmlDocument();

            xmlDocument.Load(linkListFile);
            var linkList = xmlDocument.SelectSingleNode("ISO11783_LinkList");

            var lgpNodes = linkList.SelectNodes("LGP");

            return(LinkGroupLoader.Load(lgpNodes));
        }
        public void GivenLinkWhenLoadThenIdIsMapped()
        {
            AddLgpAttributes();

            var attributeA = _doc.CreateAttribute("A");

            attributeA.Value = "FRM1";

            var attributeB = _doc.CreateAttribute("B");

            attributeB.Value = Guid.NewGuid().ToString();

            var lnk = _doc.CreateElement("LNK");

            lnk.Attributes.Append(attributeA);
            lnk.Attributes.Append(attributeB);
            _lgp.AppendChild(lnk);

            var linkIds = LinkGroupLoader.Load(_doc.ChildNodes);

            Assert.AreEqual(attributeB.Value, linkIds[attributeA.Value].First().Id);
        }
        public void GivenLinkInGroupType1WhenLoadThenCiTypeIsUuid()
        {
            AddLgpAttributes();

            var attributeA = _doc.CreateAttribute("A");

            attributeA.Value = "CRT3";

            var attributeB = _doc.CreateAttribute("B");

            attributeB.Value = Guid.NewGuid().ToString();

            var lnk = _doc.CreateElement("LNK");

            lnk.Attributes.Append(attributeA);
            lnk.Attributes.Append(attributeB);
            _lgp.AppendChild(lnk);

            var linkIds = LinkGroupLoader.Load(_doc.ChildNodes);

            Assert.AreEqual(IdTypeEnum.UUID, linkIds[attributeA.Value].First().IdType);
        }
示例#10
0
        public void GivenLinkGroupWithoutAttributeAWhenLoadThenEmpty()
        {
            var linkIds = LinkGroupLoader.Load(_doc.ChildNodes);

            Assert.AreEqual(0, linkIds.Count);
        }