/// <summary> /// Verify extensions can be processed /// </summary> internal static void VerifyExtensions(Shareable resource, List <IResultDetail> dtls, String path = "") { if (resource == null) { return; } path = path == String.Empty ? resource.GetType().Name : path; foreach (var ext in resource.Extension) { bool supported = MARC.HI.EHRS.SVC.Messaging.FHIR.Util.ProfileUtil.GetProfiles().Exists(p => p.ExtensionDefinition.Exists(e => e.Code.Value == ext.Url.Substring(ext.Url.IndexOf("#") + 1) && ext.Url.ToString().StartsWith(GetExtensionNameUrl(String.Empty).ToString()))); if (!supported) { dtls.Add(new NotImplementedResultDetail(ResultDetailType.Error, String.Format(ApplicationContext.LocalizationService.GetString("FHIR006"), ext.Url, path), path)); } } foreach (var prop in Array.FindAll(resource.GetType().GetProperties(), p => p.GetCustomAttribute <XmlElementAttribute>() != null)) { var value = prop.GetValue(resource, null); string fPath = String.Format("{0}.{1}", path, prop.GetCustomAttribute <XmlElementAttribute>().ElementName); if (value is IList) { for (int i = 0; i < (value as IList).Count; i++) { VerifyExtensions((value as IList)[i] as Shareable, dtls, String.Format("{0}[{1}]", fPath, i)); } } else { VerifyExtensions(value as Shareable, dtls, fPath); } } }
public ActionResult DeleteConfirmed(int id) { Shareable shareable = db.Shareables.Find(id); db.Shareables.Remove(shareable); db.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> /// Returns true if AnimationCard instances are equal /// </summary> /// <param name="other">Instance of AnimationCard to be compared</param> /// <returns>Boolean</returns> public bool Equals(AnimationCard other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Title == other.Title || Title != null && Title.Equals(other.Title) ) && ( Subtitle == other.Subtitle || Subtitle != null && Subtitle.Equals(other.Subtitle) ) && ( Text == other.Text || Text != null && Text.Equals(other.Text) ) && ( Image == other.Image || Image != null && Image.Equals(other.Image) ) && ( Media == other.Media || Media != null && Media.SequenceEqual(other.Media) ) && ( Buttons == other.Buttons || Buttons != null && Buttons.SequenceEqual(other.Buttons) ) && ( Shareable == other.Shareable || Shareable != null && Shareable.Equals(other.Shareable) ) && ( Autoloop == other.Autoloop || Autoloop != null && Autoloop.Equals(other.Autoloop) ) && ( Autostart == other.Autostart || Autostart != null && Autostart.Equals(other.Autostart) )); }
public ActionResult Edit([Bind(Include = "ShareableID,ShareableName,CategoryID")] Shareable shareable) { if (ModelState.IsValid) { db.Entry(shareable).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryID = new SelectList(db.Categories, "CategoryID", "CategoryName", shareable.CategoryID); return(View(shareable)); }
public void Null_Checking() { // arrange User u = null; // assert Assert.That( () => { Shareable s = new Shareable(u); }, Throws.ArgumentNullException ); }
// GET: Shareables/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Shareable shareable = db.Shareables.Find(id); if (shareable == null) { return(HttpNotFound()); } return(View(shareable)); }
public void SetInUse_Works() { // arrange Shareable s = new Shareable(new User()); // assert Assert.False(s.IsInUse()); // act s.SetInUse(); // assert Assert.True(s.IsInUse()); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Aspect != null) { hashCode = hashCode * 59 + Aspect.GetHashCode(); } if (Title != null) { hashCode = hashCode * 59 + Title.GetHashCode(); } if (Subtitle != null) { hashCode = hashCode * 59 + Subtitle.GetHashCode(); } if (Text != null) { hashCode = hashCode * 59 + Text.GetHashCode(); } if (Image != null) { hashCode = hashCode * 59 + Image.GetHashCode(); } if (Media != null) { hashCode = hashCode * 59 + Media.GetHashCode(); } if (Buttons != null) { hashCode = hashCode * 59 + Buttons.GetHashCode(); } if (Shareable != null) { hashCode = hashCode * 59 + Shareable.GetHashCode(); } if (Autoloop != null) { hashCode = hashCode * 59 + Autoloop.GetHashCode(); } if (Autostart != null) { hashCode = hashCode * 59 + Autostart.GetHashCode(); } return(hashCode); } }
// GET: Shareables/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Shareable shareable = db.Shareables.Find(id); if (shareable == null) { return(HttpNotFound()); } ViewBag.CategoryID = new SelectList(db.Categories, "CategoryID", "CategoryName", shareable.CategoryID); return(View(shareable)); }
public void Transfer_Works() { /// arrange User a = new User(); User b = new User(); Shareable s = new Shareable(a); // assert Assert.That(a, Is.EqualTo(s.GetCustodian())); Assert.That(a.GetShareables, Contains.Item(s)); // act s.TransferTo(b); // assert Assert.That(b, Is.EqualTo(s.GetCustodian())); Assert.That(b.GetShareables, Contains.Item(s)); }