Example #1
0
        public void TranslateNodeHeaderNames_For_NodeDataHeaders(int index, string[] srcHeaderNames, string[] expectedNames)
        {
            var mockHelper = new Mock<IKnownHeaderNamesReaderHelper>();
            var net = Blob.TestSupport.Network.BasicAdjListGenerator.GenerateAdjListWithDataAttribs(3, 0, false, true, false);
            var headers = new List<HeaderField>();
            for (int i = 0; i < srcHeaderNames.Length; i++)
            {
                var name = srcHeaderNames[i];
                headers.Add(new HeaderField(null, VnaFileSection.NodeData, i, name));
                var expectedName = expectedNames[i];
                mockHelper.Setup(m => m.GetKnownNodeHeader(name)).Returns(new HeaderMatch(HeaderMatchType.NodeStyle) {NameToUse = expectedName, DataType = typeof(Guid)});
            }

            var reader = new VnaAdjListReader();
            reader.DisableDataConversions = true;
            reader.TranslateNodeHeaderNames(headers, mockHelper.Object);

            for (int i = 0; i < headers.Count; i++)
            {
                Assert.Equal(expectedNames[i], headers[i].AttribColName);
                Assert.Equal(typeof(Guid), headers[i].AttribColumnType);
            }
        }