public void AddItems() { var hiosSequence = new IHrItemObject[] { w1, w2, com }; var hiosToAdd = new IHrItemObject[] { w3, w2 }; hr1.SetItems(hiosSequence); bool changed = false; hr1.ItemsChanged += (s, e) => { changed = true; }; hr1.AddItems(hiosToAdd); Assert.IsTrue(changed); Assert.AreEqual(hiosSequence.Count() + hiosToAdd.Count(), hr1.HrItems.Count()); Assert.IsTrue(hiosSequence.Concat(hiosToAdd).SequenceEqual(hr1.GetOrderedEntities())); }
static Mocks() { hr = new HealthRecord(course, doc) { Category = cats[0], }; hr.FromDate.Month = 5; hr.AddItems(new IHrItemObject[] { word, word2, new Comment("без осложнений") }); }
public void Hr2HrItem() { Assert.IsFalse(spec[1].Vocabularies.Contains(voc[1])); var hr = new HealthRecord(a[1], d1); hr.AddItems(new[] { w[1], w[2] }); Assert.IsTrue(hr.GetOrderedEntities().Contains(w[2])); var hrItem = hr.HrItems.FirstOrDefault(x => x.Entity.Equals(w[2])); Assert.IsNotNull(hrItem); Assert.AreEqual(hr, hrItem.HealthRecord); hr.SetItems(new[] { w[1] }); Assert.IsFalse(hr.GetOrderedEntities().Contains(w[2])); hrItem = hr.HrItems.FirstOrDefault(x => x.Entity.Equals(w[2])); Assert.IsNull(hrItem); }