コード例 #1
0
        public void CanSerializeAndDeserializeConfigWithEmptyEquivalentValues()
        {
            var confTest = new CrcExtraConfiguration();

            confTest.Version = 2;
            var repTest = new CrcReportConfig();

            repTest.Path              = "Test";
            repTest.IsFeatured        = true;
            confTest.CrcReportConfigs = new List <CrcReportConfig>();
            confTest.CrcReportConfigs.Add(repTest);

            List <string> empties = new List <string>()
            {
                "", "%%", null
            };

            confTest.DefaultEmptyEquivalentValues = empties;

            CrcExtraConfiguration.Serialize("TestConfig2.xml", confTest);

            var getItBack = CrcExtraConfiguration.Deserialize("TestConfig2.xml");

            Assert.AreEqual(2, getItBack.Version);
            Assert.AreEqual(1, getItBack.CrcReportConfigs.Count());
            Assert.AreEqual("Test", getItBack.CrcReportConfigs[0].Path);
            Assert.AreEqual(true, getItBack.CrcReportConfigs[0].IsFeatured);
            Assert.AreEqual(3, getItBack.DefaultEmptyEquivalentValues.Count());
        }
コード例 #2
0
        public void CanSerializeAndDeserializeConfig()
        {
            var confTest = new CrcExtraConfiguration();

            confTest.Version = 2;
            var repTest = new CrcReportConfig();

            repTest.Path              = "Test";
            repTest.IsFeatured        = true;
            confTest.CrcReportConfigs = new List <CrcReportConfig>();
            confTest.CrcReportConfigs.Add(repTest);
            CrcExtraConfiguration.Serialize("TestConfig.xml", confTest);

            var getItBack = CrcExtraConfiguration.Deserialize("TestConfig.xml");

            Assert.AreEqual(2, getItBack.Version);
            Assert.AreEqual(1, getItBack.CrcReportConfigs.Count());
            Assert.AreEqual("Test", getItBack.CrcReportConfigs[0].Path);
            Assert.AreEqual(true, getItBack.CrcReportConfigs[0].IsFeatured);
        }