コード例 #1
0
        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
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        public void OutOfBoundsTest()
        {
            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);
            Point inPt = new Point(200, 300);
            bool expected = false;
            bool actual;
            actual = target.OutOfBounds(inPt);
            Assert.AreEqual(expected, actual);
            Point outPt = new Point(1000, 200);

            actual = target.OutOfBounds(outPt);
            //this should be out of bounds
            Assert.AreEqual(true, actual);
        }