Exemplo n.º 1
0
        public void CellsPivotTablesGetWorksheetPivotTableFilterTest()
        {
            string      name            = "TestCase.xlsx";
            string      sheetName       = "SHEET4";
            int?        pivotTableIndex = 0;
            PivotFilter pivotFilter     = new PivotFilter();

            pivotFilter.FieldIndex = 1;
            pivotFilter.FilterType = "Count";

            AutoFilter autoFilter = new AutoFilter();

            autoFilter.FilterColumns = new List <FilterColumn>();
            FilterColumn filterColumn = new FilterColumn();

            filterColumn.FilterType = "Top10";
            filterColumn.FieldIndex = 0;

            filterColumn.Top10Filter           = new Top10Filter();
            filterColumn.Top10Filter.Items     = 1;
            filterColumn.Top10Filter.IsTop     = true;
            filterColumn.Top10Filter.IsPercent = false;
            autoFilter.FilterColumns.Add(filterColumn);
            pivotFilter.AutoFilter = autoFilter;

            bool?  needReCalculate = true;
            string folder          = "TEMPFOLDER";

            new Config().UpdateDataFile(folder, name);
            var response    = instance.CellsPivotTablesPutWorksheetPivotTableFilter(name, sheetName, pivotTableIndex, pivotFilter, needReCalculate, folder);
            int filterIndex = 0;

            response = instance.CellsPivotTablesGetWorksheetPivotTableFilter(name, sheetName, pivotTableIndex, filterIndex, folder);
            Console.WriteLine(response);
        }
Exemplo n.º 2
0
        public void CellsPivotTablesGetWorksheetPivotTableFilterTest()
        {
            // TODO uncomment below to test the method and replace null with proper value

            string      name            = PivTestFile;
            string      sheetName       = SHEET4;
            int?        pivotTableIndex = 0;
            PivotFilter pivotFilter     = new PivotFilter();

            pivotFilter.FieldIndex = 1;
            pivotFilter.FilterType = "Count";

            AutoFilter autoFilter = new AutoFilter();

            autoFilter.FilterColumns = new List <FilterColumn>();
            FilterColumn filterColumn = new FilterColumn();

            filterColumn.FilterType = "Top10";
            filterColumn.FieldIndex = 0;

            filterColumn.Top10Filter           = new Top10Filter();
            filterColumn.Top10Filter.Items     = 1;
            filterColumn.Top10Filter.IsTop     = true;
            filterColumn.Top10Filter.IsPercent = false;
            autoFilter.FilterColumns.Add(filterColumn);
            pivotFilter.AutoFilter = autoFilter;

            bool?  needReCalculate = true;
            string folder          = TEMPFOLDER;

            UpdateDataFile(folder, name);
            var response = instance.CellsPivotTablesPutWorksheetPivotTableFilter(name, sheetName, pivotTableIndex, pivotFilter, needReCalculate, folder);

            Assert.AreEqual(response.Code, 200);
            int filterIndex = 0;

            response = instance.CellsPivotTablesGetWorksheetPivotTableFilter(name, sheetName, pivotTableIndex, filterIndex, folder);
            Assert.IsInstanceOf <PivotFilterResponse>(response, "response is PivotFilterResponse");
            Assert.AreEqual(response.Code, 200);
        }