System.IO.Tests.PathTests_Join.TryJoinTwoPaths C# (CSharp) Méthode

TryJoinTwoPaths() private méthode

private TryJoinTwoPaths ( string path1, string path2, string expected ) : void
path1 string
path2 string
expected string
Résultat void
        public void TryJoinTwoPaths(string path1, string path2, string expected)
        {
            char[] output = new char[expected.Length];

            Assert.True(Path.TryJoin(path1, path2, output, out int written));
            Assert.Equal(expected.Length, written);
            Assert.Equal(expected, new string(output));

            if (expected.Length > 0)
            {
                Assert.False(Path.TryJoin(path1, path2, Span<char>.Empty, out written));
                Assert.Equal(0, written);

                output = new char[expected.Length - 1];
                Assert.False(Path.TryJoin(path1, path2, output, out written));
                Assert.Equal(0, written);
                Assert.Equal(output, new char[output.Length]);
            }
        }