protected virtual void ReadDetail(XPathNavigator navigator, DetailCollection collection, ReadingJournal journal) { Dictionary <string, string> attributes = GetAttributes(navigator); Type type = Utility.TypeFromName(attributes["typeName"]); string meta = attributes.ContainsKey("meta") ? attributes["meta"] : null; if (type == typeof(ContentItem)) { int referencedItemID = int.Parse(navigator.Value); ContentItem referencedItem = journal.Find(referencedItemID); if (referencedItem != null) { collection.Add(ContentDetail.New( collection.EnclosingItem, attributes["name"], referencedItem, meta)); } else { journal.Register(referencedItemID, (item) => { collection.Add(ContentDetail.New( collection.EnclosingItem, attributes["name"], item, meta)); }, relationType: "collectionlink"); } } else if (type == typeof(Enum)) { if (!string.IsNullOrEmpty(meta)) { collection.Add(ContentDetail.New( collection.EnclosingItem, attributes["name"], Parse(navigator.Value, Type.GetType(meta)))); } } else if (type == typeof(IMultipleValue)) { var detail = detailReader.ReadMultipleValue(navigator, collection.EnclosingItem, journal, collection.Name); detail.Meta = meta; detail.AddTo(collection); } else { object value = Parse(navigator.Value, type); if (value is string) { value = detailReader.PrepareStringDetail(collection.EnclosingItem, collection.Name, value as string, attributes.ContainsKey("encoded") && Convert.ToBoolean(attributes["encoded"])); } collection.Add(ContentDetail.New(collection.EnclosingItem, attributes["name"], value, meta)); } }
public void CanFind_IndexOfInteger() { DetailCollection collection = new DetailCollection(); collection.Add(1); collection.Add(2); Assert.That(collection.IndexOf(1), Is.EqualTo(0)); Assert.That(collection.IndexOf(2), Is.EqualTo(1)); }
public void IndexOf_NotFoundItem_IsNegativeOne() { DetailCollection collection = new DetailCollection(); collection.Add("hello"); collection.Add("world"); Assert.That(collection.IndexOf("sweden"), Is.EqualTo(-1)); }
public void CanFind_IndexOfInteger() { DetailCollection collection = new DetailCollection(); collection.Add(1); collection.Add(2); Assert.That(collection.IndexOf(1), Is.EqualTo(0)); Assert.That(collection.IndexOf(2), Is.EqualTo(1)); }
public void CanFind_IndexOfString() { DetailCollection collection = new DetailCollection(); collection.Add("hello"); collection.Add("world"); Assert.That(collection.IndexOf("hello"), Is.EqualTo(0)); Assert.That(collection.IndexOf("world"), Is.EqualTo(1)); }
protected virtual void ReadDetail(XPathNavigator navigator, DetailCollection collection, ReadingJournal journal) { Dictionary<string, string> attributes = GetAttributes(navigator); Type type = Utility.TypeFromName(attributes["typeName"]); string meta = attributes.ContainsKey("meta") ? attributes["meta"] : null; if (type == typeof(ContentItem)) { int referencedItemID = int.Parse(navigator.Value); ContentItem referencedItem = journal.Find(referencedItemID); if (referencedItem != null) { collection.Add(ContentDetail.New( collection.EnclosingItem, attributes["name"], referencedItem, meta)); } else { journal.Register(referencedItemID, (item) => { collection.Add(ContentDetail.New( collection.EnclosingItem, attributes["name"], item, meta)); }, relationType: "collectionlink"); } } else if (type == typeof(Enum)) { if (meta != null) { collection.Add(ContentDetail.New( collection.EnclosingItem, attributes["name"], Parse(navigator.Value, Type.GetType(meta)))); } } else if (type == typeof(IMultipleValue)) { var detail = detailReader.ReadMultipleValue(navigator, collection.EnclosingItem, journal, collection.Name); detail.Meta = meta; detail.AddTo(collection); } else { object value = Parse(navigator.Value, type); if (value is string) value = detailReader.PrepareStringDetail(collection.EnclosingItem, collection.Name, value as string, attributes.ContainsKey("encoded") && Convert.ToBoolean(attributes["encoded"])); collection.Add(ContentDetail.New(collection.EnclosingItem, attributes["name"], value, meta)); } }
protected virtual void ReadDetail(XPathNavigator navigator, DetailCollection collection, ReadingJournal journal) { Dictionary<string, string> attributes = GetAttributes(navigator); Type type = Utility.TypeFromName(attributes["typeName"]); if (type == typeof(ContentItem)) { int referencedItemID = int.Parse(navigator.Value); ContentItem referencedItem = journal.Find(referencedItemID); if (referencedItem != null) { collection.Add(ContentDetail.New( collection.EnclosingItem, attributes["name"], referencedItem)); } else { journal.Register(referencedItemID, (item) => { collection.Add(ContentDetail.New( collection.EnclosingItem, attributes["name"], item)); }); } } else if (type == typeof(Enum)) { if (attributes.ContainsKey("meta")) { collection.Add(ContentDetail.New( collection.EnclosingItem, attributes["name"], Parse(navigator.Value, Type.GetType(attributes["meta"])))); } } else if (type == typeof(IMultipleValue)) { detailReader.ReadMultipleValue(navigator, collection.EnclosingItem, journal, collection.Name).AddTo(collection); } else { collection.Add(ContentDetail.New( collection.EnclosingItem, attributes["name"], Parse(navigator.Value, type))); } }
public void CanRead_WithCollectionOfLinks() { XmlableItem item = CreateOneItem <XmlableItem>(1, "item", null); CreateOneItem <XmlableItem>(2, "child1", item); CreateOneItem <XmlableItem>(3, "child2", item); CreateOneItem <XmlableItem>(4, "child3", item); CreateOneItem <XmlableItem>(5, "child4", item); CreateOneItem <XmlableItem>(6, "child5", item); foreach (ContentItem child in item.Children) { DetailCollection dc = child.GetDetailCollection("Siblings", true); foreach (ContentItem sibling in item.Children) { if (sibling != child) { dc.Add(sibling); } } } ContentItem readItem = Mangle(item); foreach (ContentItem child in readItem.Children) { Assert.IsNotNull(child.GetDetailCollection("Siblings", false)); Assert.AreEqual(4, child.GetDetailCollection("Siblings", false).Count); } }
public void CanRead_DetailCollection(IEnumerable values) { XmlableItem item = CreateOneItem <XmlableItem>(1, "item", null); DetailCollection dc = item.GetDetailCollection("Details", true); foreach (object detail in values) { dc.Add(detail); } ContentItem readItem = Mangle(item); DetailCollection readCollection = readItem.GetDetailCollection("Details", false); Assert.IsNotNull(readCollection); foreach (object detail in values) { if (detail is string) { EnumerableAssert.Contains(readCollection, HttpUtility.HtmlEncode((string)detail)); } else { EnumerableAssert.Contains(readCollection, detail); } } }
private void ApplyChanges(AppliedTags change, ContentItem item) { DetailCollection links = item.GetDetailCollection(Name, false); if (links == null) { if (change.Tags.Count == 0) { return; } links = item.GetDetailCollection(Name, true); } List <ITag> currentTags = GetCurrentTags(change.Group, links); IEnumerable <string> addedTags = GetAddedTags(currentTags, change.Tags); foreach (string tagName in addedTags) { ITag tag = change.Group.GetOrCreateTag(tagName); links.Add(tag); } foreach (ContentItem tag in currentTags) { if (!change.Tags.Contains(tag.Title)) { links.Remove(tag); } } }
public void DetailCollection_ContenItem() { var dc = new DetailCollection(); dc.Add(new AnItem { ID = 123 }); dc.Details[0].ValueTypeKey.ShouldBe(ContentDetail.TypeKeys.LinkType); ((ContentItem)dc[0]).ID.ShouldBe(123); }
public void Contains_IsTrue_ForContainedString() { DetailCollection collection = new DetailCollection(); collection.Add("hello"); Assert.That(collection.Contains("hello")); }
public void DetailCollection_String() { var dc = new DetailCollection(); dc.Add("hello"); dc.Details[0].ValueTypeKey.ShouldBe(ContentDetail.TypeKeys.StringType); dc[0].ShouldBe("hello"); }
public void DetailCollection_Int() { var dc = new DetailCollection(); dc.Add(123); dc.Details[0].ValueTypeKey.ShouldBe(ContentDetail.TypeKeys.IntType); dc[0].ShouldBe(123); }
public void CanClone_Collection() { DetailCollection collection = new DetailCollection(); collection.Add("hello"); DetailCollection cloned = collection.Clone(); Assert.That(cloned.Contains("hello")); }
public void CanClear_DetailCollection() { DetailCollection collection = new DetailCollection(); collection.Add("hello"); collection.Clear(); Assert.That(collection.Count, Is.EqualTo(0)); }
public void CanAdd_StringDetail() { DetailCollection collection = new DetailCollection(); collection.Add("hello"); Assert.That(collection[0], Is.EqualTo("hello")); Assert.That(collection.Details[0], Is.TypeOf(typeof(StringDetail))); Assert.That(collection.Details[0].Value, Is.EqualTo("hello")); }
public void CanAdd_IntDetail() { DetailCollection collection = new DetailCollection(); collection.Add(1); Assert.That(collection[0], Is.EqualTo(1)); Assert.That(collection.Details[0], Is.TypeOf(typeof(IntegerDetail))); Assert.That(collection.Details[0].Value, Is.EqualTo(1)); }
private IEnumerable <ContentItem> UpdateLinksInternal(ContentItem item, bool recursive) { logger.DebugFormat("Updating link: {0}", item); if (recursive) { foreach (var part in item.Children.FindParts()) { foreach (var updatedItem in UpdateLinksInternal(part, recursive)) { yield return(updatedItem); } } } var referencedItems = FindLinkedObjects(item).ToList(); DetailCollection links = item.GetDetailCollection(LinkDetailName, false); if (links == null && referencedItems.Count == 0) { logger.Debug("Exiting due to no links and none to update"); yield break; } if (links == null) { links = item.GetDetailCollection(LinkDetailName, true); } logger.DebugFormat("Updating {0} links to {1} existing", referencedItems.Count, links.Count); // replace existing items for (int i = 0; i < referencedItems.Count && i < links.Count; i++) { var extracted = referencedItems[i]; var stored = links.Details[i]; if (stored.StringValue == extracted.StringValue && stored.Meta == extracted.Meta && stored.IntValue == extracted.IntValue && stored.BoolValue == extracted.BoolValue) { // this prevents clearing item references to children when moving hierarchies continue; } stored.Extract(extracted); } // add any new items for (int i = links.Details.Count; i < referencedItems.Count; i++) { links.Add(referencedItems[i]); } // remove any extra items while (links.Count > referencedItems.Count) { links.RemoveAt(links.Count - 1); } yield return(item); }
public void CanAdd_IntDetail() { DetailCollection collection = new DetailCollection(); collection.Add(1); Assert.That(collection[0], Is.EqualTo(1)); Assert.That(collection.Details[0].ValueType, Is.EqualTo(typeof(int))); Assert.That(collection.Details[0].ValueTypeKey, Is.EqualTo(ContentDetail.TypeKeys.IntType)); Assert.That(collection.Details[0].Value, Is.EqualTo(1)); }
public void CanAdd_StringDetail() { DetailCollection collection = new DetailCollection(); collection.Add("hello"); Assert.That(collection[0], Is.EqualTo("hello")); Assert.That(collection.Details[0].ValueType, Is.EqualTo(typeof(string))); Assert.That(collection.Details[0].ValueTypeKey, Is.EqualTo(ContentDetail.TypeKeys.StringType)); Assert.That(collection.Details[0].Value, Is.EqualTo("hello")); }
public void ClonedCollection_IdentifierIsCleared() { DetailCollection collection = new DetailCollection(); collection.Add("hello"); DetailCollection cloned = collection.Clone(); Assert.That(cloned.ID, Is.EqualTo(0)); }
public void CanClear_DetailCollection() { DetailCollection collection = new DetailCollection(); collection.Add("hello"); collection.Clear(); Assert.That(collection.Count, Is.EqualTo(0)); }
public void CanClone_Collection() { DetailCollection collection = new DetailCollection(); collection.Add("hello"); DetailCollection cloned = collection.Clone(); Assert.That(cloned.Contains("hello")); }
protected virtual void ReadDetail(XPathNavigator navigator, DetailCollection collection, ReadingJournal journal) { Dictionary <string, string> attributes = GetAttributes(navigator); Type type = Utility.TypeFromName(attributes["typeName"]); if (type == typeof(ContentItem)) { int referencedItemID = int.Parse(navigator.Value); ContentItem referencedItem = journal.Find(referencedItemID); if (referencedItem != null) { collection.Add(ContentDetail.New( collection.EnclosingItem, attributes["name"], referencedItem)); } else { journal.ItemAdded += delegate(object sender, ItemEventArgs e) { if (e.AffectedItem.ID == referencedItemID) { collection.Add(ContentDetail.New( collection.EnclosingItem, attributes["name"], e.AffectedItem)); } }; } } else if (type == typeof(IMultipleValue)) { detailReader.ReadMultipleValue(navigator, collection.EnclosingItem, journal, collection.Name).AddTo(collection); } else { collection.Add(ContentDetail.New( collection.EnclosingItem, attributes["name"], Parse(navigator.Value, type))); } }
protected virtual void ReadDetail(XPathNavigator navigator, DetailCollection collection, ReadingJournal journal) { Dictionary<string, string> attributes = GetAttributes(navigator); Type type = Utility.TypeFromName(attributes["typeName"]); if (type == typeof(ContentItem)) { int referencedItemID = int.Parse(navigator.Value); ContentItem referencedItem = journal.Find(referencedItemID); if (referencedItem != null) { collection.Add(ContentDetail.New( collection.EnclosingItem, attributes["name"], referencedItem)); } else { journal.ItemAdded += delegate(object sender, ItemEventArgs e) { if (e.AffectedItem.ID == referencedItemID) { collection.Add(ContentDetail.New( collection.EnclosingItem, attributes["name"], e.AffectedItem)); } }; } } else if (type == typeof(IMultipleValue)) { detailReader.ReadMultipleValue(navigator, collection.EnclosingItem, journal, collection.Name).AddTo(collection); } else { collection.Add(ContentDetail.New( collection.EnclosingItem, attributes["name"], Parse(navigator.Value, type))); } }
public void CanAdd_IntDetail() { DetailCollection collection = new DetailCollection(); collection.Add(1); Assert.That(collection[0], Is.EqualTo(1)); Assert.That(collection.Details[0].ValueType, Is.EqualTo(typeof(int))); Assert.That(collection.Details[0].ValueTypeKey, Is.EqualTo(ContentDetail.TypeKeys.IntType)); Assert.That(collection.Details[0].Value, Is.EqualTo(1)); }
public void CanCopyToArray() { DetailCollection collection = new DetailCollection(); collection.Add("hello"); string[] array = new string[1]; collection.CopyTo(array, 0); Assert.That(array[0], Is.EqualTo("hello")); }
public void CanAdd_StringDetail() { DetailCollection collection = new DetailCollection(); collection.Add("hello"); Assert.That(collection[0], Is.EqualTo("hello")); Assert.That(collection.Details[0].ValueType, Is.EqualTo(typeof(string))); Assert.That(collection.Details[0].ValueTypeKey, Is.EqualTo(ContentDetail.TypeKeys.StringType)); Assert.That(collection.Details[0].Value, Is.EqualTo("hello")); }
public void UpdatedEnclosingItem_UpdatesDetails() { DetailCollection collection = new DetailCollection(); collection.Add("hello"); var item = new Content.AnItem(); collection.EnclosingItem = item; Assert.That(collection.EnclosingItem, Is.EqualTo(item)); Assert.That(collection.Details[0].EnclosingItem, Is.EqualTo(item)); }
protected virtual void OnAddingDetail(XPathNavigator navigator, DetailCollection collection) { Dictionary <string, string> attributes = GetAttributes(navigator); string name = attributes["name"]; Type type = Utility.TypeFromName(attributes["typeName"]); if (type != typeof(ContentItem)) { collection.Add(ParseValue(navigator.Value, type)); } else { logger.Debug("OnAddingDetail: Ignoring link detail"); //TODO resolve links } }
public void WriteItem_WithLinkCollection() { XmlableItem item = CreateOneItem <XmlableItem>(1, "one", null); XmlableItem two = CreateOneItem <XmlableItem>(2, "two", null); XmlableItem three = CreateOneItem <XmlableItem>(3, "three", null); XmlableItem four = CreateOneItem <XmlableItem>(4, "four", null); DetailCollection dc = item.GetDetailCollection("Related", true); dc.Add(two); dc.Add(three); dc.Add(four); XPathNavigator xpn = WriteToStreamAndNavigate(item); XPathNodeIterator nodes = xpn.Select("//item/detailCollections/collection[@name='Related']/detail"); Assert.AreEqual(3, nodes.Count); nodes.MoveNext(); Assert.AreEqual("2", nodes.Current.Value); nodes.MoveNext(); Assert.AreEqual("3", nodes.Current.Value); nodes.MoveNext(); Assert.AreEqual("4", nodes.Current.Value); }
public virtual void UpdateLinks(ContentItem item) { logger.DebugFormat("Updating link: {0}", item); var referencedItems = FindLinkedObjects(item).ToList(); DetailCollection links = item.GetDetailCollection(LinkDetailName, false); if (links == null && referencedItems.Count == 0) { logger.Debug("Exiting due to no links and none to update"); return; } if (links == null) { links = item.GetDetailCollection(LinkDetailName, true); } logger.DebugFormat("Updating {0} links to {1} existing", referencedItems.Count, links.Count); // replace existing items for (int i = 0; i < referencedItems.Count && i < links.Count; i++) { var extracted = referencedItems[i]; var stored = links.Details[i]; if (stored.StringValue == extracted.StringValue && stored.Meta == extracted.Meta && stored.IntValue == extracted.IntValue && stored.BoolValue == extracted.BoolValue) { // this prevents clearing item references to children when moving hierarchies continue; } stored.Extract(extracted); } // add any new items for (int i = links.Details.Count; i < referencedItems.Count; i++) { links.Add(referencedItems[i]); } // remove any extra items while (links.Count > referencedItems.Count) { links.RemoveAt(links.Count - 1); } }
public void WriteItem_WithDetailCollection(Array array, Type type) { XmlableItem item = CreateOneItem <XmlableItem>(1, "one", null); DetailCollection dc = item.GetDetailCollection("Collected", true); foreach (object o in array) { dc.Add(o); } XPathNavigator xpn = WriteToStreamAndNavigate(item); XPathNodeIterator nodes = xpn.Select("//item/detailCollections/collection[@name='Collected']/detail"); Assert.AreEqual(array.Length, nodes.Count); while (nodes.MoveNext()) { EnumerableAssert.Contains(array, Convert.ChangeType(nodes.Current.Value, type)); } }
public void CanRead_DetailCollection(Array details) { XmlableItem item = CreateOneItem <XmlableItem>(1, "item", null); DetailCollection dc = item.GetDetailCollection("Details", true); foreach (object detail in details) { dc.Add(detail); } ContentItem readItem = Mangle(item); DetailCollection readCollection = readItem.GetDetailCollection("Details", false); Assert.IsNotNull(readCollection); foreach (object detail in details) { EnumerableAssert.Contains(readCollection, detail); } }
public virtual void UpdateLinks(ContentItem item) { var referencedItems = FindLinkedObjects(item).ToList(); DetailCollection links = item.GetDetailCollection(LinkDetailName, false); if (links == null && referencedItems.Count == 0) { return; } if (links == null) { links = item.GetDetailCollection(LinkDetailName, true); } // replace existing items for (int i = 0; i < referencedItems.Count && i < links.Count; i++) { if (links.Details[i].StringValue == referencedItems[i].StringValue) { // this prevents clearing item references to children when moving hierarchies continue; } links.Details[i].Extract(referencedItems[i]); } // add any new items for (int i = links.Details.Count; i < referencedItems.Count; i++) { links.Add(referencedItems[i]); } // remove any extra items while (links.Count > referencedItems.Count) { links.RemoveAt(links.Count - 1); } }
public void IndexOf_NotFoundItem_IsNegativeOne() { DetailCollection collection = new DetailCollection(); collection.Add("hello"); collection.Add("world"); Assert.That(collection.IndexOf("sweden"), Is.EqualTo(-1)); }
public void Contains_IsTrue_ForContainedString() { DetailCollection collection = new DetailCollection(); collection.Add("hello"); Assert.That(collection.Contains("hello")); }
public void DetailCollection_String() { var dc = new DetailCollection(); dc.Add("hello"); dc.Details[0].ValueTypeKey.ShouldBe(ContentDetail.TypeKeys.StringType); dc[0].ShouldBe("hello"); }
public void DetailCollection_Int() { var dc = new DetailCollection(); dc.Add(123); dc.Details[0].ValueTypeKey.ShouldBe(ContentDetail.TypeKeys.IntType); dc[0].ShouldBe(123); }
public void DetailCollection_ContenItem() { var dc = new DetailCollection(); dc.Add(new AnItem { ID = 123 }); dc.Details[0].ValueTypeKey.ShouldBe(ContentDetail.TypeKeys.LinkType); ((ContentItem)dc[0]).ID.ShouldBe(123); }
public virtual void AddTo(DetailCollection newEnclosingCollection) { RemoveFromEnclosingCollection(); if (newEnclosingCollection != null) newEnclosingCollection.Add(this); }
public ResultModel Load(StyleEnum style) { ResultModel result = new ResultModel(); SqlDataReader dr = null; try { string sql = string.Format("select * from dbo.BDStyleDetail where BDStyleId = {0}", (int)style); dr = SqlHelper.ExecuteReader(this.ConnectString, CommandType.Text, sql, null); DetailCollection detailCollection = new DetailCollection(); while (dr.Read()) { Model.BDStyleDetail detail = new BDStyleDetail(); if (dr["StyleDetailId"] != DBNull.Value) { detail.StyleDetailId = Convert.ToInt32(dr["StyleDetailId"]); } if (dr["BDStyleId"] != DBNull.Value) { detail.BDStyleId = Convert.ToInt32(dr["BDStyleId"]); } if (dr["DetailCode"] != DBNull.Value) { detail.DetailCode = dr["DetailCode"].ToString(); } if (dr["DetailName"] != DBNull.Value) { detail.DetailName = dr["DetailName"].ToString(); } if (dr["DetailStatus"] != DBNull.Value) { detail.DetailStatus = (NFMT.Common.StatusEnum)Convert.ToInt32(dr["DetailStatus"]); } if (dr["CreatorId"] != DBNull.Value) { detail.CreatorId = Convert.ToInt32(dr["CreatorId"]); } if (dr["LastModifyId"] != DBNull.Value) { detail.LastModifyId = Convert.ToInt32(dr["LastModifyId"]); } if (dr["CreateTime"] != DBNull.Value) { detail.CreateTime = Convert.ToDateTime(dr["CreateTime"]); } if (dr["LastModifyTime"] != DBNull.Value) { detail.LastModifyTime = Convert.ToDateTime(dr["LastModifyTime"]); } detailCollection.Add(detail); } result.AffectCount = detailCollection.Count; result.Message = "获取列表成功"; result.ResultStatus = 0; result.ReturnValue = detailCollection; } catch (Exception ex) { result.Message = ex.Message; } finally { if (dr != null) dr.Dispose(); } return result; }
public void ClonedCollection_IdentifierIsCleared() { DetailCollection collection = new DetailCollection(); collection.Add("hello"); DetailCollection cloned = collection.Clone(); Assert.That(cloned.ID, Is.EqualTo(0)); }
/// <summary> /// Run the verification /// </summary> /// <param name="sender">Button object details</param> /// <param name="e">Event Arguments</param> /// <returns>Bind LOC count to view</returns> /// 2019/07/13, Vinoth N, Initial Version private async void Counter_Click(object sender, RoutedEventArgs e) { Clear(); DisableControls(); try { results = new GetFileDetail(); string location = t_Location.Text; string tag = t_POTag.Text; int i = 1; var count = 0; if (StartingFlag()) { if (Directory.Exists(location)) { Loadgif.Visibility = Visibility.Visible; b_Download.IsEnabled = true; counterStatus.Content = "Processing.."; counterStatus.Foreground = Brushes.Green; await Task.Run(() => results = ViewModel.StartCounter(location, tag)); if (results.JavaFunctionDetails != null) { foreach (var counter in results.JavaFunctionDetails) { Dispatcher.Invoke(() => { LineCollection.Add(new CounterModel { Total = results.JavaFunctionDetails.IndexOf(counter) + 1, FileName = counter.FileName, FunctionName = counter.FunctionName, Description = counter.Description, AllCount = counter.AllCount, AddCount = counter.AddCount, ModCount = counter.ModCount, NewCount = counter.NewCount, DelCount = counter.DelCount, Error = counter.Error, IsGUI = counter.IsGUI }); }); Dispatcher.Invoke(() => DetailCollection.Add("<<<" + counter.FunctionName + ">>>")); if (counter.FullFunctionLine != null) { foreach (var line in counter.FullFunctionLine) { Dispatcher.Invoke(() => DetailCollection.Add(line)); } } count += counter.AllCount; } } var counterValue = $"{count}"; tbk_counter.Text = counterValue; errorCount = LineCollection.Where(p => p.Error == true).Count(); FinishVerification(true); } else { b_Download.IsEnabled = false; MessageBox.Show("Location Not Found !"); } } } catch (Exception ex) { LogModel.Log(ex.Message); LogModel.Log(ex.StackTrace); } }
public void CanCopyToArray() { DetailCollection collection = new DetailCollection(); collection.Add("hello"); string[] array = new string[1]; collection.CopyTo(array, 0); Assert.That(array[0], Is.EqualTo("hello")); }
public void UpdatedEnclosingItem_UpdatesDetails() { DetailCollection collection = new DetailCollection(); collection.Add("hello"); var item = new Content.AnItem(); collection.EnclosingItem = item; Assert.That(collection.EnclosingItem, Is.EqualTo(item)); Assert.That(collection.Details[0].EnclosingItem, Is.EqualTo(item)); }
public void CanFind_IndexOfString() { DetailCollection collection = new DetailCollection(); collection.Add("hello"); collection.Add("world"); Assert.That(collection.IndexOf("hello"), Is.EqualTo(0)); Assert.That(collection.IndexOf("world"), Is.EqualTo(1)); }
protected virtual void OnAddingDetail(XPathNavigator navigator, DetailCollection collection) { Dictionary<string, string> attributes = GetAttributes(navigator); string name = attributes["name"]; Type type = Utility.TypeFromName(attributes["typeName"]); if (type != typeof (ContentItem)) collection.Add(ParseValue(navigator.Value, type)); else logger.Debug("OnAddingDetail: Ignoring link detail"); //TODO resolve links }