Пример #1
0
        public override bool InsertData(node data)
        {
            int temp = 0;

            //Validate - added due to test failure
            if (data == null || !Int32.TryParse(data.id, out temp))
            {
                return false;
            }

            NODES nodeRow = new NODES();
            NODE_LINKS linkRow = null;

            nodeRow.NODE_ID = Convert.ToInt32(data.id);
            nodeRow.NODE_LABEL = data.label;

            _nodeRepo.Create(nodeRow);
            _nodeRepo.Save();

            foreach (nodeAdjacentNodesID adjacent in data.adjacentNodes)
            {
                linkRow = new NODE_LINKS();

                linkRow.NODE_ID = nodeRow.NODE_ID;
                linkRow.ADJACENT_NODE_ID = Convert.ToInt32(adjacent.Value);

                _linkRepo.Create(linkRow);
                _linkRepo.Save();
            }

            return true;
        }
 public void InsertDataThrowsFormatException282()
 {
     SQLDBLoader sQLDBLoader;
     bool b;
     sQLDBLoader = new SQLDBLoader((string)null);
     node s0 = new node();
     s0.id = "-\0";
     s0.label = (string)null;
     s0.adjacentNodes = (nodeAdjacentNodesID[])null;
     b = this.InsertData(sQLDBLoader, s0);
 }
 public void InsertData705()
 {
     SQLDBLoader sQLDBLoader;
     bool b;
     sQLDBLoader = new SQLDBLoader((string)null);
     node s0 = new node();
     s0.id = (string)null;
     s0.label = (string)null;
     s0.adjacentNodes = (nodeAdjacentNodesID[])null;
     b = this.InsertData(sQLDBLoader, s0);
 }
 public void InsertDataThrowsInvalidOperationException91()
 {
     SQLDBLoader sQLDBLoader;
     bool b;
     sQLDBLoader = new SQLDBLoader((string)null);
     node s0 = new node();
     s0.id = "0";
     s0.label = (string)null;
     s0.adjacentNodes = (nodeAdjacentNodesID[])null;
     b = this.InsertData(sQLDBLoader, s0);
 }
Пример #5
0
 internal bool InsertDataTest([PexAssumeUnderTest]SQLDBLoader target, node data)
 {
     bool result = target.InsertData(data);
     return result;
     // TODO: add assertions to method SQLDBLoaderTest.InsertDataTest(SQLDBLoader, node)
 }
Пример #6
0
 public virtual bool InsertData(node data)
 {
     throw new NotImplementedException("This method is not yet implemented. Be sure to Override it.");
 }
Пример #7
0
        public override int LoadFiles()
        {
            _linkRepo.DeleteAll();
            _nodeRepo.DeleteAll();

            foreach (string fileName in _fileNames)
            {
                string file = File.ReadAllText(fileName);

                node nextData = new node();

                nextData = (node)Deserialise.XmlDeserialise<node>(file);

                if (nextData != null)
                {

                    InsertData(nextData);
                }

                nextData = null;

            }

            return LoadConstants.Success;
        }