ModuleSettingFake.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using Quadarax.Application.QLiberace.Common.Settings;
  2. namespace Quadarax.Application.QLiberace.Common.Tests.Settings.Fakes
  3. {
  4. internal class ModuleSettingFake : ModuleSetting
  5. {
  6. public const string DefPropertyString1 = "test1";
  7. public const string? DefPropertyString2 = null;
  8. public const string DefPropertyDateTime1String = "12.3.2022 13:02:54";
  9. public const string? DefPropertyDateTime2String = null;
  10. public const string DefPropertyTimeSpanString = "00:00:35";
  11. public const int DefPropertyInt = 35;
  12. public const bool DefPropertyBool = true;
  13. public string PropertyString1 { get; set; }
  14. public string? PropertyString2 { get; set; }
  15. public DateTime PropertyDateTime1 { get; set; }
  16. public DateTime? PropertyDateTime2 { get; set; }
  17. public TimeSpan? PropertyTimeSpan { get; set; }
  18. public int? PropertyInt { get; set; }
  19. public bool PropertyBool { get; set; }
  20. public ModuleSettingFake()
  21. {
  22. PropertyString1 = string.Empty;
  23. Reset();
  24. }
  25. private void Reset()
  26. {
  27. PropertyString1 = DefPropertyString1;
  28. PropertyString2 = DefPropertyString2;
  29. PropertyDateTime1 = DateTime.Parse(DefPropertyDateTime1String);
  30. PropertyDateTime2 = string.IsNullOrEmpty(DefPropertyDateTime2String)
  31. ? (DateTime?)null
  32. : DateTime.Parse(DefPropertyDateTime2String!);
  33. PropertyTimeSpan = string.IsNullOrEmpty(DefPropertyTimeSpanString)
  34. ? (TimeSpan?)null
  35. : TimeSpan.Parse(DefPropertyTimeSpanString);
  36. PropertyInt = DefPropertyInt;
  37. PropertyBool = DefPropertyBool;
  38. }
  39. }
  40. }