Пример #1
0
        public void AvrPivotGridFieldFilterValuesSaveLoad()
        {
            IEnumerable <PivotGridFieldBase> fields = CreateDiagnosisField();

            foreach (PivotGridFieldBase field in fields)
            {
                var    saved = (AvrPivotGridFieldFilterValues)field.FilterValues;
                string xml   = saved.Serialize();

                string compressed   = AvrPivotGridFieldExtender.CompressEndEncodeString(xml);
                string uncompressed = AvrPivotGridFieldExtender.UncompressEndDecodeString(compressed);
                Assert.AreEqual(xml, uncompressed);

                AvrPivotGridFieldFilterValues loaded = AvrPivotGridFieldFilterValues.Deserialize(uncompressed);

                Assert.AreEqual(loaded.ShowBlanks, saved.ShowBlanks);
                Assert.AreEqual(loaded.FilterType, saved.FilterType);
                Assert.AreEqual(loaded.DeferFilterString, saved.DeferFilterString);
                Assert.AreEqual(loaded.Values.Length, saved.Values.Length);
                for (int i = 0; i < saved.Values.Length; i++)
                {
                    Assert.AreEqual(loaded.Values[i], saved.Values[i]);
                }
            }
        }
Пример #2
0
        public void ZlibCompressDecompressTest()
        {
            const string xml = @"<AvrPivotGridFieldFilterValues>
  <DeferFilterString />
  <ShowBlanks>false</ShowBlanks>
  <FilterType>Included</FilterType>
  <Values>
    <anyType xmlns:q1=""http://www.w3.org/2001/XMLSchema"" d3p1:type=""q1:string"" xmlns:d3p1=""http://www.w3.org/2001/XMLSchema-instance"">Botulism</anyType>
    <anyType xmlns:q2=""http://www.w3.org/2001/XMLSchema"" d3p1:type=""q2:string"" xmlns:d3p1=""http://www.w3.org/2001/XMLSchema-instance"">Anthrax - Pulmonary</anyType>
  </Values>
</AvrPivotGridFieldFilterValues>";

            string compressed   = AvrPivotGridFieldExtender.CompressEndEncodeString(xml);
            string uncompressed = AvrPivotGridFieldExtender.UncompressEndDecodeString(compressed);

            Assert.AreEqual(xml, uncompressed);
        }