public override bool Match(ITest test) { string assemblyName = string.Empty; //Assembly fullname is in the format "Assembly-name, meta data ...", so extract the name by looking for the comma if (test.TypeInfo != null && test.TypeInfo.Assembly != null && test.TypeInfo.FullName != null) { assemblyName = test.TypeInfo.Assembly.FullName.Substring(0, test.TypeInfo.Assembly.FullName.IndexOf(',')).TrimEnd(','); } return(ExpectedValue.Equals(assemblyName, StringComparison.OrdinalIgnoreCase)); }
public bool CheckPolicy(ShoppingCart cart, Guid productGuid, int quantity, BaseUser user, IUnitOfWork unitOfWork) { foreach (PropertyInfo property in user.GetType().GetProperties()) { if (property.Name == FieldName) { return(ExpectedValue.Equals(property.GetValue(user)) ? true : false); } } return(false); }
/// <summary> /// Returns true if Metric instances are equal /// </summary> /// <param name="other">Instance of Metric to be compared</param> /// <returns>Boolean</returns> public bool Equals(Metric other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( Severity == other.Severity || Severity.Equals(other.Severity) ) && ( Passed == other.Passed || Passed.Equals(other.Passed) ) && ( Override == other.Override || Override.Equals(other.Override) ) && ( ActualValue == other.ActualValue || ActualValue != null && ActualValue.Equals(other.ActualValue) ) && ( ExpectedValue == other.ExpectedValue || ExpectedValue != null && ExpectedValue.Equals(other.ExpectedValue) ) && ( Comparator == other.Comparator || Comparator.Equals(other.Comparator) ) && ( Kpi == other.Kpi || Kpi != null && Kpi.Equals(other.Kpi) )); }
public override bool Equals(object obj) { var otherType = typeof(object); if (obj != null) { if (obj.GetType().BaseType != null && obj.GetType().Namespace == "System.Data.Entity.DynamicProxies") { otherType = obj.GetType().BaseType; } else { otherType = obj.GetType(); } } if (obj == null || typeof(Criteria) != otherType) { return(false); } var other = (Criteria)obj; if (!Name.Equals(other.Name)) { return(false); } if (ExpectedValue == null) { if (other.ExpectedValue != null) { return(false); } } else if (!ExpectedValue.Equals(other.ExpectedValue)) { return(false); } if (Location != other.Location) { return(false); } if (!Selector.Equals(other.Selector)) { return(false); } return(true); }
public bool Equals(Distinction other) => other != null && (ReferenceEquals(this, other) || Name.Equals(other.Name) && ActuallyValue.Equals(other.ActuallyValue) && ExpectedValue.Equals(other.ExpectedValue));