Ejemplo n.º 1
0
        public void op_Create_IEnumerableOfKeyStringDictionaryNull_FileInfo()
        {
            using (var temp = new TempDirectory())
            {
                var destination = temp.Info.ToFile("destination");

                Assert.Throws <ArgumentNullException>(() => TempCsvFile.Create(null, destination));
            }
        }
Ejemplo n.º 2
0
 public static int Create(IEnumerable <KeyStringDictionary> data,
                          FileInfo destination,
                          DateTime modified)
 {
     using (var file = new TempCsvFile(data))
     {
         return(file.Info.Exists
                    ? new DataFileCreation(destination, modified).Create(new CsvDataSheet(file.Info))
                    : 0);
     }
 }
Ejemplo n.º 3
0
 public static int Create(IEnumerable<KeyStringDictionary> data,
                          FileInfo destination,
                          DateTime modified)
 {
     using (var file = new TempCsvFile(data))
     {
         return file.Info.Exists
                    ? new DataFileCreation(destination, modified).Create(new CsvDataSheet(file.Info))
                    : 0;
     }
 }
Ejemplo n.º 4
0
        public void op_Create_IEnumerableOfKeyStringDictionary_FileInfoNull()
        {
            var data = new List <KeyStringDictionary>
            {
                new KeyStringDictionary
                {
                    { "VALUE", "123" }
                }
            };

            Assert.Throws <ArgumentNullException>(() => TempCsvFile.Create(data, null));
        }
Ejemplo n.º 5
0
        public void op_Create_IEnumerableOfKeyStringDictionaryEmpty_FileInfo()
        {
            using (var temp = new TempDirectory())
            {
                var data        = new List <KeyStringDictionary>();
                var destination = temp.Info.ToFile("destination");

                const int expected = 0;
                var       actual   = TempCsvFile.Create(data, destination);

                Assert.Equal(expected, actual);
            }
        }
Ejemplo n.º 6
0
        public void op_Create_IEnumerableOfKeyStringDictionary_FileInfo()
        {
            using (var temp = new TempDirectory())
            {
                var destination = temp.Info.ToFile("destination");
                var data        = new List <KeyStringDictionary>
                {
                    new KeyStringDictionary
                    {
                        { "VALUE", "123" }
                    }
                };

                var count = TempCsvFile.Create(data, destination);

                Assert.True(temp.Info.ToFile("destination").Exists);
                Assert.Equal(1, count);
                Assert.Equal("123", new CsvDataSheet(destination).First()["VALUE"]);
            }
        }