Ejemplo n.º 1
0
 public void AddFileName_throws_ArgumentNullException_when_fileName_empty()
 {
     using (var tempFileCollection = new TempFileCollection(Path.GetTempPath()))
     {
         Assert.Throws <ArgumentNullException>(() => tempFileCollection.AddFileName(null));
         Assert.Throws <ArgumentNullException>(() => tempFileCollection.AddFileName(String.Empty));
     }
 }
Ejemplo n.º 2
0
        public void AddFileName_throws_ArgumentException_when_duplicate()
        {
            var fileName = "test";

            using (var tempFileCollection = new TempFileCollection(Path.GetTempPath()))
            {
                tempFileCollection.AddFileName(fileName);
                Assert.Throws <ArgumentException>(() => tempFileCollection.AddFileName(fileName));
            }
        }
Ejemplo n.º 3
0
        public void Dispose_deletes_files()
        {
            var fileName = Path.GetTempFileName();

            using (var tempFileCollection = new TempFileCollection(Path.GetTempPath()))
                using (File.Create(fileName))
                {
                    Assert.True(File.Exists(fileName));
                    tempFileCollection.AddFileName(fileName);
                }
            Assert.False(File.Exists(fileName));
        }