| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using Quadarax.Application.QLiberace.Common.Attributes;
- using Quadarax.Application.QLiberace.Common.Settings;
- namespace Quadarax.Application.QLiberace.Base.Tests.Services.Fakes
- {
- [Module("test")]
- 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 DateTime? PropertyDateTimeNow { 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;
- PropertyDateTimeNow = DateTime.Now;
- 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);
- }
- }
- }
|