public override int GetHashCode() { int hashCode = 17; // we *know* we are using this in a dictionary, so pre-compute this hashCode = hashCode * 23 + Id.GetHashCode(); hashCode = hashCode * 23 + (Fid == null ? 0 : Fid.GetHashCode()); hashCode = hashCode * 23 + (EnableDate == null ? 0 : EnableDate.GetHashCode()); hashCode = hashCode * 23 + (DisableDate == null ? 0 : DisableDate.GetHashCode()); hashCode = hashCode * 23 + Dr.GetHashCode(); hashCode = hashCode * 23 + Ts.GetHashCode(); hashCode = hashCode * 23 + (CreateBy == null ? 0 : CreateBy.GetHashCode()); hashCode = hashCode * 23 + (CreateDate == null ? 0 : CreateDate.GetHashCode()); hashCode = hashCode * 23 + (CreateName == null ? 0 : CreateName.GetHashCode()); hashCode = hashCode * 23 + (UpdateBy == null ? 0 : UpdateBy.GetHashCode()); hashCode = hashCode * 23 + (UpdateDate == null ? 0 : UpdateDate.GetHashCode()); hashCode = hashCode * 23 + (UpdateName == null ? 0 : UpdateName.GetHashCode()); hashCode = hashCode * 23 + (TableName == null ? 0 : TableName.GetHashCode()); hashCode = hashCode * 23 + (TableComment == null ? 0 : TableComment.GetHashCode()); hashCode = hashCode * 23 + (TableMode == null ? 0 : TableMode.GetHashCode()); hashCode = hashCode * 23 + (SubTable == null ? 0 : SubTable.GetHashCode()); hashCode = hashCode * 23 + IsTree.GetHashCode(); hashCode = hashCode * 23 + IsPagination.GetHashCode(); hashCode = hashCode * 23 + IsSync.GetHashCode(); return(hashCode); }
public void GetDisabledDatesReturnInvalid(int addDays, string dateFormat) { var disabledDate = new DisableDate { Id = 1, DisabledDates = DateTime.Today.AddDays(+1) }; this.db.DisableDates.Add(disabledDate); this.db.SaveChanges(); var dates = this.appointmentService.GetDisabledDates(); var date = DateTime.Today.AddDays(addDays).ToString(dateFormat); var expected = JsonConvert.SerializeObject(date); Assert.DoesNotContain(expected, dates); }
public void GetDisabledDatesReturnCorrectly() { var disabledDate = new DisableDate { Id = 1, DisabledDates = DateTime.Today.AddDays(+1) }; this.db.DisableDates.Add(disabledDate); this.db.SaveChanges(); var dates = this.appointmentService.GetDisabledDates(); var date = DateTime.Today.AddDays(+1).ToString("dd.MM.yyyy"); var expected = JsonConvert.SerializeObject(date); Assert.Contains(expected, dates); }
public override int GetHashCode() { int hashCode = 17; // we *know* we are using this in a dictionary, so pre-compute this hashCode = hashCode * 23 + Id.GetHashCode(); hashCode = hashCode * 23 + (Fid == null ? 0 : Fid.GetHashCode()); hashCode = hashCode * 23 + (EnableDate == null ? 0 : EnableDate.GetHashCode()); hashCode = hashCode * 23 + (DisableDate == null ? 0 : DisableDate.GetHashCode()); hashCode = hashCode * 23 + Dr.GetHashCode(); hashCode = hashCode * 23 + Ts.GetHashCode(); hashCode = hashCode * 23 + (CreateBy == null ? 0 : CreateBy.GetHashCode()); hashCode = hashCode * 23 + (CreateDate == null ? 0 : CreateDate.GetHashCode()); hashCode = hashCode * 23 + (CreateName == null ? 0 : CreateName.GetHashCode()); hashCode = hashCode * 23 + (UpdateBy == null ? 0 : UpdateBy.GetHashCode()); hashCode = hashCode * 23 + (UpdateDate == null ? 0 : UpdateDate.GetHashCode()); hashCode = hashCode * 23 + (UpdateName == null ? 0 : UpdateName.GetHashCode()); hashCode = hashCode * 23 + (TableName == null ? 0 : TableName.GetHashCode()); hashCode = hashCode * 23 + (ColName == null ? 0 : ColName.GetHashCode()); hashCode = hashCode * 23 + (ColComment == null ? 0 : ColComment.GetHashCode()); hashCode = hashCode * 23 + (ColDefault == null ? 0 : ColDefault.GetHashCode()); hashCode = hashCode * 23 + (ColType == null ? 0 : ColType.GetHashCode()); hashCode = hashCode * 23 + ColProperty.GetHashCode(); hashCode = hashCode * 23 + ColLength.GetHashCode(); hashCode = hashCode * 23 + DisplayWidth.GetHashCode(); hashCode = hashCode * 23 + ColOrder.GetHashCode(); hashCode = hashCode * 23 + ColPrecision.GetHashCode(); hashCode = hashCode * 23 + NullAble.GetHashCode(); hashCode = hashCode * 23 + ShowAble.GetHashCode(); hashCode = hashCode * 23 + IsDefaultCol.GetHashCode(); hashCode = hashCode * 23 + (CtrlType == null ? 0 : CtrlType.GetHashCode()); hashCode = hashCode * 23 + (RefTable == null ? 0 : RefTable.GetHashCode()); hashCode = hashCode * 23 + (RefID == null ? 0 : RefID.GetHashCode()); hashCode = hashCode * 23 + (RefCode == null ? 0 : RefCode.GetHashCode()); hashCode = hashCode * 23 + (RefName == null ? 0 : RefName.GetHashCode()); hashCode = hashCode * 23 + (RefCondition == null ? 0 : RefCondition.GetHashCode()); hashCode = hashCode * 23 + (RefCols == null ? 0 : RefCols.GetHashCode()); hashCode = hashCode * 23 + (RefType == null ? 0 : RefType.GetHashCode()); hashCode = hashCode * 23 + (MainTable == null ? 0 : RefType.GetHashCode()); hashCode = hashCode * 23 + (MainTableCol == null ? 0 : MainTableCol.GetHashCode()); hashCode = hashCode * 23 + (CalculationExpr == null ? 0 : CalculationExpr.GetHashCode()); return(hashCode); }
public void AddDisableDate(AdminDisableDateInputModel model) { DateTime currentDate; try { currentDate = DateTime.Parse(model.DisabledDates); } catch (Exception e) { throw new InvalidCastException( string.Format(ExceptionMessages.InvalidCastDisableDate, model.DisabledDates, e)); } var disabledDate = new DisableDate { DisabledDates = currentDate }; this.db.DisableDates.Add(disabledDate); this.db.SaveChanges(); }