示例#1
0
        public void CsvFileFieldFieldMappingRemove()
        {
            var test = new CsvFile();
            var fm1  = new Mapping
            {
                FileColumn    = "Source1",
                TemplateField = "Destination1"
            };

            Assert.IsFalse(test.AddMapping(null));

            Assert.IsTrue(test.AddMapping(fm1));
            Assert.IsFalse(test.AddMapping(fm1));

            Assert.AreEqual(1, test.Mapping.Count);

            var res = test.GetColumnMapping("Source1");

            Assert.AreEqual(fm1, res.First());

            test.RemoveMapping("Source");
            Assert.AreEqual(1, test.Mapping.Count);

            test.RemoveMapping("Source1");
            Assert.AreEqual(0, test.Mapping.Count);
        }
示例#2
0
        public void CsvFileFieldMappingAddUpdateAdd2()
        {
            var test = new CsvFile();
            var fm1  = new Mapping
            {
                FileColumn    = "Source1",
                TemplateField = "Destination1"
            };
            var fm2 = new Mapping
            {
                FileColumn    = "Source2",
                TemplateField = "Destination2"
            };

            test.AddMapping(fm1);
            Assert.AreEqual(fm1, test.Mapping.First());
            test.AddMapping(fm2);
            Assert.AreEqual(fm2, test.Mapping.Last());
        }