public void Indexer_Get_ReturnsCoordinatesFromSourceList()
        {
            WayCoordinateList target = new WayCoordinateList(_nodes);

            for (int i = 0; i < _nodes.Count; i++) {
                Assert.Equal(_nodes[i].Position, target[i]);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the Way class with specified ID, Nodes and collection of tags.
        /// </summary>
        /// <param name="id">The ID of the Way.</param>
        /// <param name="nodes">The colection of Nodes to add to this Way.</param>
        /// <param name="tags">The collection of tags associated with the way.</param>
        public Way(long id, IEnumerable <Node> nodes, TagsCollection tags)
            : base()
        {
            this.ID    = id;
            this.Tags  = tags;
            this.Nodes = new List <Node>(nodes);

            _coordinatesAdapter = new WayCoordinateList(this.Nodes);
        }
        public void RemoveAt_Index_ThowsNotSupportedException()
        {
            WayCoordinateList target = new WayCoordinateList(_nodes);

            Assert.Throws<NotSupportedException>(() => target.RemoveAt(0));
        }
        public void Insert_Index_Coordinate_ThowsNotSupportedException()
        {
            WayCoordinateList target = new WayCoordinateList(_nodes);

            Assert.Throws<NotSupportedException>(() => target.Insert(0, Coordinate.Empty));
        }
        public void Indexer_Set_ThrowsNotSupportedException()
        {
            WayCoordinateList target = new WayCoordinateList(_nodes);

            Assert.Throws<NotSupportedException>(() => target[0] = new Coordinate(10.1, 11.2));
        }
        public void Count_GetsNumberOfItemsInSourceCollection()
        {
            WayCoordinateList target = new WayCoordinateList(_nodes);

            Assert.Equal(_nodes.Count, target.Count);
        }
        public void Constructor_Source_SetsSource()
        {
            WayCoordinateList target = new WayCoordinateList(_nodes);

            Assert.Same(_nodes, target.Source);
        }
        public void Clear_ThowsNotSupportedException()
        {
            WayCoordinateList target = new WayCoordinateList(_nodes);

            Assert.Throws<NotSupportedException>(() => target.Clear());
        }
        public void Add_Coordinate_ThowsNotSupportedException()
        {
            WayCoordinateList target = new WayCoordinateList(_nodes);

            Assert.Throws<NotSupportedException>(() => target.Add(Coordinate.Empty));
        }