コード例 #1
0
ファイル: DLImporter.cs プロジェクト: BgRva/Blob1
        public void Read()
        {
            //WHY IS THIS NEEDED??
            //int progress = 0;
            Exception ex = null;

            DLReader reader = new DLReader(_Implementation);
            if (_NetworkId == Guid.Empty)
                _NetworkId = Guid.NewGuid();
            reader.NetworkId = _NetworkId;
            reader.Read(_File);

            _netObj = reader.Network;

            if (_netObj == null)
            {
                // set the cancel flag
                IsCancellationPending = true;
                ex = new Exception(string.Format("A network could not be read from {0}:  {1}", _File, reader.Message));
            }
            else
            {
                if (!string.IsNullOrEmpty(_NetworkName))
                    _netObj.Name = _NetworkName;

                //WHY IS THIS NEEDED?
                //progress = 100;
            }
        }
コード例 #2
0
ファイル: DLReaderFixture.cs プロジェクト: BgRva/Blob1
        public void Read_FilesToAdjList(string testItemInput)
        {
            Console.WriteLine(string.Format("input: {0}", testItemInput));

            //Arrange
            var testItem = ReadTestItem(testItemInput);

            var reader = new DLReader(null);

            //Act
            reader.Read(Path.Combine(Properties.Resources.DL_DataFilePath, testItem.FileName));

            //Assert
            var network = reader.Network as IAdjList;

            if (testItem.IsPassExpected)
            {
                Assert.NotNull(network);
                Assert.Equal(testItem.N, network.NodeCount);
                if (testItem.UseLabels)
                    Assert.Equal(1, network.NodeAttributeCount);
            }
        }
コード例 #3
0
ファイル: DLReaderFixture.cs プロジェクト: BgRva/Blob1
        public void Read_ToAdjList(string testItemInput)
        {
            Console.WriteLine(string.Format("input: {0}", testItemInput));

            //Arrange
            var testItem = ReadResultTestItem(testItemInput);

            var reader = new DLReader(null);

            //Act
            reader.Read(Path.Combine(Properties.Resources.DL_TestDataPath, testItem.FileName));

            //Assert
            var network = reader.Network as IAdjList;

            Assert.Equal(testItem.ExpectedNodeCount, network.NodeCount);
            Assert.Equal(testItem.ExpectedEdgeCount, network.EdgeCount);
            Assert.Equal(testItem.ExpectedIsDirected, network.IsDirected);

            IAdjList adjList = network as IAdjList;
            Assert.Equal(testItem.ExpectedNodeDataMaps, adjList.NodeAttributeCount);
            Assert.Equal(testItem.ExpectedEdgeDataMaps, adjList.EdgeAttributeCount);
            if (adjList.EdgeAttributeCount == 1)
            {
                var edgeAttributes = adjList as IEdgeAttributes;
                Assert.Equal(typeof(double), edgeAttributes.EdgeDataAttributeTypes[0]);
            }
        }