GetAll()
+ {
+ using (var context = new inventarisierungsloesungEntities())
+ {
+ return context.Customer.ToList();
+ }
+ }
+
+ public Customer GetSingle(P pkValue)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void Update(Customer entity)
+ {
+ using (var context = new inventarisierungsloesungEntities())
+ {
+ var x = (from c in context.Customer
+ where (c.customer_id == entity.customer_id)
+ select c).SingleOrDefault();
+
+ x.firstname = entity.firstname;
+ x.lastname = entity.lastname;
+ x.customernumber = entity.customernumber;
+ x.kundenkonto_fk = entity.kundenkonto_fk;
+ x.tel = entity.tel;
+ x.email = entity.email;
+ x.url = entity.url;
+ x.password = entity.password;
+ context.SaveChanges();
+ }
+ }
+
+ List IRepositoryBase.GetAll()
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/LoggingClient/LoggingClient/Repository/LocationRepository.cs b/LoggingClient/LoggingClient/Repository/LocationRepository.cs
index 7d153d1..55f1635 100644
--- a/LoggingClient/LoggingClient/Repository/LocationRepository.cs
+++ b/LoggingClient/LoggingClient/Repository/LocationRepository.cs
@@ -23,7 +23,6 @@ namespace LoggingClient.Repository
{
try
{
- location.AddressId = 2;
using (var conn = new MySqlConnection(ConnectionString))
{
conn.Open();
diff --git a/LoggingClient/LoggingClient/Validators/CustomerNumberValidationRule.cs b/LoggingClient/LoggingClient/Validators/CustomerNumberValidationRule.cs
new file mode 100644
index 0000000..33b87f2
--- /dev/null
+++ b/LoggingClient/LoggingClient/Validators/CustomerNumberValidationRule.cs
@@ -0,0 +1,32 @@
+using System.Globalization;
+using System.Text.RegularExpressions;
+using System.Windows.Controls;
+
+namespace LoggingClient.Validators
+{
+ public class CustomerNumberValidationRule : ValidationRule
+ {
+ public string ErrorMessage { get; set; }
+
+ ///
+ /// Regex for Address Number Validation.
+ /// Beginning with CU following a 5 digit number.
+ ///
+ ///
+ ///
+ ///
+ public override ValidationResult Validate(object value, CultureInfo cultureInfo)
+ {
+ Regex regex = new Regex(@"^CU[0-9]{5}$");
+ Match match = regex.Match(value.ToString());
+ if (match == Match.Empty)
+ {
+ return new ValidationResult(false, ErrorMessage);
+ }
+ else
+ {
+ return ValidationResult.ValidResult;
+ }
+ }
+ }
+}
diff --git a/LoggingClient/LoggingClient/Validators/EmailValidationRule.cs b/LoggingClient/LoggingClient/Validators/EmailValidationRule.cs
new file mode 100644
index 0000000..017fc06
--- /dev/null
+++ b/LoggingClient/LoggingClient/Validators/EmailValidationRule.cs
@@ -0,0 +1,31 @@
+using System.Globalization;
+using System.Text.RegularExpressions;
+using System.Windows.Controls;
+
+namespace LoggingClient.Validators
+{
+ public class EmailValidationRule : ValidationRule
+ {
+ public string ErrorMessage { get; set; }
+ ///
+ /// Checks an Email Address if it's valid or not
+ /// Regex doesn't check if the top + subdomains are valid.
+ ///
+ ///
+ ///
+ ///
+ public override ValidationResult Validate(object value, CultureInfo cultureInfo)
+ {
+ Regex regex = new Regex(@"\A[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\z");
+ Match match = regex.Match(value.ToString());
+ if (match == Match.Empty)
+ {
+ return new ValidationResult(false, ErrorMessage);
+ }
+ else
+ {
+ return ValidationResult.ValidResult;
+ }
+ }
+ }
+}
diff --git a/LoggingClient/LoggingClient/Validators/IntRangeValidationRule.cs b/LoggingClient/LoggingClient/Validators/IntRangeValidationRule.cs
index 487f8e2..212ce20 100644
--- a/LoggingClient/LoggingClient/Validators/IntRangeValidationRule.cs
+++ b/LoggingClient/LoggingClient/Validators/IntRangeValidationRule.cs
@@ -10,8 +10,8 @@ namespace LoggingClient.Validators
{
public class IntRangeValidationRule : ValidationRule
{
- public int MinimumLength { get; set; }
- public int MaximumLength { get; set; }
+ public int MinimumLength { get; set; } = 1;
+ public int MaximumLength { get; set; } = 8;
public string ErrorMessage { get; set; }
public override ValidationResult Validate(object value,
CultureInfo cultureInfo)
diff --git a/LoggingClient/LoggingClient/Validators/PasswordValidationRule.cs b/LoggingClient/LoggingClient/Validators/PasswordValidationRule.cs
new file mode 100644
index 0000000..4ea68c0
--- /dev/null
+++ b/LoggingClient/LoggingClient/Validators/PasswordValidationRule.cs
@@ -0,0 +1,31 @@
+using System.Globalization;
+using System.Text.RegularExpressions;
+using System.Windows.Controls;
+
+namespace LoggingClient.Validators
+{
+ public class PasswordValidationRule : ValidationRule
+ {
+ public string ErrorMessage { get; set; }
+ ///
+ /// Regex for password validation
+ /// 8 - 15 characters. At least 1 upper, 1 lowercase, 1 number and 1 special character.
+ ///
+ ///
+ ///
+ ///
+ public override ValidationResult Validate(object value, CultureInfo cultureInfo)
+ {
+ Regex regex = new Regex(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\da-zA-Z]).{8,15}$");
+ Match match = regex.Match(value.ToString());
+ if (match == Match.Empty)
+ {
+ return new ValidationResult(false, ErrorMessage);
+ }
+ else
+ {
+ return ValidationResult.ValidResult;
+ }
+ }
+ }
+}
diff --git a/LoggingClient/LoggingClient/Validators/StringRangeValidationRule.cs b/LoggingClient/LoggingClient/Validators/StringRangeValidationRule.cs
index 2e285ff..48874ba 100644
--- a/LoggingClient/LoggingClient/Validators/StringRangeValidationRule.cs
+++ b/LoggingClient/LoggingClient/Validators/StringRangeValidationRule.cs
@@ -10,8 +10,8 @@ namespace LoggingClient.Validators
{
public class StringRangeValidationRule : ValidationRule
{
- public int MinimumLength { get; set; }
- public int MaximumLength { get; set; }
+ public int MinimumLength { get; set; } = 1;
+ public int MaximumLength { get; set; } = 50;
public string ErrorMessage { get; set; }
diff --git a/LoggingClient/LoggingClient/Validators/UrlValidationRule.cs b/LoggingClient/LoggingClient/Validators/UrlValidationRule.cs
new file mode 100644
index 0000000..2172096
--- /dev/null
+++ b/LoggingClient/LoggingClient/Validators/UrlValidationRule.cs
@@ -0,0 +1,32 @@
+using System.Globalization;
+using System.Text.RegularExpressions;
+using System.Windows.Controls;
+
+namespace LoggingClient.Validators
+{
+ public class UrlValidationRule : ValidationRule
+ {
+ public string ErrorMessage { get; set; }
+
+ ///
+ /// Regex for url Validation.
+ /// Doesn't check if the url exists.
+ ///
+ ///
+ ///
+ ///
+ public override ValidationResult Validate(object value, CultureInfo cultureInfo)
+ {
+ Regex regex = new Regex(@"^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$");
+ Match match = regex.Match(value.ToString());
+ if (match == Match.Empty)
+ {
+ return new ValidationResult(false, ErrorMessage);
+ }
+ else
+ {
+ return ValidationResult.ValidResult;
+ }
+ }
+ }
+}
diff --git a/LoggingClient/LoggingClient/ViewModel/CustomerViewModel.cs b/LoggingClient/LoggingClient/ViewModel/CustomerViewModel.cs
index 106408d..a474d28 100644
--- a/LoggingClient/LoggingClient/ViewModel/CustomerViewModel.cs
+++ b/LoggingClient/LoggingClient/ViewModel/CustomerViewModel.cs
@@ -33,7 +33,7 @@ namespace LoggingClient.ViewModel
}
}
- public Customer NewCustomerEntry { get; set; }
+ public Customer SelectedItem { get; set; }
private long _customerId;
public long customer_id
@@ -58,6 +58,8 @@ namespace LoggingClient.ViewModel
}
private bool _LinqIsChecked;
+ private Customer mySelectedItem;
+
public bool LinqIsChecked
{
get { return _LinqIsChecked; }
@@ -67,17 +69,26 @@ namespace LoggingClient.ViewModel
OnPropertyChanged(nameof(LinqIsChecked));
}
}
- public Customer SelectedItem { get; set; }
+
public CustomerViewModel()
{
TxtConnectionString = "Server=localhost;Database=inventarisierungsloesung;Uid=root;Pwd=MySQLPassword1234!;";
Customers = new List();
- NewCustomerEntry = new Customer();
+
_dupChecker = new DuplicateChecker();
}
- public Customer MySelectedItem { get; set; }
+ public Customer MySelectedItem
+ {
+ get => mySelectedItem;
+ set
+ {
+ mySelectedItem = value;
+ this.OnPropertyChanged("MySelectedItem");
+
+ }
+ }
public event PropertyChangedEventHandler PropertyChanged;
public string TxtConnectionString
@@ -161,6 +172,8 @@ namespace LoggingClient.ViewModel
{
var customerModelRepositoryEF = new CustomerRepositoryEF();
Customers = customerModelRepositoryEF.GetAll();
+
+ this.MySelectedItem = new Customer();
}
catch (Exception ex)
{
@@ -169,7 +182,15 @@ namespace LoggingClient.ViewModel
}
if (_LinqIsChecked)
{
- //TODO
+ try
+ {
+ var customerModelRepositoryLinq = new CustomerRepositoryLinq();
+ Customers = customerModelRepositoryLinq.GetAll().ToList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Error occurred: " + ex.Message);
+ }
}
if (!_EfIsChecked && !_LinqIsChecked)
{
@@ -191,24 +212,47 @@ namespace LoggingClient.ViewModel
try
{
var customerModelRepositoryEF = new CustomerRepositoryEF();
- customerModelRepositoryEF.Add(NewCustomerEntry);
+ customerModelRepositoryEF.Add(MySelectedItem);
Customers = customerModelRepositoryEF.GetAll();
}
catch (Exception ex)
{
- MessageBox.Show("Error occurred: " + ex.Message);
+ if (MySelectedItem.kundenkonto_fk == 0)
+ {
+ MessageBox.Show("Error occurred: CustAcck ID darf nicht 0 sein");
+ }
+ else
+ {
+ MessageBox.Show("Error occurred: " + ex.Message);
+ }
}
}
if (_LinqIsChecked)
{
- // TODO
+ try
+ {
+ var customerModelRepositoryLinq = new CustomerRepositoryLinq();
+ customerModelRepositoryLinq.Add(MySelectedItem);
+ Customers = customerModelRepositoryLinq.GetAll();
+ }
+ catch (Exception ex)
+ {
+ if (MySelectedItem.kundenkonto_fk == 0)
+ {
+ MessageBox.Show("Error occurred: CustAcck ID darf nicht 0 sein");
+ }
+ else
+ {
+ MessageBox.Show("Error occurred: " + ex.Message);
+ }
+ }
}
if (!_EfIsChecked && !_LinqIsChecked)
{
try
{
var customerModelRepository = new CustomerRepository(TxtConnectionString);
- customerModelRepository.Add(this.NewCustomerEntry);
+ customerModelRepository.Add(MySelectedItem);
this.Customers = customerModelRepository.GetAll().ToList();
}
catch (Exception ex)
@@ -232,12 +276,25 @@ namespace LoggingClient.ViewModel
MessageBox.Show("Error occurred: " + ex.Message);
}
}
+ if (_LinqIsChecked)
+ {
+ try
+ {
+ var customerModelRepositoryLinq = new CustomerRepositoryLinq();
+ customerModelRepositoryLinq.Delete(MySelectedItem);
+ Customers = customerModelRepositoryLinq.GetAll().ToList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Error occurred: " + ex.Message);
+ }
+ }
if (!_EfIsChecked && !_LinqIsChecked)
{
try
{
var customerModelRepository = new CustomerRepository(TxtConnectionString);
- customerModelRepository.Delete(this.NewCustomerEntry);
+ customerModelRepository.Delete(MySelectedItem);
this.Customers = customerModelRepository.GetAll().ToList();
}
catch (Exception ex)
@@ -248,15 +305,45 @@ namespace LoggingClient.ViewModel
}
private void UpdateData()
{
- try
+ if (_EfIsChecked)
{
- var customerModelRepository = new CustomerRepository(TxtConnectionString);
- customerModelRepository.Update(this.NewCustomerEntry);
- this.Customers = customerModelRepository.GetAll().ToList();
+ try
+ {
+ var customerModelRepositoryEF = new CustomerRepositoryEF();
+ customerModelRepositoryEF.Update(MySelectedItem);
+ Customers = customerModelRepositoryEF.GetAll();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Error occurred: " + ex.Message);
+ }
}
- catch (Exception ex)
+ if (_LinqIsChecked)
{
- MessageBox.Show("Error occurred: " + ex.Message);
+ try
+ {
+ var customerModelRepositoryLinq = new CustomerRepositoryLinq();
+ customerModelRepositoryLinq.Update(MySelectedItem);
+ Customers = customerModelRepositoryLinq.GetAll().ToList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Error occurred: " + ex.Message);
+ }
+ }
+ if (!_EfIsChecked && !_LinqIsChecked)
+ {
+
+ try
+ {
+ var customerModelRepository = new CustomerRepository(TxtConnectionString);
+ customerModelRepository.Update(MySelectedItem);
+ this.Customers = customerModelRepository.GetAll().ToList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Error occurred: " + ex.Message);
+ }
}
}
diff --git a/LoggingClient/LoggingClient/ViewModel/LocationViewModel.cs b/LoggingClient/LoggingClient/ViewModel/LocationViewModel.cs
index d542656..870f35a 100644
--- a/LoggingClient/LoggingClient/ViewModel/LocationViewModel.cs
+++ b/LoggingClient/LoggingClient/ViewModel/LocationViewModel.cs
@@ -29,15 +29,13 @@ namespace LoggingClient.ViewModel
}
}
private List _locations;
- public Location NewLocationModelEntry { get; set; }
+ public Location SelectedItem { get; set; }
public List> LocationTree { get; set; }
public LocationViewModel()
{
TxtConnectionString = "Server=localhost;Database=inventarisierungsloesung;Uid=root;Pwd=MySQLPassword1234!;";
Locations = new List();
- NewLocationModelEntry = new Location();
-
}
public Location MySelectedItem { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
@@ -126,7 +124,7 @@ namespace LoggingClient.ViewModel
try
{
var locationModelRepository = new LocationRepository(TxtConnectionString);
- locationModelRepository.Add(this.NewLocationModelEntry);
+ locationModelRepository.Add(SelectedItem);
this.Locations = locationModelRepository.GetAll();
}
catch (Exception ex)
@@ -139,7 +137,7 @@ namespace LoggingClient.ViewModel
try
{
var locationModelRepository = new LocationRepository(TxtConnectionString);
- locationModelRepository.Delete(this.NewLocationModelEntry);
+ locationModelRepository.Delete(SelectedItem);
this.Locations = locationModelRepository.GetAll();
}
catch (Exception ex)
@@ -152,7 +150,7 @@ namespace LoggingClient.ViewModel
try
{
var locationModelRepository = new LocationRepository(TxtConnectionString);
- locationModelRepository.Update(this.NewLocationModelEntry);
+ locationModelRepository.Update(SelectedItem);
this.Locations = locationModelRepository.GetAll();
}
catch (Exception ex)
diff --git a/LoggingClient/LoggingClient/Views/CustomerView.xaml b/LoggingClient/LoggingClient/Views/CustomerView.xaml
index dfc9405..da0c89b 100644
--- a/LoggingClient/LoggingClient/Views/CustomerView.xaml
+++ b/LoggingClient/LoggingClient/Views/CustomerView.xaml
@@ -15,7 +15,7 @@
-
+
@@ -35,7 +35,7 @@
-
+
-
+
-
+
-
+
@@ -73,11 +72,10 @@
-
+
-
+
@@ -85,7 +83,7 @@
-
+
@@ -97,7 +95,7 @@
-
+
-
+
-
+
-
+
-
+
diff --git a/LoggingClient/LoggingClient/Views/LocationView.xaml b/LoggingClient/LoggingClient/Views/LocationView.xaml
index d216f7c..70c86b0 100644
--- a/LoggingClient/LoggingClient/Views/LocationView.xaml
+++ b/LoggingClient/LoggingClient/Views/LocationView.xaml
@@ -16,7 +16,7 @@
-
+
@@ -34,7 +34,7 @@
-
+
-
+
-
+
-
+
-
+
\ No newline at end of file
diff --git a/LoggingClient/LoggingClientUnitTest/LoggingClientUnitTest.csproj b/LoggingClient/LoggingClientUnitTest/LoggingClientUnitTest.csproj
new file mode 100644
index 0000000..a4ccd9a
--- /dev/null
+++ b/LoggingClient/LoggingClientUnitTest/LoggingClientUnitTest.csproj
@@ -0,0 +1,75 @@
+
+
+
+
+
+ Debug
+ AnyCPU
+ {6B9F572F-AE97-4A52-89AD-4453BC51E038}
+ Library
+ Properties
+ LoggingClientUnitTest
+ LoggingClientUnitTest
+ v4.7.2
+ 512
+ {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 15.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+ $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
+ False
+ UnitTest
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\MSTest.TestFramework.2.1.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll
+
+
+ ..\packages\MSTest.TestFramework.2.1.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {2622c2fc-3522-4d6f-b021-f63a243e77f1}
+ LoggingClient
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
\ No newline at end of file
diff --git a/LoggingClient/LoggingClientUnitTest/Properties/AssemblyInfo.cs b/LoggingClient/LoggingClientUnitTest/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..6f83403
--- /dev/null
+++ b/LoggingClient/LoggingClientUnitTest/Properties/AssemblyInfo.cs
@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("LoggingClientUnitTest")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("LoggingClientUnitTest")]
+[assembly: AssemblyCopyright("Copyright © 2020")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: ComVisible(false)]
+
+[assembly: Guid("6b9f572f-ae97-4a52-89ad-4453bc51e038")]
+
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/LoggingClient/LoggingClientUnitTest/RegEx.cs b/LoggingClient/LoggingClientUnitTest/RegEx.cs
new file mode 100644
index 0000000..d121591
--- /dev/null
+++ b/LoggingClient/LoggingClientUnitTest/RegEx.cs
@@ -0,0 +1,284 @@
+using System;
+using System.Globalization;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using LoggingClient.Validators;
+
+namespace LoggingClientUnitTest
+{
+ [TestClass]
+ public class RegEx
+ {
+ [TestMethod]
+ public void TestCustomerNumberRegex_True()
+ {
+ // arrange
+ var customerNumberValidationRule = new CustomerNumberValidationRule();
+ // act
+ var result = customerNumberValidationRule.Validate("CU12345", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsTrue(result.IsValid);
+ }
+ [TestMethod]
+ public void TestCustomerNumberRegex_False()
+ {
+ // arrange
+ var customerNumberValidationRule = new CustomerNumberValidationRule();
+ // act
+ var result = customerNumberValidationRule.Validate("CU123456", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsFalse(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestCustomerNumberRegex_lower_False()
+ {
+ // arrange
+ var customerNumberValidationRule = new CustomerNumberValidationRule();
+ // act
+ var result = customerNumberValidationRule.Validate("cu12345", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsFalse(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestCustomerNumberRegex_wrongChar_False()
+ {
+ // arrange
+ var customerNumberValidationRule = new CustomerNumberValidationRule();
+ // act
+ var result = customerNumberValidationRule.Validate("ab12345", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsFalse(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestCustomerNumberRegex_wrongCharUpper_False()
+ {
+ // arrange
+ var customerNumberValidationRule = new CustomerNumberValidationRule();
+ // act
+ var result = customerNumberValidationRule.Validate("ZZ12345", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsFalse(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestCustomerNumberRegex_onlyDigit_False()
+ {
+ // arrange
+ var customerNumberValidationRule = new CustomerNumberValidationRule();
+ // act
+ var result = customerNumberValidationRule.Validate("0012345", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsFalse(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestEmailRegex_True()
+ {
+ // arrange
+ var emailValidationRule = new EmailValidationRule();
+ // act
+ var result = emailValidationRule.Validate("test.test@test.com", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsTrue(result.IsValid);
+ }
+ [TestMethod]
+ public void TestEmailRegex_False()
+ {
+ // arrange
+ var emailValidationRule = new EmailValidationRule();
+ // act
+ var result = emailValidationRule.Validate("test.test@.com", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsFalse(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestEmailRegex_2_False()
+ {
+ // arrange
+ var emailValidationRule = new EmailValidationRule();
+ // act
+ var result = emailValidationRule.Validate("test..test@a.com", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsFalse(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestEmailRegex_3_False()
+ {
+ // arrange
+ var emailValidationRule = new EmailValidationRule();
+ // act
+ var result = emailValidationRule.Validate("test.test@a_com", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsFalse(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestIntRangeValidation_True()
+ {
+ // arrange
+ var intRangeValidationRule = new IntRangeValidationRule();
+ // act
+ var result = intRangeValidationRule.Validate("8", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsTrue(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestIntRangeValidation_False()
+ {
+ // arrange
+ var intRangeValidationRule = new IntRangeValidationRule();
+ // act
+ var result = intRangeValidationRule.Validate("100", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsFalse(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestPasswordRegex_True()
+ {
+ // arrange
+ var passwordValidationRule = new PasswordValidationRule();
+ // act
+ var result = passwordValidationRule.Validate("Test1234?", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsTrue(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestPasswordRegex_noLenght_False()
+ {
+ // arrange
+ var passwordValidationRule = new PasswordValidationRule();
+ // act
+ var result = passwordValidationRule.Validate("Test12!", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsFalse(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestPasswordRegex_nolower_False()
+ {
+ // arrange
+ var passwordValidationRule = new PasswordValidationRule();
+ // act
+ var result = passwordValidationRule.Validate("TWST1234!", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsFalse(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestPasswordRegex_noUpper_False()
+ {
+ // arrange
+ var passwordValidationRule = new PasswordValidationRule();
+ // act
+ var result = passwordValidationRule.Validate("test1234!", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsFalse(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestPasswordRegex_noSpecials_False()
+ {
+ // arrange
+ var passwordValidationRule = new PasswordValidationRule();
+ // act
+ var result = passwordValidationRule.Validate("test1234", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsFalse(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestStringRangeValidation_True()
+ {
+ // arrange
+ var stringRangeValidationRule = new StringRangeValidationRule();
+ // act
+ var result = stringRangeValidationRule.Validate("Test", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsTrue(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestStringRangeValidation_False()
+ {
+ // arrange
+ var stringRangeValidationRule = new StringRangeValidationRule();
+ // act
+ var result = stringRangeValidationRule.Validate("", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsFalse(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestUrlRegex_subdomain_True()
+ {
+ // arrange
+ var urlValidationRule = new UrlValidationRule();
+ // act
+ var result = urlValidationRule.Validate("www.google.com", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsTrue(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestUrlRegex_prefix_True()
+ {
+ // arrange
+ var urlValidationRule = new UrlValidationRule();
+ // act
+ var result = urlValidationRule.Validate("https://google.com", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsTrue(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestUrlRegex_prefix_subdomain_True()
+ {
+ // arrange
+ var urlValidationRule = new UrlValidationRule();
+ // act
+ var result = urlValidationRule.Validate("https://www.google.com", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsTrue(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestUrlRegex_prefix_subdomain_endpoint_True()
+ {
+ // arrange
+ var urlValidationRule = new UrlValidationRule();
+ // act
+ var result = urlValidationRule.Validate("https://www.google.com/passwords", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsTrue(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestUrlRegex_prefix_subdomain_endpoint_query_True()
+ {
+ // arrange
+ var urlValidationRule = new UrlValidationRule();
+ // act
+ var result = urlValidationRule.Validate("https://www.google.com/passwords?lernen.zbw=rafr1", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsTrue(result.IsValid);
+ }
+
+ [TestMethod]
+ public void TestUrlRegex_False()
+ {
+ // arrange
+ var urlValidationRule = new UrlValidationRule();
+ // act
+ var result = urlValidationRule.Validate("google", CultureInfo.CurrentCulture);
+ // assert
+ Assert.IsFalse(result.IsValid);
+ }
+ }
+}
diff --git a/LoggingClient/LoggingClientUnitTest/packages.config b/LoggingClient/LoggingClientUnitTest/packages.config
new file mode 100644
index 0000000..7079f81
--- /dev/null
+++ b/LoggingClient/LoggingClientUnitTest/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 2af6bca..0a198ff 100644
--- a/README.md
+++ b/README.md
@@ -69,27 +69,24 @@ Button Erklärung:
## Generics
-Mit dem Reiter kann Zwischen Location und Logs gewechselt werden.
-
-Logs gleiche Funktionalität unverändert.
-
-Location können die vorhandenen Locaiton abgerufen werden und in einer Baumstruktur angezeigt werden.
-
-Implementationen wie Add, Update und Delete sind vorhanden aber keine UI bereitgelegt da diese noch Fehlerhaft sind.
-
-TODO: Add, Update, Delete produktiv implementieren.
+Die Ganze Architektur auf Generics umgeschrieben.
## LINQ
-
+Implementierung von einem Radiobutton um die Möglichkeit zu haben die DB-Abragen via LINQ to SQL zu tätigen.
## RegEx
+Die Felder `Email`, `URL`, `Passwort` und `CustomerNumber` folgen die Constraint der Aufgabenstellung.
+Email: Gültige Mailadresse
+
+URL: Verschiedene Schreibweisen mit, ohne https:// und mit und ohne Querystrings.
+
+Passwort: 8 - 15 Zeichen, min 1 Gross-, 1 Kleinbuchstabe, 1 Zahl und 1 Sonderzeichen.
+
+CustomerNumber: Beginnend mit CU und folgt von 5 Zahlen.
## Inversion of Control
-
-## Reflection & Serialization
-