From ddd04a6f8aad21c4d33ee28d4dbd3968ee2a9c2b Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Wed, 14 Apr 2021 11:06:29 +0200 Subject: [PATCH] TestGUI: Addnew test for filesystem class --- GUIs.Test.TestGUI/TestGUI.vbproj | 9 ++ GUIs.Test.TestGUI/frmFilesystem.Designer.vb | 37 ++++++ GUIs.Test.TestGUI/frmFilesystem.resx | 120 ++++++++++++++++++++ GUIs.Test.TestGUI/frmFilesystem.vb | 34 ++++++ GUIs.Test.TestGUI/frmStart.Designer.vb | 12 ++ GUIs.Test.TestGUI/frmStart.vb | 4 + 6 files changed, 216 insertions(+) create mode 100644 GUIs.Test.TestGUI/frmFilesystem.Designer.vb create mode 100644 GUIs.Test.TestGUI/frmFilesystem.resx create mode 100644 GUIs.Test.TestGUI/frmFilesystem.vb diff --git a/GUIs.Test.TestGUI/TestGUI.vbproj b/GUIs.Test.TestGUI/TestGUI.vbproj index ca2162e8..e5b916f7 100644 --- a/GUIs.Test.TestGUI/TestGUI.vbproj +++ b/GUIs.Test.TestGUI/TestGUI.vbproj @@ -119,6 +119,12 @@ Form + + frmFilesystem.vb + + + Form + frmFolderWatcher.vb @@ -170,6 +176,9 @@ frmConfigTest.vb + + frmFilesystem.vb + frmFolderWatcher.vb diff --git a/GUIs.Test.TestGUI/frmFilesystem.Designer.vb b/GUIs.Test.TestGUI/frmFilesystem.Designer.vb new file mode 100644 index 00000000..defc9806 --- /dev/null +++ b/GUIs.Test.TestGUI/frmFilesystem.Designer.vb @@ -0,0 +1,37 @@ + _ +Partial Class frmFilesystem + Inherits System.Windows.Forms.Form + + 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Wird vom Windows Form-Designer benötigt. + Private components As System.ComponentModel.IContainer + + 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. + 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. + 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. + _ + Private Sub InitializeComponent() + Me.SuspendLayout() + ' + 'frmFilesystem + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(800, 450) + Me.Name = "frmFilesystem" + Me.Text = "frmFilesystem" + Me.ResumeLayout(False) + + End Sub +End Class diff --git a/GUIs.Test.TestGUI/frmFilesystem.resx b/GUIs.Test.TestGUI/frmFilesystem.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/GUIs.Test.TestGUI/frmFilesystem.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/GUIs.Test.TestGUI/frmFilesystem.vb b/GUIs.Test.TestGUI/frmFilesystem.vb new file mode 100644 index 00000000..88808638 --- /dev/null +++ b/GUIs.Test.TestGUI/frmFilesystem.vb @@ -0,0 +1,34 @@ +Imports DigitalData.Modules.Logging + +Public Class frmFilesystem + Private LogConfig As LogConfig + Private Filesystem As DigitalData.Modules.Filesystem.File + + Private ShortName As String = "E:\some_test_file.txt" + Private LongName As String = "E:\some_test_file_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more_data_and_with_some_more.txt" + + Private Sub frmFilesystem_Load(sender As Object, e As EventArgs) Handles MyBase.Load + Try + LogConfig = New LogConfig(LogConfig.PathType.Temp) + Filesystem = New DigitalData.Modules.Filesystem.File(LogConfig) + + Using oWriter = IO.File.CreateText("E:\some_test_file.txt") + oWriter.WriteLine("bla bla bla") + End Using + + IO.File.Copy(ShortName, LongName) + + Dim oVersion1 = Filesystem.GetVersionedFilename(LongName) + IO.File.Copy(ShortName, oVersion1) + + Dim oVersion2 = Filesystem.GetVersionedFilename(LongName) + IO.File.Copy(ShortName, oVersion2) + Catch ex As Exception + + Finally + IO.File.Delete(ShortName) + IO.File.Delete(LongName) + End Try + + End Sub +End Class \ No newline at end of file diff --git a/GUIs.Test.TestGUI/frmStart.Designer.vb b/GUIs.Test.TestGUI/frmStart.Designer.vb index e029f4b5..796407c1 100644 --- a/GUIs.Test.TestGUI/frmStart.Designer.vb +++ b/GUIs.Test.TestGUI/frmStart.Designer.vb @@ -24,6 +24,7 @@ Partial Class frmStart Private Sub InitializeComponent() Me.Button1 = New System.Windows.Forms.Button() Me.Button2 = New System.Windows.Forms.Button() + Me.Button3 = New System.Windows.Forms.Button() Me.SuspendLayout() ' 'Button1 @@ -44,11 +45,21 @@ Partial Class frmStart Me.Button2.Text = "LookupControl" Me.Button2.UseVisualStyleBackColor = True ' + 'Button3 + ' + Me.Button3.Location = New System.Drawing.Point(12, 134) + Me.Button3.Name = "Button3" + Me.Button3.Size = New System.Drawing.Size(236, 55) + Me.Button3.TabIndex = 0 + Me.Button3.Text = "Filesystem" + Me.Button3.UseVisualStyleBackColor = True + ' 'frmStart ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(800, 450) + Me.Controls.Add(Me.Button3) Me.Controls.Add(Me.Button2) Me.Controls.Add(Me.Button1) Me.Name = "frmStart" @@ -59,4 +70,5 @@ Partial Class frmStart Friend WithEvents Button1 As Button Friend WithEvents Button2 As Button + Friend WithEvents Button3 As Button End Class diff --git a/GUIs.Test.TestGUI/frmStart.vb b/GUIs.Test.TestGUI/frmStart.vb index 67685e1b..693e8e1f 100644 --- a/GUIs.Test.TestGUI/frmStart.vb +++ b/GUIs.Test.TestGUI/frmStart.vb @@ -6,4 +6,8 @@ Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click frmLookup.Show() End Sub + + Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click + frmFilesystem.Show() + End Sub End Class \ No newline at end of file