| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- using Quadarax.Application.QLiberace.Common.Settings;
- namespace Quadarax.Application.QLiberace.Common.Tests.Settings.Fakes
- {
- internal class ModuleSettingFake : ModuleSetting, IEquatable<ModuleSettingFake>
- {
- public const string DefPropertyString1 = "test1";
- public const string? DefPropertyString2 = null;
- public const string DefPropertyDateTime1String = "12.3.2022 13:02:54";
- public const string? DefPropertyDateTime2String = null;
- public const string DefPropertyTimeSpanString = "00:00:35";
- public const int DefPropertyInt = 35;
- public const bool DefPropertyBool = true;
- public string PropertyString1 { get; set; }
- public string? PropertyString2 { get; set; }
- public DateTime PropertyDateTime1 { get; set; }
- public DateTime? PropertyDateTime2 { get; set; }
- public TimeSpan? PropertyTimeSpan { get; set; }
- public int? PropertyInt { get; set; }
- public bool PropertyBool { get; set; }
- private bool InvisiblePropertyBool { get; set; }
- public ModuleSettingFake()
- {
- PropertyString1 = string.Empty;
- Reset();
- }
- public void Clear()
- {
- PropertyString1 = string.Empty;
- PropertyString2 = null;
- PropertyDateTime1 = DateTime.MinValue;
- PropertyDateTime2 = null;
- PropertyTimeSpan = null;
- PropertyInt = null;
- PropertyBool = false;
- InvisiblePropertyBool = true;
- }
- public void Reset()
- {
- PropertyString1 = DefPropertyString1;
- PropertyString2 = DefPropertyString2;
- PropertyDateTime1 = DateTime.Parse(DefPropertyDateTime1String);
- PropertyDateTime2 = string.IsNullOrEmpty(DefPropertyDateTime2String)
- ? (DateTime?)null
- : DateTime.Parse(DefPropertyDateTime2String!);
- PropertyTimeSpan = string.IsNullOrEmpty(DefPropertyTimeSpanString)
- ? (TimeSpan?)null
- : TimeSpan.Parse(DefPropertyTimeSpanString);
- PropertyInt = DefPropertyInt;
- PropertyBool = DefPropertyBool;
- InvisiblePropertyBool = true;
- }
- public bool Equals(ModuleSettingFake? other)
- {
- if (ReferenceEquals(null, other)) return false;
- if (ReferenceEquals(this, other)) return true;
- return PropertyString1 == other.PropertyString1 && PropertyString2 == other.PropertyString2 && PropertyDateTime1.Equals(other.PropertyDateTime1) && Nullable.Equals(PropertyDateTime2, other.PropertyDateTime2) && Nullable.Equals(PropertyTimeSpan, other.PropertyTimeSpan) && PropertyInt == other.PropertyInt && PropertyBool == other.PropertyBool && InvisiblePropertyBool == other.InvisiblePropertyBool;
- }
- public override bool Equals(object? obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != this.GetType()) return false;
- return Equals((ModuleSettingFake)obj);
- }
- public override int GetHashCode()
- {
- return HashCode.Combine(PropertyString1, PropertyString2, PropertyDateTime1, PropertyDateTime2, PropertyTimeSpan, PropertyInt, PropertyBool, InvisiblePropertyBool);
- }
- }
- }
|