Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Common/tests/TestUtilities/FileCleanupTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public string TestDirectory
{
if (_testDirectory is null)
{
_testDirectory = Path.Combine(Path.GetTempPath(), GetUniqueName());
_testDirectory = Path.Join(Path.GetTempPath(), GetUniqueName());
Directory.CreateDirectory(_testDirectory);
}

Expand All @@ -43,7 +43,7 @@ protected virtual void Dispose(bool disposing)
}
}

public string GetTestFilePath() => Path.Combine(TestDirectory, GetTestFileName());
public string GetTestFilePath() => Path.Join(TestDirectory, GetTestFileName());

public static string GetTestFileName() => GetUniqueName();

Expand Down
2 changes: 1 addition & 1 deletion src/Common/tests/TestUtilities/TempFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@ private void DeleteFile()
private static string GetFilePath(string? memberName, int lineNumber)
{
string file = $"{IO.Path.GetRandomFileName()}_{memberName}_{lineNumber}";
return IO.Path.Combine(IO.Path.GetTempPath(), file);
return IO.Path.Join(IO.Path.GetTempPath(), file);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Namespace Microsoft.VisualBasic.Logging
Debug.Fail("Unrecognized LogFileCreationSchedule")
End Select

Return Path.Combine(basePath, fileName)
Return Path.Join(basePath, fileName)
End Get
End Property

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Namespace Microsoft.VisualBasic.Forms.Tests
listener.DiskSpaceExhaustedBehavior = DiskSpaceExhaustedOption.ThrowException
listener.DiskSpaceExhaustedBehavior.Should.Be(DiskSpaceExhaustedOption.ThrowException)

listener.FullLogFileName.Should.BeEquivalentTo(Path.Combine(testDirectory, $"{expectedBaseFileName}.log"))
listener.FullLogFileName.Should.BeEquivalentTo(Path.Join(testDirectory, $"{expectedBaseFileName}.log"))

listener.LogFileCreationSchedule.Should.Be(LogFileCreationScheduleOption.None)
listener.LogFileCreationSchedule = LogFileCreationScheduleOption.Daily
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Namespace Microsoft.VisualBasic.Forms.Tests

<WinFormsFact>
Public Sub DirectoryIsAccessibleWithNonexistentPath()
Dim directoryPath As String = Path.Combine(CreateTempDirectory(), GetUniqueFileName)
Dim directoryPath As String = Path.Join(CreateTempDirectory(), GetUniqueFileName)
DirectoryIsAccessible(directoryPath).Should.BeFalse()
End Sub

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Namespace Microsoft.VisualBasic.Forms.Tests
Public MustInherit Class VbFileCleanupTestBase
Implements IDisposable

Private Shared ReadOnly s_baseTempPath As String = Path.Combine(Path.GetTempPath, "DownLoadTest9d9e3a8-7a46-4333-a0eb-4faf76994801")
Private Shared ReadOnly s_baseTempPath As String = Path.Join(Path.GetTempPath, "DownLoadTest9d9e3a8-7a46-4333-a0eb-4faf76994801")
Friend Const DefaultFileName As String = "Testing.Txt"
Friend ReadOnly _testDirectories As New HashSet(Of String)

Expand Down Expand Up @@ -46,7 +46,7 @@ Namespace Microsoft.VisualBasic.Forms.Tests
''' If size = -1 no file is create but the full path is returned.
''' </returns>
Friend Shared Function CreateTempFile(sourceDirectoryName As String, Optional filename As String = DefaultFileName, Optional size As Integer = -1) As String
Dim filenameWithPath As String = Path.Combine(sourceDirectoryName, filename)
Dim filenameWithPath As String = Path.Join(sourceDirectoryName, filename)

If size >= 0 Then
Using destinationStream As FileStream = File.Create(filenameWithPath)
Expand All @@ -68,7 +68,7 @@ Namespace Microsoft.VisualBasic.Forms.Tests
If Not info.Exists Then
Return False
End If
Dim path As String = IO.Path.Combine(directoryPath, GetUniqueFileName())
Dim path As String = IO.Path.Join(directoryPath, GetUniqueFileName())
Using stream As FileStream = File.Create(path)
stream.Close()
End Using
Expand All @@ -82,7 +82,7 @@ Namespace Microsoft.VisualBasic.Forms.Tests
End Function

Friend Shared Function GetUniqueFileNameWithPath(testDirectory As String) As String
Return Path.Combine(testDirectory, GetUniqueFileName())
Return Path.Join(testDirectory, GetUniqueFileName())
End Function

''' <summary>
Expand All @@ -96,9 +96,9 @@ Namespace Microsoft.VisualBasic.Forms.Tests
Friend Function CreateTempDirectory(<CallerMemberName> Optional memberName As String = Nothing, Optional lineNumber As Integer = -1) As String
Dim folder As String
If lineNumber > 0 Then
folder = Path.Combine(BaseTempPath, $"{memberName}{lineNumber}")
folder = Path.Join(BaseTempPath, $"{memberName}{lineNumber}")
Else
folder = Path.Combine(BaseTempPath, memberName)
folder = Path.Join(BaseTempPath, memberName)
End If

If _testDirectories.Add(folder) Then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void Shell_ArgumentNullException()
[Fact]
public void Shell_FileNotFoundException()
{
string path = Path.Combine(Path.GetTempPath(), GetUniqueName());
string path = Path.Join(Path.GetTempPath(), GetUniqueName());
// Exception.ToString() called to verify message is constructed successfully.
_ = Assert.Throws<FileNotFoundException>(() => Interaction.Shell(path)).ToString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void PlayEmptyFileNameAudioMode_Throws(string fileName)
[InvalidEnumData<AudioPlayMode>]
public void PlayModeInvalid_Throws(AudioPlayMode audioPlayMode)
{
string location = Path.Combine(Path.GetTempPath(), GetUniqueName());
string location = Path.Join(Path.GetTempPath(), GetUniqueName());
Audio audio = new();
Action testCode = () => audio.Play(location, audioPlayMode);
testCode.Should().Throw<InvalidEnumArgumentException>();
Expand Down
Loading