public void TestSetCurrentDirectory() { var originalDir = Directory.GetCurrentDirectory(); try { Assert.Throws <NotSupportedException>(() => Directory.SetCurrentDirectory(longPathDirectory)); } finally { Assert.Throws <NotSupportedException>(() => Directory.SetCurrentDirectory(originalDir)); } }