public void TemporaryFileExtensionTest()
{
string path = string.Empty;
using( TemporaryFile temporaryFile = new TemporaryFile( " " ) )
{
path = temporaryFile.Path;
Assert.That( File.Exists( temporaryFile.Path ), Is.True );
Assert.That( (File.GetAttributes( temporaryFile.Path ) & FileAttributes.Temporary) == FileAttributes.Temporary, Is.True );
}
Assert.That( File.Exists( path ), Is.False );
using( TemporaryFile temporaryFile = new TemporaryFile( true, "." ) )
{
path = temporaryFile.Path;
Assert.That( File.Exists( temporaryFile.Path ), Is.True );
Assert.That( path.EndsWith( ".tmp." ), Is.True );
Assert.That( (File.GetAttributes( temporaryFile.Path ) & FileAttributes.Temporary) == FileAttributes.Temporary, Is.True );
}
Assert.That( File.Exists( path ), Is.False );
using( TemporaryFile temporaryFile = new TemporaryFile( true, "tst" ) )
{
path = temporaryFile.Path;
Assert.That( File.Exists( temporaryFile.Path ), Is.True );
Assert.That( path.EndsWith( ".tmp.tst" ), Is.True );
Assert.That( (File.GetAttributes( temporaryFile.Path ) & FileAttributes.Temporary) == FileAttributes.Temporary, Is.True );
}
Assert.That( File.Exists( path ), Is.False );
using( TemporaryFile temporaryFile = new TemporaryFile( true, ".tst" ) )
{
path = temporaryFile.Path;
Assert.That( File.Exists( temporaryFile.Path ), Is.True );
Assert.That( path.EndsWith( ".tmp.tst" ), Is.True );
Assert.That( (File.GetAttributes( temporaryFile.Path ) & FileAttributes.Temporary) == FileAttributes.Temporary, Is.True );
}
Assert.That( File.Exists( path ), Is.False );
}