public void AddShouldAddItemToItems() { var item = new CustomOperator("foo"); testee.Add(item); Assert.AreEqual(2, items.Count); Assert.AreSame(item, items[1]); }
public void CompareShouldIgnoreSetOnlyProperty() { var entity = new Entity(); var testee = new CustomOperator(""); var left = new BlankOperand(); var right = new Operand(Expression.Constant(true), typeof(bool)); testee.Compare(Expression.Constant(entity), left, right); CollectionAssert.AreEqual(new string[] { "Both:Get", "GetOnly:Get" }, entity.CalledProperties); Assert.AreEqual(2, testee.CompareCalledCount); }
public void CompareShouldNotEvaluatePropertyWhenLeftOperandIsNotBlank() { var entity = new Entity(); var testee = new CustomOperator(""); var left = new Operand(Expression.Constant(true), typeof(bool)); var right = new Operand(Expression.Constant(true), typeof(bool)); testee.Compare(Expression.Constant(entity), left, right); Assert.AreEqual(0, entity.CalledProperties.Count); Assert.AreEqual(1, testee.CompareCalledCount); }
public string DescriptionShouldReturnCorrectValueWhenOperatorHasDescriptionAttribute(string description) { var testee = new CustomOperator(description); return(testee.Description); }
public string DescriptionShouldReturnCorrectValueWhenOperatorHasDescriptionAttribute(string description) { var testee = new CustomOperator(description); return testee.Description; }
/// <summary> /// Determines whether the specified Object is equal to the current Object. /// </summary> /// <param name="obj"></param> /// <returns></returns> public override bool Equals(object obj) { if (obj == null) { return(false); } if (Object.ReferenceEquals(this, obj)) { return(true); } if (this.GetType() != obj.GetType()) { return(false); } var other = (VLMessage)obj; //reference types if (!Object.Equals(Sender, other.Sender)) { return(false); } if (!Object.Equals(Subject, other.Subject)) { return(false); } if (!Object.Equals(Body, other.Body)) { return(false); } if (!Object.Equals(CustomKeyword, other.CustomKeyword)) { return(false); } if (!Object.Equals(Error, other.Error)) { return(false); } if (!Object.Equals(SenderVerificationCode, other.SenderVerificationCode)) { return(false); } //value types if (!Collector.Equals(other.Collector)) { return(false); } if (!MessageId.Equals(other.MessageId)) { return(false); } if (!Status.Equals(other.Status)) { return(false); } if (!AttributeFlags.Equals(other.AttributeFlags)) { return(false); } if (!ScheduledAt.Equals(other.ScheduledAt)) { return(false); } if (!SentCounter.Equals(other.SentCounter)) { return(false); } if (!FailedCounter.Equals(other.FailedCounter)) { return(false); } if (!SkipCounter.Equals(other.SkipCounter)) { return(false); } if (!DeliveryMethod.Equals(other.DeliveryMethod)) { return(false); } if (!CustomSearchField.Equals(other.CustomSearchField)) { return(false); } if (!CustomOperator.Equals(other.CustomOperator)) { return(false); } if (!PendingAt.Equals(other.PendingAt)) { return(false); } if (!PreparingAt.Equals(other.PreparingAt)) { return(false); } if (!PreparedAt.Equals(other.PreparedAt)) { return(false); } if (!ExecutingAt.Equals(other.ExecutingAt)) { return(false); } if (!TerminatedAt.Equals(other.TerminatedAt)) { return(false); } return(true); }