예제 #1
0
        public void Update()
        {
            this.Name        = this.ListObject.Name;
            this.DisplayName = this.Worksheet.Name;

            if (string.IsNullOrWhiteSpace(this.DataName))
            {
                this.Icon               = Properties.Resources.table;
                this.DataDisplayName    = string.Empty;
                this.ListObject.Comment = string.Empty;
            }
            else
            {
                this.Icon = Properties.Resources.table_link;
                Excel.ListObject dataListObject = ListObjectHelper.GetByName(this.Workbook, this.DataName);

                if (null != dataListObject)
                {
                    this.DataDisplayName = ListObjectHelper.GetWorksheetName(dataListObject);
                }
                else
                {
                    this.DataDisplayName = string.Empty;
                }
            }
        }
예제 #2
0
        private TestDataSequence GetTestDataSequence(ITestCase testCase)
        {
            var dataSequence = new TestDataSequence();

            if (string.IsNullOrWhiteSpace(testCase.DataName))
            {
                var dummyData = new TestData();
                dataSequence.Enqueue(dummyData);
                return(dataSequence);
            }

            Excel.ListObject listObject = ListObjectHelper.GetByName(testCase.Workbook, testCase.DataName);

            if (null == listObject)
            {
                throw new InvalidOperationException("listObject is null.");
            }

            ListObjectHelper.ForEach(
                listObject,
                (listRow) =>
            {
                var data = new TestData();

                foreach (Excel.ListColumn listColumn in listObject.ListColumns)
                {
                    var value = ListRowHelper.Get(listRow, listColumn.Index);
                    data.Add(listColumn.Name, value);
                }

                dataSequence.Enqueue(data);
                return(true);
            });

            return(dataSequence);
        }