equatable
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
namespace ServiceMonitor;
|
||||
|
||||
public sealed class ApplicationDescriptor
|
||||
public sealed class ApplicationDescriptor : IEquatable<ApplicationDescriptor>
|
||||
{
|
||||
public static readonly ApplicationDescriptor CzechWorker = new ApplicationDescriptor(ApplicationRealm.Czech, ApplicationType.Worker);
|
||||
public static readonly ApplicationDescriptor CzechManager = new ApplicationDescriptor(ApplicationRealm.Czech, ApplicationType.Manager);
|
||||
@@ -58,6 +58,26 @@ public sealed class ApplicationDescriptor
|
||||
|
||||
public ApplicationType Type { get; }
|
||||
|
||||
public bool Equals(ApplicationDescriptor? other)
|
||||
{
|
||||
if (other is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.Type != Type)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.Realm != Realm)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}-{1}", Realm.Name.ToLower(), Type.ToString().ToLower());
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace ServiceMonitor;
|
||||
|
||||
public sealed class ApplicationRealm
|
||||
public sealed class ApplicationRealm : IEquatable<ApplicationRealm>
|
||||
{
|
||||
public static readonly ApplicationRealm Czech = new ApplicationRealm("czech");
|
||||
|
||||
@@ -43,6 +43,21 @@ public sealed class ApplicationRealm
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public bool Equals(ApplicationRealm? other)
|
||||
{
|
||||
if (other is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!string.Equals(other.Name, Name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("realm = '{0}'", Name);
|
||||
|
||||
Reference in New Issue
Block a user