public void Equals() { DateValue v = new DateValue(1961, 6, 6); Assert.IsTrue(v.Equals(new DateValue(1961, 6, 6))); Assert.IsFalse(v.Equals(new DateValue(1961, 6, 5))); }
public void UnansEquals3() { DateValue uv1 = new DateValue(); DateValue uv2 = new DateValue(); uv1.Equals(uv2); }
public void UnansEquals2() { DateValue v = new DateValue(1961, 6, 6); DateValue uv = new DateValue(); v.Equals(uv); }
public void UnansEquals1() { DateValue v = new DateValue(1961, 6, 6); DateValue uv = new DateValue(); uv.Equals(v); }
public override bool Equals(object o) { if (this == o) { return(true); } if (o == null || GetType() != o.GetType()) { return(false); } var that = (FilledAutofillField)o; if (TextValue != null ? !TextValue.Equals(that.TextValue) : that.TextValue != null) { return(false); } if (DateValue != null ? !DateValue.Equals(that.DateValue) : that.DateValue != null) { return(false); } return(ToggleValue != null?ToggleValue.Equals(that.ToggleValue) : that.ToggleValue == null); }
/// <summary> /// Parses enumerated days of week for a week and returns a list containing those DayOfWeeks. /// </summary> /// <returns> /// a list containing those DayOfWeeks. /// </returns> /// <exception cref="RuleInvalidDataException"> /// If the DateValue is not in valid format. /// </exception> private IList <DayOfWeek> GetWeekDaysForDayOfWeek() { IList <DayOfWeek> ret = new List <DayOfWeek>(); if (DateValue.Equals(String.Empty)) { return(ret); } try { //A value like "Monday-Wednesday;Friday;Sunday" can be parsed here. //First split using ';' string[] firstSplit = DateValue.Split(';'); for (int i = 0; i < firstSplit.Length; i++) { //Now split using '-' string[] secondSplit = firstSplit[i].Split('-'); //The parsed value must be a defined enum value if (!Enum.IsDefined(typeof(DayOfWeek), secondSplit[0])) { throw new RuleInvalidDataException(secondSplit[0] + " is an invalid DayOfWeek value."); } //We have a DayOfWeek range if (secondSplit.Length == 2) { //The parsed value must be a defined enum value if (!Enum.IsDefined(typeof(DayOfWeek), secondSplit[1])) { throw new RuleInvalidDataException(secondSplit[1] + " is an invalid DayOfWeek value."); } DayOfWeek rangeStart = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), secondSplit[0]); DayOfWeek rangeEnd = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), secondSplit[1]); for (DayOfWeek j = rangeStart; j <= rangeEnd; j++) { ret.Add(j); } } //We have a normal single date else { ret.Add((DayOfWeek)Enum.Parse(typeof(DayOfWeek), secondSplit[0])); } } } catch (RuleInvalidDataException e) { throw e; } catch (Exception e) { throw new RuleInvalidDataException(DateValue + " is an invalid date value.", e); } return(ret); }
public bool Equals(SubClass other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(DateValue.Equals(other.DateValue) && IntegralValue == other.IntegralValue && string.Equals(StringValue, other.StringValue)); }
/// <summary> /// Parses enumerated day numbers for a month returns a list containing those day numbers. /// </summary> /// <returns> /// a list containing those day numbers. /// </returns> /// <exception cref="RuleInvalidDataException"> /// If the DateValue is not in valid format. /// </exception> private IList <int> GetDayNumbersForDaysOfMonth() { List <int> ret = new List <int>(); if (DateValue.Equals(String.Empty)) { return(ret); } try { //A value like "1-5;7;9-12;15" can be parsed here. //First split using ';' string[] firstSplit = DateValue.Split(';'); for (int i = 0; i < firstSplit.Length; i++) { //Now split using '-' string[] secondSplit = firstSplit[i].Split('-'); //We have a day range if (secondSplit.Length == 2) { int rangeStart = int.Parse(secondSplit[0]); int rangeEnd = int.Parse(secondSplit[1]); for (int j = rangeStart; j <= rangeEnd; j++) { ret.Add(j); } } //We have a normal single date else { ret.Add(int.Parse(secondSplit[0])); } } } catch (Exception e) { throw new RuleInvalidDataException(DateValue + " is an invalid date value.", e); } //Sort the day numbers before returning ret.Sort(); return(ret); }
public XNode ToXML() { XElement xDate = new XElement(Fb2Const.fb2DefaultNamespace + Fb2DateElementName); if (!string.IsNullOrEmpty(Text)) { xDate.Value = Text; } if (!string.IsNullOrEmpty(Language)) { xDate.Add(new XAttribute(XNamespace.Xml + "lang", Language)); } if (!DateValue.Equals(DateTime.MinValue)) { xDate.Add(new XAttribute("value", DateValue.ToShortDateString())); } return(xDate); }
public bool Equals(ComplexTypeClass other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(DateValue.Equals(other.DateValue) && IntegralValue == other.IntegralValue && string.Equals(StringValue, other.StringValue) && NullableProperty == other.NullableProperty && Equals(Component, other.Component) && (PrimitiveList != null && PrimitiveList.SequenceEqual(other.PrimitiveList) || PrimitiveList == null && other.PrimitiveList == null) && (ComplexCollection != null && ComplexCollection.SequenceEqual(other.ComplexCollection) || ComplexCollection == null && other.ComplexCollection == null)); }
public override bool Equals(object obj) { if (this == obj) { return(true); } if (obj == null || GetType() != obj.GetType()) { return(false); } FilledAutofillField that = (FilledAutofillField)obj; if (!TextValue?.Equals(that.TextValue) ?? that.TextValue != null) { return(false); } if (DateValue != null ? !DateValue.Equals(that.DateValue) : that.DateValue != null) { return(false); } return(ToggleValue != null?ToggleValue.Equals(that.ToggleValue) : that.ToggleValue == null); }