Fix Sql Connection missing in Depending Controls, clean up Filesystem module use

This commit is contained in:
Jonathan Jenne
2023-09-11 15:16:10 +02:00
parent f727c0da9f
commit 123eaceb12
12 changed files with 442 additions and 140 deletions

View File

@@ -0,0 +1,112 @@
Imports System.Data
Imports Microsoft.VisualStudio.TestTools.UnitTesting
Imports FluentAssertions
Imports DigitalData.Modules.Logging
Namespace Global_Indexer.Test
<TestClass>
Public Class ClassPostprocessingTest
Private LogConfig As LogConfig
Private PostProcessing As ClassPostprocessing
<TestInitialize()>
Sub Init()
LogConfig = New LogConfig(LogPath:=LogConfig.PathType.Temp)
PostProcessing = New ClassPostprocessing(LogConfig)
End Sub
<TestMethod>
Sub Get_Nachbearbeitung_Wert_VBSPLIT_INDEX_0()
Dim oTable = GetDataTable(ClassPostprocessing.VBSPLIT, ",", "0")
Dim oString = "1,2,3,4"
Dim oExpected = "1"
Dim rString = PostProcessing.Get_Nachbearbeitung_Wert(oString, oTable)
rString.Should.Be(oExpected)
End Sub
<TestMethod>
Sub Get_Nachbearbeitung_Wert_VBSPLIT_INDEX_3()
Dim oTable = GetDataTable(ClassPostprocessing.VBSPLIT, ",", "3")
Dim oString = "1,2,3,4"
Dim oExpected = "4"
Dim rString = PostProcessing.Get_Nachbearbeitung_Wert(oString, oTable)
rString.Should.Be(oExpected)
End Sub
<TestMethod>
Sub Get_Nachbearbeitung_Wert_VBSPLIT_INDEX_5()
Dim oTable = GetDataTable(ClassPostprocessing.VBSPLIT, ",", "5")
Dim oString = "1,2,3,4"
Dim oExpected = "1,2,3,4"
Dim rString = PostProcessing.Get_Nachbearbeitung_Wert(oString, oTable)
rString.Should.Be(oExpected)
End Sub
<TestMethod>
Sub Get_Nachbearbeitung_Wert_VBREPLACE()
Dim oTable = GetDataTable(ClassPostprocessing.VBREPLACE, ",", "_")
Dim oString = "1,2,3,4"
Dim oExpected = "1_2_3_4"
Dim rString = PostProcessing.Get_Nachbearbeitung_Wert(oString, oTable)
rString.Should.Be(oExpected)
End Sub
<TestMethod>
Sub Get_Nachbearbeitung_Wert_VBREPLACE_NOT_EXISTING()
Dim oTable = GetDataTable(ClassPostprocessing.VBREPLACE, ";", "_")
Dim oString = "1,2,3,4"
Dim oExpected = "1,2,3,4"
Dim rString = PostProcessing.Get_Nachbearbeitung_Wert(oString, oTable)
rString.Should.Be(oExpected)
End Sub
<TestMethod>
Sub Get_Nachbearbeitung_Wert_VBREPLACE_EMPTY_STRING()
Dim oTable = GetDataTable(ClassPostprocessing.VBREPLACE, "", "_")
Dim oString = "1,2,3,4"
Dim oExpected = "1,2,3,4"
Dim rString = PostProcessing.Get_Nachbearbeitung_Wert(oString, oTable)
rString.Should.Be(oExpected)
End Sub
<TestMethod>
Sub Get_Nachbearbeitung_Wert_VBREPLACE_NOTHING1()
Dim oTable = GetDataTable(ClassPostprocessing.VBREPLACE, ",", Nothing)
Dim oString = "1,2,3,4"
Dim oExpected = "1,2,3,4"
Dim rString = PostProcessing.Get_Nachbearbeitung_Wert(oString, oTable)
rString.Should.Be(oExpected)
End Sub
<TestMethod>
Sub Get_Nachbearbeitung_Wert_VBREPLACE_NOTHING2()
Dim oTable = GetDataTable(ClassPostprocessing.VBREPLACE, Nothing, "_")
Dim oString = "1,2,3,4"
Dim oExpected = "1,2,3,4"
Dim rString = PostProcessing.Get_Nachbearbeitung_Wert(oString, oTable)
rString.Should.Be(oExpected)
End Sub
Private Function GetDataTable(pType As String, pText1 As String, Optional pText2 As String = "") As DataTable
Dim oTable As New DataTable()
oTable.Columns.Add("TYPE", GetType(String))
oTable.Columns.Add("TEXT1", GetType(String))
oTable.Columns.Add("TEXT2", GetType(String))
oTable.Rows.Add(pType, pText1, pText2)
oTable.AcceptChanges()
Return oTable
End Function
End Class
End Namespace

View File

@@ -0,0 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>Global_Indexer.Test</RootNamespace>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="coverlet.collector" Version="3.1.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Global_Indexer\Global_Indexer.vbproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="DigitalData.Modules.Base">
<HintPath>..\..\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
</Reference>
<Reference Include="DigitalData.Modules.Logging">
<HintPath>..\..\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
</Reference>
</ItemGroup>
</Project>