Fix filesystem refs
This commit is contained in:
@@ -1,46 +1,46 @@
|
||||
Imports System.Text
|
||||
Imports System.IO
|
||||
Imports Microsoft.VisualStudio.TestTools.UnitTesting
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports System.IO
|
||||
Imports FluentAssertions
|
||||
|
||||
''' <summary>
|
||||
''' Test creating the log path in various configurations
|
||||
''' </summary>
|
||||
<TestClass()> Public Class ConstructorUnitTest
|
||||
Private Shared _currentDirectoryLogPath = Path.Combine(Directory.GetCurrentDirectory(), "Log")
|
||||
Private Shared _appdataDirectoryLogPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Digital Data", "Modules.Logging", "Log")
|
||||
Private Shared _customDirectoryLogPath = Path.Combine(Directory.GetCurrentDirectory(), "CustomLogFolder")
|
||||
Private Shared _restrictedDirectoryLogPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "ShouldNotBeCreated")
|
||||
Private Shared _nonsenseDirectoryLogPath = "X:\FOO\BAR\BAZ\QUUX"
|
||||
Private Shared ReadOnly _currentDirectoryLogPath = Path.Combine(Directory.GetCurrentDirectory(), "Log")
|
||||
Private Shared ReadOnly _appdataDirectoryLogPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Digital Data", "Modules.Logging.Test", "Log")
|
||||
Private Shared ReadOnly _customDirectoryLogPath = Path.Combine(Directory.GetCurrentDirectory(), "CustomLogFolder")
|
||||
Private Shared ReadOnly _restrictedDirectoryLogPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "ShouldNotBeCreated")
|
||||
Private Shared ReadOnly _nonsenseDirectoryLogPath = "X:\DOES\NOT\EVER\EXIST"
|
||||
|
||||
<TestMethod()> Public Sub TestConstructorCurrentDirectory()
|
||||
Assert.ThrowsException(Of ArgumentException)(Sub()
|
||||
Dim oLogConfig As New LogConfig(LogConfig.PathType.Temp)
|
||||
End Sub)
|
||||
Dim oLogConfig As New LogConfig(LogConfig.PathType.Temp)
|
||||
Dim oTempPath = Path.GetTempPath
|
||||
oLogConfig.LogDirectory.Should.Be(oTempPath)
|
||||
End Sub
|
||||
|
||||
<TestMethod()> Public Sub TestConstructorApplicationDirectory()
|
||||
Dim oLogConfig As New LogConfig(LogConfig.PathType.AppData, Nothing, Nothing, "Digital Data", "Modules.Logging")
|
||||
|
||||
Assert.AreEqual(_appdataDirectoryLogPath, oLogConfig.LogDirectory)
|
||||
oLogConfig.LogDirectory.Should.Be(_appdataDirectoryLogPath)
|
||||
End Sub
|
||||
|
||||
<TestMethod()> Public Sub TestConstructorCustomDirectory()
|
||||
Dim oLogConfig As New LogConfig(LogConfig.PathType.CustomPath, _customDirectoryLogPath)
|
||||
|
||||
Assert.AreEqual(_customDirectoryLogPath, oLogConfig.LogDirectory)
|
||||
oLogConfig.LogDirectory.Should.Be(_customDirectoryLogPath)
|
||||
End Sub
|
||||
|
||||
<TestMethod()> Public Sub TestConstructorRestrictedDirectory()
|
||||
Dim oLogConfig As New LogConfig(LogConfig.PathType.CustomPath, _restrictedDirectoryLogPath)
|
||||
Dim oTempPath = Path.GetTempPath
|
||||
|
||||
Assert.AreEqual(Path.GetTempPath, oLogConfig.LogDirectory)
|
||||
oLogConfig.LogDirectory.Should.Be(oTempPath)
|
||||
End Sub
|
||||
|
||||
<TestMethod()> Public Sub TestConstructorNonsenseDirectory()
|
||||
Dim oLogConfig As New LogConfig(LogConfig.PathType.CustomPath, _nonsenseDirectoryLogPath)
|
||||
Dim oTempPath = Path.GetTempPath
|
||||
|
||||
Assert.AreEqual(Path.GetTempPath, oLogConfig.LogDirectory)
|
||||
oLogConfig.LogDirectory.Should.Be(oTempPath)
|
||||
End Sub
|
||||
|
||||
<ClassCleanup()> Public Shared Sub Cleanup()
|
||||
|
||||
Reference in New Issue
Block a user