CreateFile() public méthode

Creates a file in the temporary directory.
public CreateFile ( string fileName ) : FileInfo
fileName string
Résultat System.IO.FileInfo
Exemple #1
0
        public void GetStreamSize_FileInfo_9Byte()
        {
            using (var dir = new TemporaryDirectory())
            {
                FileInfo file = dir.CreateFile("GetStreamSize_FileInfo_9.test");
                using (var writer = new StreamWriter(file.FullName, false))
                {
                    writer.Write("Unit Test");
                }

                StreamSize act = file.GetStreamSize();
                StreamSize exp = 9;

                Assert.AreEqual(exp, act);
            }
        }
Exemple #2
0
        public void SaveLoad_Data_AreEqual()
        {
            using (var dir = new TemporaryDirectory())
            {
                var resourceFile = new XResourceFile(new List<XResourceFileData>()
                {
                    new XResourceFileData("key0", "Some value 0"),
                    new XResourceFileData("key1", "1.1", "comment 1.1"),
                });

                var file = dir.CreateFile("SaveLoad_Data_AreEqual.resx");
                resourceFile.Save(file);

                var act = XResourceFile.Load(file);
                Assert.AreEqual(2, act.Data.Count);
            }
        }
Exemple #3
0
        public void GetStreamSize_FileInfo_9Byte()
        {
            using (var dir = new TemporaryDirectory())
            {
                FileInfo file = dir.CreateFile("GetStreamSize_FileInfo_9.test");
                using (var writer = new StreamWriter(file.FullName, false))
                {
                    writer.Write("Unit Test");
                }

                StreamSize act = file.GetStreamSize();
                StreamSize exp = 9;

                Assert.AreEqual(exp, act);
            }
        }