Tests implementiert

This commit is contained in:
dev-mkoebis
2026-04-23 14:48:00 +02:00
parent d3deb79cc6
commit 786389cf80
9 changed files with 100 additions and 25 deletions

View File

@@ -12,7 +12,7 @@ namespace Hochbaustatistik.Testing
public class DatabaseOperationsTests
{
[Fact (Skip ="Keine Datenbank-Verbindung m<>glich")]
[Fact]//(Skip ="Keine Datenbank-Verbindung m<>glich")]
public void ConnectAndExecuteHochbauTest()
{
DatabaseOperations.conString = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dborap04.stadtdo.de)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=bgvp.stadtdo.de)));user id=leser;password=leser;";

View File

@@ -11,7 +11,7 @@ namespace Hochbaustatistik.Testing
{
public class EmailTests
{
[Theory(Skip = "Kein Lotus Notes installiert")]
[Theory(Skip = "Kein lotus installiert")]
[InlineData(@"C:\TEMP\test.txt")]
public void SenMailTest(string attachment)
{

View File

@@ -13,7 +13,8 @@ using Xunit;
namespace Hochbaustatistik.Testing.Utilities
{
public class DataOpsTest
{
{
readonly string sourceFile = @"TestData\TestData.csv";
public readonly VorgangInpro vorgang = new VorgangInpro() { Schlussabnahme = "2022" };
[Theory]
@@ -118,7 +119,7 @@ namespace Hochbaustatistik.Testing.Utilities
Assert.Equal(expected2, actuals.ElementAt(1));
}
[Fact(Skip = "Keine Datenbank-Verbindung möglich")]
[Fact]
public void MergeInproWithITNRWTest()
{
var resultFile = @"C:\TEMP\hochbaustatistik.csv";

View File

@@ -20,7 +20,7 @@ namespace Hochbaustatistik.Testing
public class WebTesting
{
[Fact (Skip ="Derzeit keine Daten zum Download vorhanden")]
[Fact (Skip ="Keine Daten zum Download vorhanden")]
public void DownloadList()
{
//DownloadFolder
@@ -58,7 +58,7 @@ namespace Hochbaustatistik.Testing
driver.Quit();
Assert.True(File.Exists(pathDownloadedList));
File.Delete(pathDownloadedList);
//File.Delete(pathDownloadedList);
}
}
}

View File

@@ -60,7 +60,7 @@ namespace Hochbaustatistik.Business
#region Methods
string ReplaceHiphenWithSlash(string aktenzeichen)
{
var regex = new Regex(Regex.Escape("-"),RegexOptions.None,TimeSpan.FromMilliseconds(5));
var regex = new Regex(Regex.Escape("-"));
string res = regex.Replace(aktenzeichen, "/", 1);
return res;
}

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
@@ -66,7 +65,6 @@ namespace Hochbaustatistik.Business
public string Aktenstandort { get; set; }
#endregion
[ExcludeFromCodeCoverage]
public override string GenerateVorgang(Vorgang v)
{
StringBuilder sbInpro = new StringBuilder();

View File

@@ -92,27 +92,81 @@ namespace Hochbaustatistik.Database
vorgangInproHochbau.ZdA = reader.GetValue(6).ToString();
vorgangInproHochbau.Eingangsdatum = reader.GetValue(7).ToString().Split(' ').FirstOrDefault();
vorgangInproHochbau.Genehmigung = reader.GetValue(8).ToString() == null ? "" : reader.GetValue(8).ToString().Split(' ').FirstOrDefault();
var tempDate = reader.GetValue(8).ToString();
if (tempDate == null)
{
vorgangInproHochbau.Genehmigung = "";
}
else
{
vorgangInproHochbau.Genehmigung = tempDate.Split(' ').FirstOrDefault();
}
vorgangInproHochbau.Freigabe = reader.GetValue(9).ToString();
vorgangInproHochbau.Statistik_Relevant = reader.GetValue(10).ToString();
vorgangInproHochbau.Statistik1 = reader.GetValue(11).ToString();
vorgangInproHochbau.Statistik2 = reader.GetValue(12).ToString();
vorgangInproHochbau.Genehmigung_Gemeldet = reader.GetValue(13).ToString() == null ? "" : reader.GetValue(13).ToString().Split(' ').FirstOrDefault();
tempDate = reader.GetValue(13).ToString();
if (tempDate == null)
{
vorgangInproHochbau.Genehmigung_Gemeldet = "";
}
else
{
vorgangInproHochbau.Genehmigung_Gemeldet = tempDate.Split(' ').FirstOrDefault();
}
vorgangInproHochbau.Fertigstellung_Gemeldet = reader.GetValue(14).ToString() == null ? "" : reader.GetValue(14).ToString().Split(' ').FirstOrDefault();
vorgangInproHochbau.Baubeginn = reader.GetValue(15).ToString() == null ? "" : reader.GetValue(15).ToString().Split(' ').FirstOrDefault();
tempDate = reader.GetValue(14).ToString();
if (tempDate == null)
{
vorgangInproHochbau.Fertigstellung_Gemeldet = "";
}
else
{
vorgangInproHochbau.Fertigstellung_Gemeldet = tempDate.Split(' ').FirstOrDefault();
}
vorgangInproHochbau.Teilrohbauabnahme = reader.GetValue(16).ToString() == null ? "" : reader.GetValue(16).ToString().Split(' ').FirstOrDefault();
tempDate = reader.GetValue(15).ToString();
if (tempDate == null)
{
vorgangInproHochbau.Baubeginn = "";
}
else
{
vorgangInproHochbau.Baubeginn = tempDate.Split(' ').FirstOrDefault();
}
tempDate = reader.GetValue(16).ToString();
if (tempDate == null)
{
vorgangInproHochbau.Teilrohbauabnahme = "";
}
else
{
vorgangInproHochbau.Teilrohbauabnahme = tempDate.Split(' ').FirstOrDefault();
}
vorgangInproHochbau.Rohbauabnahme = reader.GetValue(17).ToString() == null ? "" : reader.GetValue(17).ToString().Split(' ').FirstOrDefault();
tempDate = reader.GetValue(17).ToString();
if (tempDate == null)
{
vorgangInproHochbau.Rohbauabnahme = "";
}
else
{
vorgangInproHochbau.Rohbauabnahme = tempDate.Split(' ').FirstOrDefault();
}
vorgangInproHochbau.Schlussabnahme = reader.GetValue(18).ToString() == null ? "" : reader.GetValue(18).ToString().Split(' ').FirstOrDefault();
tempDate = reader.GetValue(18).ToString();
if (tempDate == null)
{
vorgangInproHochbau.Schlussabnahme = "";
}
else
{
vorgangInproHochbau.Schlussabnahme = tempDate.Split(' ').FirstOrDefault();
}
string tempDate = string.Empty;
if (tempDate == null)
{
vorgangInproHochbau.Vorjahr = "";

View File

@@ -76,7 +76,20 @@ namespace Hochbaustatistik.Utilities
return az;
}
[ExcludeFromCodeCoverage]
public string ApplyLastAzToNewAz(string az, string currentName, string currentStrasse, LastData ld)
{
int linguName = String.Compare(currentName, ld.name, StringComparison.InvariantCultureIgnoreCase);
int linguStrasse = String.Compare(currentStrasse, ld.strasse, StringComparison.InvariantCultureIgnoreCase);
if (linguName > 0 || linguStrasse > 0)
{
az = ld.az;
}
return az;
}
[ExcludeFromCodeCoverage]
private void CheckForDoubleSlashAndCorrect(ref string az)
{
@@ -173,7 +186,7 @@ namespace Hochbaustatistik.Utilities
public bool IsValid(string az)
{
string pattern = @"\b(61[/][0-9]{1}[-][0-9]{1}[-][0-9]{6})";
Regex r = new Regex(pattern,RegexOptions.None, TimeSpan.FromMilliseconds(5));
Regex r = new Regex(pattern);
bool matched = r.IsMatch(az);
bool len = az.Length == 13;
if (matched && len)
@@ -286,7 +299,8 @@ namespace Hochbaustatistik.Utilities
VorgangInpro vorgangHochbauInpro = DatabaseOperations.ConnectAndExecuteHochbau(vorgang);
if (vorgangHochbauInpro.IdStrasse == null)
{
vorgangHochbauInpro = DatabaseOperations.ConnectAndExecuteHochbau(vorgang, Convert.ToInt32(identifikator));
vorgangHochbauInpro = DatabaseOperations.ConnectAndExecuteHochbau(vorgang, Convert.ToInt32(identifikator));// Convert.ToInt32(ReshapeIdentifikator(hochbauListe.ElementAt(record).Identifikator)));
}
if (vorgang.Aktenzeichen.Equals("NOT_CORRECTED"))
{
@@ -302,7 +316,7 @@ namespace Hochbaustatistik.Utilities
}
#endregion
private static class Nested
private class Nested
{
// Tell C# compiler not to mark type as beforefieldinit (https://csharpindepth.com/articles/BeforeFieldInit)
static Nested()
@@ -317,5 +331,13 @@ namespace Hochbaustatistik.Utilities
{
_logger.Info("Singleton erzeugt.");
}
}
}
public struct LastData
{
public string az;
public string ident;
public string name;
public string strasse;
}
}

View File

@@ -46,7 +46,7 @@ pipeline
environment
{
scannerHome = "C:\\home\\jenkins\\tools\\hudson.plugins.sonar.MsBuildSQRunnerInstallation\\C_sonar-runner"
token = 'sqa_a11eb81bb62f3777b11679484aee7e65ed739ef2'
token = 'sqa_71202f188aacbe40492ba767cf3e841179d3f41a'
project = 'hochbaustatistik'
}
steps