Clone() 공개 메소드

Makes a copy of the current instance.
public Clone ( ) : MapRegion
리턴 MapRegion
예제 #1
0
        public void Include_with_included_coordinate_must_not_extend_the_region(MapRegion originalRegion, Position position)
        {
            var region = originalRegion.Clone();
            region.Include(position);

            region.Should().Be(originalRegion);
        }
예제 #2
0
        public void Clone_must_create_an_exact_copy()
        {
            var region = new MapRegion(10, 20, 30, 40);
            var copy = region.Clone();

            copy.Should().NotBeSameAs(region);
            copy.Should().Be(region);
        }
예제 #3
0
        public void Include_with_excluded_coordinate_must_extend_the_region(MapRegion originalRegion, Position position)
        {
            var region = originalRegion.Clone();
            region.Include(position);

            region.Should().NotBe(originalRegion);

            region.Contains(position).Should().BeTrue("the new region should containt the included position now");
            originalRegion.Contains(position).Should().BeFalse("the old region should not include the position");
        }