/// <summary> /// Tests all PeriodicAppointment fields match the expected values. /// </summary> internal static void AssertAreEqual(PeriodicAppointmentBuilder expected, PeriodicAppointment actual, string message) { var messagePrefix = String.Format("{0} Label:<{1}>.", message, expected.GetLabel()); Assert.AreEqual(expected.GetDetails(), actual.GetDetails(), String.Concat(messagePrefix, " details")); Assert.AreEqual(expected.GetDurationMinutes(), actual.GetDurationMinutes(), String.Concat(messagePrefix, " durationMinutes")); Assert.AreEqual(true, actual.IsRepeating(), String.Concat(messagePrefix, " IsRepeating")); Assert.AreEqual(expected.GetLabel(), actual.GetLabel(), String.Concat(messagePrefix, " label")); Assert.AreEqual(ToString(expected.GetOccurs()), ToString(actual.GetStartTime()), String.Concat(messagePrefix, " startTime")); Assert.AreNotSame(actual.GetStartTime(), actual.GetStartTime(), String.Concat(messagePrefix, " startTime deep copy")); var expectedClassId = new ClassId("PeriodicAppointment"); Assert.AreEqual(0, actual.GetClassId().CompareTo(expectedClassId), String.Concat(messagePrefix, " classId")); //Test Contact relations var relation = actual.GetContacts(); var contactBuilders = expected.GetContactBuilders(); Assert.AreEqual(contactBuilders.Length, relation.GetChildCount(), String.Concat(messagePrefix, " contacts.Count")); for (int i = 0; i < contactBuilders.Length; i++) { Helper.AssertAreEqual(contactBuilders[i], relation.GetChild(i), String.Concat(messagePrefix, " contacts[", i.ToString(), "].Data")); } }
internal override DiaryProduct Build() { var creator = (PeriodicAppointmentCreator)this.GetCreator(); PeriodicAppointment periodicAppointment; if (creator != null) { periodicAppointment = (PeriodicAppointment)creator.CreateNew(base.GetLabel(), base.GetOccurs(), base.GetDurationMinutes(), notToExceedDateTime, periodHours, base.GetDetails()); } else { periodicAppointment = new PeriodicAppointment(base.GetObjectId(), base.GetLabel(), base.GetOccurs(), base.GetDurationMinutes(), notToExceedDateTime, periodHours, base.GetDetails()); } return(periodicAppointment); }