コード例 #1
0
    public void SetCurrentDirectory_UponDispose_RestoresEnvironmentVariable()
    {
        var oldCwd = Environment.CurrentDirectory;
        var path   = new PosixPath(@"/");
        var tmp    = path.SetCurrentDirectory();

        tmp.Dispose();

        Assert.Equal(oldCwd, Environment.CurrentDirectory);
    }
コード例 #2
0
    public void SetCurrentDirectory_WithDirectory_SetsEnvironmentVariable()
    {
        const string newCwd = @"/";
        var          path   = new PosixPath(newCwd);

        using (path.SetCurrentDirectory())
        {
            Assert.Equal(newCwd, Environment.CurrentDirectory);
        }
    }