/// <summary> /// Begins dragging any selected items managed by the adapter. May be called /// by another adapter when it begins dragging.</summary> /// <param name="initiator">Control adapter that is initiating the drag</param> void IItemDragAdapter.BeginDrag(ControlAdapter initiator) { // drag all selected nodes, and any edges impinging on them var draggingNodes = new ActiveCollection <Element>(); foreach (var node in m_selectionContext.GetSelection <Element>()) { draggingNodes.Add(node); } m_draggingNodes.AddRange(draggingNodes.GetSnapshot()); var draggingGrpPins = new ActiveCollection <GroupPin>(); // add the selected floating pins foreach (var grpin in m_selectionContext.GetSelection <GroupPin>()) { draggingGrpPins.Add(grpin); } m_draggingGroupPins.AddRange(draggingGrpPins.GetSnapshot()); if (m_draggingGroupPins.Any()) { m_originalPinY = new int[m_draggingGroupPins.Count]; for (int i = 0; i < m_originalPinY.Length; i++) { m_originalPinY[i] = m_draggingGroupPins[i].Bounds.Location.Y; } } }
public ControlHostService(Form mainForm) { m_controls = new ActiveCollection<ControlInfo>(); m_controls.ActiveItemChanged += controls_ActiveItemChanged; m_controls.ActiveItemChanging += controls_ActiveItemChanging; m_controls.ItemAdded += controls_ItemAdded; m_controls.ItemRemoved += controls_ItemRemoved; m_mainForm = mainForm; m_dockPanel = new DockPanel(); m_dockPanel.Dock = DockStyle.Fill; m_dockPanel.DockBackColor = mainForm.BackColor; m_dockPanel.ShowDocumentIcon = true; m_dockPanel.ActiveContentChanged += dockPanel_ActiveContentChanged; m_dockPanel.ContentAdded += DockPanelContentAdded; m_dockPanel.ContentRemoved += DockPanelContentRemoved; // default behavior - when double clicking a float window's title it will // maximize the floating window instead of docking the floating window DoubleClickFloatWindowTitleMaximizes = true; // try a default delay (in milliseconds!) MouseOverTabSwitchDelay = 250; m_uiLockImage = ResourceUtil.GetImage24(Resources.LockUIImage); m_uiUnlockImage = ResourceUtil.GetImage24(Resources.UnlockUIImage); }
public void TestClear() { ActiveCollection<object> test = new ActiveCollection<object>(); test.Add("a"); test.Add("b"); test.Clear(); CollectionAssert.IsEmpty(test); }
/** * Adds a clip to the active collections */ public void AddClipToActiveCollection(AudioMateClip clip, bool noEvent = false) { ActiveCollection?.Add(clip); if (!noEvent) { OnActiveCollectionUpdated.Invoke(); } }
public void TestClear() { ActiveCollection <object> test = new ActiveCollection <object>(); test.Add("a"); test.Add("b"); test.Clear(); CollectionAssert.IsEmpty(test); }
public void TestCount() { ActiveCollection<object> test = new ActiveCollection<object>(); Assert.True(test.Count == 0); test.Add("a"); Assert.True(test.Count == 1); test.Add("b"); Assert.True(test.Count == 2); }
public void TestIEnumerable() { ActiveCollection<object> test = new ActiveCollection<object>(); CollectionAssert.IsEmpty(test); test.Add("a"); Utilities.TestSequenceEqual(test, "a"); test.Add("b"); Utilities.TestSequenceEqual(test, "a", "b"); }
public void TestAdd() { ActiveCollection<object> test = new ActiveCollection<object>(); test.Add("a"); Utilities.TestSequenceEqual(test, "a"); test.Add("b"); Utilities.TestSequenceEqual(test, "a", "b"); Assert.Throws<ArgumentNullException>(delegate() { test.Add(null); }); }
public void TestContains() { ActiveCollection<object> test = new ActiveCollection<object>(); Assert.False(test.Contains("a")); test.Add("a"); Assert.True(test.Contains("a")); test.Add("b"); Assert.True(test.Contains("b")); }
public void TestIEnumerable() { ActiveCollection <object> test = new ActiveCollection <object>(); CollectionAssert.IsEmpty(test); test.Add("a"); Utilities.TestSequenceEqual(test, "a"); test.Add("b"); Utilities.TestSequenceEqual(test, "a", "b"); }
public void TestGetSnapshotGeneric() { ActiveCollection <object> test = new ActiveCollection <object>(); CollectionAssert.IsEmpty(test.GetSnapshot()); test.Add("a"); test.Add(this); Assert.AreEqual(test.GetSnapshot <object>(), new object[] { "a", this }); Assert.AreEqual(test.GetSnapshot <string>(), new string[] { "a" }); }
public void TestAsIEnumerable() { ActiveCollection <object> test = new ActiveCollection <object>(); CollectionAssert.IsEmpty(test.AsIEnumerable <object>()); test.Add("a"); test.Add(this); Utilities.TestSequenceEqual(test.AsIEnumerable <string>(), "a"); Utilities.TestSequenceEqual(test.AsIEnumerable <object>(), "a", this); }
public void TestCount() { ActiveCollection <object> test = new ActiveCollection <object>(); Assert.True(test.Count == 0); test.Add("a"); Assert.True(test.Count == 1); test.Add("b"); Assert.True(test.Count == 2); }
public void TestAdd() { ActiveCollection <object> test = new ActiveCollection <object>(); test.Add("a"); Utilities.TestSequenceEqual(test, "a"); test.Add("b"); Utilities.TestSequenceEqual(test, "a", "b"); Assert.Throws <ArgumentNullException>(delegate() { test.Add(null); }); }
public void TestContains() { ActiveCollection <object> test = new ActiveCollection <object>(); Assert.False(test.Contains("a")); test.Add("a"); Assert.True(test.Contains("a")); test.Add("b"); Assert.True(test.Contains("b")); }
public void PlayRandomClipAction(string collectionName = null) { if (collectionName == null) { ActiveCollection?.PlayRandomClip(); } else { PlayRandomClipInCollection(collectionName); } }
public void QueueRandomClipAction(string collectionName = null) { if (collectionName == null) { ActiveCollection?.QueueRandomClip(); } else { QueueRandomClipInCollection(collectionName); } }
public void TestGetSnapshot() { ActiveCollection <object> test = new ActiveCollection <object>(); CollectionAssert.IsEmpty(test.GetSnapshot()); test.Add("a"); object[] snapshot = test.GetSnapshot(); Assert.AreEqual(snapshot, new object[] { "a" }); test.Add("b"); snapshot = test.GetSnapshot(); Assert.AreEqual(snapshot, new object[] { "a", "b" }); }
/// <summary> /// End the measuring /// </summary> internal override void EndMeasuring() { base.EndMeasuring(); ActiveCollection.FinalizeElements(); CreateFeatureGeometry(); var newCollection = new DimElementCollection(); newCollection.OnCSUnitsPerPixelChanged(this.CSUnitsPerPixel); _elements.Add(newCollection); }
/// <summary> /// End the measuring /// </summary> internal override void EndMeasuring() { base.EndMeasuring(); ActiveCollection.FinalizeElements(); CreateFeatureGeometry(); var element = new FreeElement(); element.OnCSUnitsPerPixelChanged(this.CSUnitsPerPixel); _elements.Add(element); }
public void TestActiveItem() { ActiveCollection <object> test = new ActiveCollection <object>(); Assert.Null(test.ActiveItem); test.Add("a"); Assert.AreSame(test.ActiveItem, "a"); test.Add("b"); Assert.AreSame(test.ActiveItem, "b"); test.Remove("b"); Assert.AreSame(test.ActiveItem, "a"); }
public void TestUniqueness() { ActiveCollection <object> test = new ActiveCollection <object>(); test.Add("a"); test.Add("a"); Utilities.TestSequenceEqual(test, "a"); object b = new object(); test.Add("b"); Utilities.TestSequenceEqual(test, "a", "b"); }
/** * Removes a clip from a collection */ public bool RemoveClipFromActiveCollection(AudioMateClip clip, bool noEvent = false) { if (ActiveCollection == null || !ActiveCollection.Remove(clip)) { return(false); } if (!noEvent) { OnActiveCollectionUpdated.Invoke(); } return(true); }
public void TestRemove() { ActiveCollection<object> test = new ActiveCollection<object>(); test.Add("a"); test.Add("b"); Assert.False(test.Remove("c")); Assert.True(test.Remove("a")); Utilities.TestSequenceEqual(test, "b"); Assert.False(test.Remove("a")); Assert.True(test.Remove("b")); CollectionAssert.IsEmpty(test); }
public void TestGetActiveItem() { ActiveCollection <object> test = new ActiveCollection <object>(); Assert.Null(test.GetActiveItem <string>()); test.Add("a"); Assert.AreSame(test.GetActiveItem <string>(), "a"); test.Add("b"); Assert.AreSame(test.GetActiveItem <string>(), "b"); test.Add(this); // any non-string Assert.AreSame(test.GetActiveItem <string>(), "b"); Assert.AreSame(test.GetActiveItem <TestActiveCollection>(), this); }
public void TestCopyTo() { ActiveCollection <object> test = new ActiveCollection <object>(); test.Add("a"); test.Add("b"); object[] array1 = new object[2]; test.CopyTo(array1, 0); Assert.AreEqual(array1, new object[] { "a", "b" }); object[] array2 = new object[3]; test.CopyTo(array2, 1); Assert.AreEqual(array2, new object[] { null, "a", "b" }); }
public void TestRemove() { ActiveCollection <object> test = new ActiveCollection <object>(); test.Add("a"); test.Add("b"); Assert.False(test.Remove("c")); Assert.True(test.Remove("a")); Utilities.TestSequenceEqual(test, "b"); Assert.False(test.Remove("a")); Assert.True(test.Remove("b")); CollectionAssert.IsEmpty(test); }
public ControlHostService(Form mainForm) { m_controls = new ActiveCollection <ControlInfo>(); m_controls.ActiveItemChanged += new EventHandler(controls_ActiveItemChanged); m_controls.ActiveItemChanging += new EventHandler(controls_ActiveItemChanging); m_controls.ItemAdded += new EventHandler <ItemInsertedEventArgs <ControlInfo> >(controls_ItemAdded); m_controls.ItemRemoved += new EventHandler <ItemRemovedEventArgs <ControlInfo> >(controls_ItemRemoved); m_mainForm = mainForm; m_dockPanel = new DockPanel(); m_dockPanel.Dock = DockStyle.Fill; m_dockPanel.DockBackColor = SystemColors.AppWorkspace; m_dockPanel.ShowDocumentIcon = true; m_dockPanel.ActiveContentChanged += new EventHandler(dockPanel_ActiveContentChanged); }
public ControlHostService(Form mainForm) { m_controls = new ActiveCollection<ControlInfo>(); m_controls.ActiveItemChanged += new EventHandler(controls_ActiveItemChanged); m_controls.ActiveItemChanging += new EventHandler(controls_ActiveItemChanging); m_controls.ItemAdded += new EventHandler<ItemInsertedEventArgs<ControlInfo>>(controls_ItemAdded); m_controls.ItemRemoved += new EventHandler<ItemRemovedEventArgs<ControlInfo>>(controls_ItemRemoved); m_mainForm = mainForm; m_dockPanel = new DockPanel(); m_dockPanel.Dock = DockStyle.Fill; m_dockPanel.DockBackColor = SystemColors.AppWorkspace; m_dockPanel.ShowDocumentIcon = true; m_dockPanel.ActiveContentChanged += new EventHandler(dockPanel_ActiveContentChanged); }
public void TestChangeEvents() { ActiveCollection <object> test = new ActiveCollection <object>(); test.ActiveItemChanging += test_ActiveItemChanging; test.ActiveItemChanged += test_ActiveItemChanged; object a = new object(); test.Add(a); Assert.True(m_changingEvents == 1); Assert.True(m_changedEvents == 1); test.Add(a); Assert.True(m_changingEvents == 1); // no change! Assert.True(m_changedEvents == 1); // no change! object b = new object(); test.Add(b); Assert.True(m_changingEvents == 2); Assert.True(m_changedEvents == 2); test.Remove(a); Assert.True(m_changingEvents == 2); // no change! Assert.True(m_changedEvents == 2); // no change! test.Remove(b); Assert.True(m_changingEvents == 3); Assert.True(m_changedEvents == 3); test.ActiveItem = a; Assert.True(m_changingEvents == 4); Assert.True(m_changedEvents == 4); test.Clear(); Assert.True(m_changingEvents == 5); Assert.True(m_changedEvents == 5); test.Clear(); Assert.True(m_changingEvents == 5); // no change! Assert.True(m_changedEvents == 5); // no change! test.Add(b); Assert.True(m_changingEvents == 6); Assert.True(m_changedEvents == 6); test.Set(new[] { a, b }); //'b' becomes ActiveItem, so no change Assert.True(m_changingEvents == 6); // no change! Assert.True(m_changedEvents == 6); // no change! test.Set(new[] { b, a }); //'a' becomes ActiveItem, so we have a change Assert.True(m_changingEvents == 7); Assert.True(m_changedEvents == 7); test.Set(new object[] { }); Assert.True(m_changingEvents == 8); Assert.True(m_changedEvents == 8); }
/// <summary> /// Deletes the last coordinate /// </summary> internal override void DeleteLastCoordinate() { if (!ActiveCollection.IsFinalized && LastCoordinate != null) { var coordinates = Coordinates; if (coordinates.Count > 0) { Coordinate last = LastMouseCoordinate; coordinates.RemoveAt(coordinates.Count - 1); ActiveCollection.DeletedCoordinate(coordinates, last); CreateFeatureGeometry(); } } }
public void TestChangeEvents() { ActiveCollection <object> test = new ActiveCollection <object>(); test.ActiveItemChanging += test_ActiveItemChanging; test.ActiveItemChanged += test_ActiveItemChanged; object a = new object(); test.Add(a); Assert.True(m_changedEvents == 1); test.Add(a); Assert.True(m_changedEvents == 1); // no change! object b = new object(); test.Add(b); Assert.True(m_changedEvents == 2); }
/// <summary> /// Move the coordinate /// </summary> internal override void MoveAll(double divX, double divY) { if (ActiveCollection.CanAddCoordinate() && !ActiveCollection.IsFinalized) { if (ActiveCollection != null && Coordinates.Count > 0) { ActiveCollection.Transform = this.PixelToWorldTransform; for (int nr = 0; nr < Coordinates.Count; nr++) { var cd = Coordinates[nr]; Coordinates[nr] = new Coordinate(cd.X + divX, cd.Y + divY); } ActiveCollection.MovedAll(Coordinates, LastMouseCoordinate); CreateFeatureGeometry(); } } }
private void AddDragNode(TNode node, ActiveCollection <TNode> draggingNodes, HashSet <TNode> nodes) { draggingNodes.Add(node); if (!nodes.Contains(node)) { nodes.Add(node); m_graphAdapter.SetStyle(node, DiagramDrawingStyle.Ghosted); } IHierarchicalGraphNode <TNode, TEdge, TEdgeRoute> hierarchicalNode = node.As <IHierarchicalGraphNode <TNode, TEdge, TEdgeRoute> >(); if (hierarchicalNode != null) { foreach (TNode subNode in hierarchicalNode.SubNodes) { AddDragNode(subNode, draggingNodes, nodes); } } }
private void AddDragNode(TNode node, ActiveCollection <TNode> draggingNodes, HashSet <TNode> nodes) { draggingNodes.Add(node); if (!nodes.Contains(node)) { nodes.Add(node); } if (DraggingSubNodes) { var hierarchicalNode = node.As <IHierarchicalGraphNode <TNode, TEdge, TEdgeRoute> >(); if (hierarchicalNode != null) { foreach (TNode subNode in hierarchicalNode.SubNodes) { AddDragNode(subNode, draggingNodes, nodes); } } } }
/** * Adds a range of clips to the active collections */ public void AddClipRangeToActiveCollection(int fromIndex, int toIndex, bool noEvent = false) { if (ActiveCollection == null) { return; } for (var i = fromIndex; i <= toIndex; i++) { var clip = _ui.clipLibrary.Clips.ElementAtOrDefault(i); if (clip == null) { continue; } ActiveCollection.Add(clip); _controller.ui.clipLibrary.SetCursorIndex(i); } if (!noEvent) { OnActiveCollectionUpdated.Invoke(); } }
void IItemDragAdapter.BeginDrag(ControlAdapter initiator) { m_isDragging = true; // drag all selected nodes, and any edges impinging on them ActiveCollection <TNode> draggingNodes = new ActiveCollection <TNode>(); List <TEdge> draggingEdges = new List <TEdge>(); HashSet <TNode> nodes = new HashSet <TNode>(); foreach (TNode node in m_selectionContext.GetSelection <TNode>()) { AddDragNode(node, draggingNodes, nodes); } // render all edges connected to the dragging nodes foreach (TEdge edge in m_graph.Edges) { if (nodes.Contains(edge.FromNode) || nodes.Contains(edge.ToNode)) { draggingEdges.Add(edge); m_graphAdapter.SetStyle(edge, DiagramDrawingStyle.Ghosted); } } m_draggingNodes = draggingNodes.GetSnapshot <TNode>(); m_newPositions = new Point[m_draggingNodes.Length]; m_oldPositions = new Point[m_draggingNodes.Length]; for (int i = 0; i < m_draggingNodes.Length; i++) { // Initialize m_newPositions in case the mouse up event occurs before // a paint event, which can happen during rapid clicking. Point currentLocation = m_draggingNodes[i].Bounds.Location; m_newPositions[i] = currentLocation; m_oldPositions[i] = currentLocation; } m_draggingEdges = draggingEdges.ToArray(); }
void IItemDragAdapter.BeginDrag(ControlAdapter initiator) { // drag all selected nodes, and any edges impinging on them ActiveCollection <TNode> draggingNodes = new ActiveCollection <TNode>(); HashSet <TNode> nodes = new HashSet <TNode>(); foreach (TNode node in m_selectionContext.GetSelection <TNode>()) { AddDragNode(node, draggingNodes, nodes); } m_draggingNodes = draggingNodes.GetSnapshot <TNode>(); m_newPositions = new Point[m_draggingNodes.Length]; m_oldPositions = new Point[m_draggingNodes.Length]; for (int i = 0; i < m_draggingNodes.Length; i++) { // Initialize m_newPositions in case the mouse up event occurs before // a paint event, which can happen during rapid clicking. Point currentLocation = m_draggingNodes[i].Bounds.Location; m_newPositions[i] = currentLocation; m_oldPositions[i] = currentLocation; } }
/// <summary> /// Begins dragging any selected items managed by the adapter. May be called /// by another adapter when it begins dragging.</summary> /// <param name="initiator">Control adapter that is initiating the drag</param> void IItemDragAdapter.BeginDrag(ControlAdapter initiator) { // drag all selected nodes, and any edges impinging on them var draggingNodes = new ActiveCollection<Element>(); foreach (var node in m_selectionContext.GetSelection<Element>()) draggingNodes.Add(node); m_draggingNodes.AddRange(draggingNodes.GetSnapshot()); var draggingGrpPins= new ActiveCollection<GroupPin>(); // add the selected floating pins foreach (var grpin in m_selectionContext.GetSelection<GroupPin>()) draggingGrpPins.Add(grpin); m_draggingGroupPins.AddRange(draggingGrpPins.GetSnapshot()); if (m_draggingGroupPins.Any()) { m_originalPinY = new int[m_draggingGroupPins.Count]; for (int i = 0; i < m_originalPinY.Length; i++) m_originalPinY[i] = m_draggingGroupPins[i].Bounds.Location.Y; } }
public void TestGetActiveItem() { ActiveCollection<object> test = new ActiveCollection<object>(); Assert.Null(test.GetActiveItem<string>()); test.Add("a"); Assert.AreSame(test.GetActiveItem<string>(), "a"); test.Add("b"); Assert.AreSame(test.GetActiveItem<string>(), "b"); test.Add(this); // any non-string Assert.AreSame(test.GetActiveItem<string>(), "b"); Assert.AreSame(test.GetActiveItem<TestActiveCollection>(), this); }
public void TestReadonly() { ActiveCollection<object> test = new ActiveCollection<object>(); Assert.False(test.IsReadOnly); }
protected void GetPages() { Dictionary<string, object> parameters = new Dictionary<string, object>(); PageNumber pager = null; bool useScopeOnly = true; foreach(IFilter filter in this.GetFilters()) { if (filter is PageNumber) { pager = (PageNumber)filter; } else { if (!(filter is ScopeFilter)) { useScopeOnly = false; } this.ApplyFilter(filter, parameters); } } this.pages = (useScopeOnly) ? Content.Pages : Mubble.Models.Page.Find(parameters); if (pager != null) { for (int i = 0; i < this.pages.Count; i++) { if (this.pages[i].PageNumber == pager.CurrentPageNumber) { this.DataSource = new Mubble.Models.Page[] { currentPage = this.pages[this.currentPageIndex = i] }; this.Page.SetPageTitle(currentPage.Controller.Title + ": Page " + currentPage.PageNumber); break; } } } else { this.DataSource = this.pages; } base.DataBind(); }
protected void GetPosts() { Dictionary<string, object> parameters = new Dictionary<string, object>(); foreach (IFilter filter in this.GetFilters()) { if (filter is PageNumber) pager = (PageNumber)filter; this.ApplyFilter(filter, parameters); } this.ApplySecurityFilter(parameters); ActiveCollection<Post> posts = null; if (parameters.ContainsKey("Slug") && parameters.ContainsKey("ControllerID")) { Post p = DataBroker.GetPost((Guid)parameters["ControllerID"], (string)parameters["Slug"]); posts = new ActiveCollection<Post>(); if ( p == null || (parameters.ContainsKey("Status") && !p.Status.Equals(parameters["Status"])) || (parameters.ContainsKey("EndPublishDate") && p.PublishDate.CompareTo(parameters["EndPublishDate"]) > 0) ) { posts.TotalResults = 0; } else if(p != null) { posts.TotalResults = 1; posts.Add(p); this.Page.SetCacheDependency(this.Content); } } else { posts = DataBroker.GetPosts(parameters); } this.posts = posts; this.DataSource = this.posts; base.DataBind(); }
public void TestChangeEvents() { ActiveCollection<object> test = new ActiveCollection<object>(); test.ActiveItemChanging += new EventHandler(test_ActiveItemChanging); test.ActiveItemChanged += new EventHandler(test_ActiveItemChanged); object a = new object(); test.Add(a); Assert.True(m_changedEvents == 1); test.Add(a); Assert.True(m_changedEvents == 1); // no change! object b = new object(); test.Add(b); Assert.True(m_changedEvents == 2); }
public void TestUniqueness() { ActiveCollection<object> test = new ActiveCollection<object>(); test.Add("a"); test.Add("a"); Utilities.TestSequenceEqual(test, "a"); object b = new object(); test.Add("b"); Utilities.TestSequenceEqual(test, "a", "b"); }
public void TestChangeEvents() { ActiveCollection<object> test = new ActiveCollection<object>(); test.ActiveItemChanging += test_ActiveItemChanging; test.ActiveItemChanged += test_ActiveItemChanged; object a = new object(); test.Add(a); Assert.True(m_changingEvents == 1); Assert.True(m_changedEvents == 1); test.Add(a); Assert.True(m_changingEvents == 1); // no change! Assert.True(m_changedEvents == 1); // no change! object b = new object(); test.Add(b); Assert.True(m_changingEvents == 2); Assert.True(m_changedEvents == 2); test.Remove(a); Assert.True(m_changingEvents == 2); // no change! Assert.True(m_changedEvents == 2); // no change! test.Remove(b); Assert.True(m_changingEvents == 3); Assert.True(m_changedEvents == 3); test.ActiveItem = a; Assert.True(m_changingEvents == 4); Assert.True(m_changedEvents == 4); test.Clear(); Assert.True(m_changingEvents == 5); Assert.True(m_changedEvents == 5); test.Clear(); Assert.True(m_changingEvents == 5); // no change! Assert.True(m_changedEvents == 5); // no change! test.Add(b); Assert.True(m_changingEvents == 6); Assert.True(m_changedEvents == 6); test.Set(new[] { a, b }); //'b' becomes ActiveItem, so no change Assert.True(m_changingEvents == 6); // no change! Assert.True(m_changedEvents == 6); // no change! test.Set(new[] { b, a }); //'a' becomes ActiveItem, so we have a change Assert.True(m_changingEvents == 7); Assert.True(m_changedEvents == 7); test.Set(new object[] { }); Assert.True(m_changingEvents == 8); Assert.True(m_changedEvents == 8); }
public void TestActiveItem() { ActiveCollection<object> test = new ActiveCollection<object>(); Assert.Null(test.ActiveItem); test.Add("a"); Assert.AreSame(test.ActiveItem, "a"); test.Add("b"); Assert.AreSame(test.ActiveItem, "b"); test.Remove("b"); Assert.AreSame(test.ActiveItem, "a"); }
public void TestCopyTo() { ActiveCollection<object> test = new ActiveCollection<object>(); test.Add("a"); test.Add("b"); object[] array1 = new object[2]; test.CopyTo(array1, 0); Assert.AreEqual(array1, new object[] { "a", "b" }); object[] array2 = new object[3]; test.CopyTo(array2, 1); Assert.AreEqual(array2, new object[] { null, "a", "b" }); }
public void TestGetSnapshot() { ActiveCollection<object> test = new ActiveCollection<object>(); CollectionAssert.IsEmpty(test.GetSnapshot()); test.Add("a"); object[] snapshot = test.GetSnapshot(); Assert.AreEqual(snapshot, new object[] { "a" }); test.Add("b"); snapshot = test.GetSnapshot(); Assert.AreEqual(snapshot, new object[] { "a", "b" }); }
public void TestGetSnapshotGeneric() { ActiveCollection<object> test = new ActiveCollection<object>(); CollectionAssert.IsEmpty(test.GetSnapshot()); test.Add("a"); test.Add(this); Assert.AreEqual(test.GetSnapshot<object>(), new object[] { "a", this }); Assert.AreEqual(test.GetSnapshot<string>(), new string[] { "a" }); }
public void TestAsIEnumerable() { ActiveCollection<object> test = new ActiveCollection<object>(); CollectionAssert.IsEmpty(test.AsIEnumerable<object>()); test.Add("a"); test.Add(this); Utilities.TestSequenceEqual(test.AsIEnumerable<string>(), "a"); Utilities.TestSequenceEqual(test.AsIEnumerable<object>(), "a", this); }