public void BookmarkTest() { Bookmark bookmark = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High); BookmarkListItem target = new BookmarkListItem(bookmark); Bookmark actual; actual = target.Bookmark; Assert.AreEqual(bookmark, actual); }
/// <summary> /// Adds a Bookmark item to the BookmarkList /// </summary> /// <param name="inputBookmark">Bookmark to be added</param> public BookmarkListItem AddBookmark(Bookmark inputBookmark) { BookmarkListItem inputItem = new BookmarkListItem(inputBookmark); BookmarkListBox.Items.Add(inputItem); inputItem.Selected += new RoutedEventHandler(BookmarkListItem_Selected); return inputItem; }
public void BookmarkListItemConstructorTest() { Bookmark bookmark = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High); BookmarkListItem target = new BookmarkListItem(bookmark); Assert.AreEqual(bookmark, target.Bookmark); Assert.AreEqual("123", target.Bookmark.ID); Assert.AreEqual("Test Description", target.Bookmark.Description); Assert.AreEqual(Bookmark.BookmarkPriority.High, target.Bookmark.Priority); }
public void IsOpenTest() { Bookmark bookmark = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High); BookmarkListItem target = new BookmarkListItem(bookmark); bool expected = false; // newly created bookmark list item should not be open bool actual = target.IsOpen; //false by default Assert.AreEqual(expected, actual); target.IsOpen = true;//test the setter actual = target.IsOpen; Assert.AreEqual(true, actual); }
public void AddBookmarkTest() { BackgroundMapLayer tpScatterView = BackgroundMapLayer.Instance; tpScatterView.setLayoutProperties(500, 500, Orientation.Vertical); Point pt = new Point(200, 200); double orientation = 180.00; BookmarkListFrame target = new BookmarkListFrame(pt, orientation); Bookmark bookmark = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High); BookmarkListItem expected = new BookmarkListItem(bookmark); BookmarkListItem actual; actual = target.AddBookmark(bookmark); Assert.AreEqual(expected, actual); }
/// <summary> /// Removes a Bookmark from the BookmarkList /// </summary> /// <param name="deleteItem">The BookmarkListItem to be deleted</param> public void RemoveBookmarkItem(BookmarkListItem deleteItem) { if (BookmarkListBox.Items.Contains(deleteItem)) BookmarkListBox.Items.Remove(deleteItem); }
public void BookmarkListItemsTest() { BackgroundMapLayer tpScatterView = BackgroundMapLayer.Instance; tpScatterView.setLayoutProperties(500, 500, Orientation.Vertical); Point pt = new Point(200, 200); double orientation = 180.00; BookmarkListFrame_Accessor target = new BookmarkListFrame_Accessor(pt, orientation); Bookmark bm1 = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High); Bookmark bm2 = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Bookmark 2", "321", Bookmark.BookmarkPriority.Low); BookmarkListItem item1 = new BookmarkListItem(bm1); BookmarkListItem item2 = new BookmarkListItem(bm2); target.BookmarkListItems.Clear(); target.BookmarkListBox.Items.Add(item1); target.BookmarkListBox.Items.Add(item2); ItemCollection actual; actual = target.BookmarkListItems; //we should have 2 items Assert.AreEqual(2, actual.Count); //we should the the correct items Assert.AreEqual(item1, actual.GetItemAt(0)); Assert.AreEqual(item2, actual.GetItemAt(1)); }
public void RemoveBookmarkItemTest() { BackgroundMapLayer tpScatterView = BackgroundMapLayer.Instance; tpScatterView.setLayoutProperties(500, 500, Orientation.Vertical); Point pt = new Point(200, 200); double orientation = 180.00; BookmarkListFrame_Accessor target = new BookmarkListFrame_Accessor(pt, orientation); Bookmark bm1 = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High); Bookmark bm2 = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Bookmark 2", "321", Bookmark.BookmarkPriority.Low); BookmarkListItem item1 = new BookmarkListItem(bm1); BookmarkListItem item2 = new BookmarkListItem(bm2); target.BookmarkListItems.Clear(); target.BookmarkListBox.Items.Add(item1); target.BookmarkListBox.Items.Add(item2); //We should have 2 items in our list box now Assert.AreEqual(2, target.BookmarkListBox.Items.Count); target.RemoveBookmarkItem(item2); //we should have 1 item now Assert.AreEqual(1, target.BookmarkListBox.Items.Count); //the deleted item shouldn't be in the list Assert.AreEqual(false, target.BookmarkListItems.Contains(item2)); //the non-deleted item should still be in the list Assert.AreEqual(true, target.BookmarkListItems.Contains(item1)); target.RemoveBookmarkItem(item2); //trying to remove something not in the list should not do anything Assert.AreEqual(1, target.BookmarkListItems.Count);//we should still have 1 item in our list }