diff options
Diffstat (limited to 'mcs/class/Mono.Posix/Test/Mono.Unix/UnixListenerTest.cs')
-rw-r--r-- | mcs/class/Mono.Posix/Test/Mono.Unix/UnixListenerTest.cs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/mcs/class/Mono.Posix/Test/Mono.Unix/UnixListenerTest.cs b/mcs/class/Mono.Posix/Test/Mono.Unix/UnixListenerTest.cs new file mode 100644 index 00000000000..b2312b5590f --- /dev/null +++ b/mcs/class/Mono.Posix/Test/Mono.Unix/UnixListenerTest.cs @@ -0,0 +1,36 @@ +// UnixListenerTest.cs: Unit tests for Mono.Unix.UnixListener +// +// Authors: +// David Lechner (david@lechnology.com) +// +// (c) 2015 David Lechner +// + +using System; +using System.IO; + +using NUnit.Framework; +using Mono.Unix; + +namespace MonoTests.Mono.Unix { + + [TestFixture] + public class UnixListenerTest { + + // test that a socket file is created and deleted by the UnixListener + [Test] + public void TestSocketFileCreateDelete () + { + var socketFile = Path.GetTempFileName (); + // we just want the file name, not the file + File.Delete (socketFile); + + using (var listener = new UnixListener (socketFile)) { + // creating an instance of UnixListener should create the file + Assert.IsTrue (File.Exists (socketFile), "#A01"); + } + // and disposing the UnixListener should delete the file + Assert.IsFalse (File.Exists (socketFile), "#A02"); + } + } +} |