public void Should_Throw_MapIsNotInitializedException_When_Called_Before_InitMap_Call()
        {
            var areaOnDest   = Area2D.Create(0, 0, 5, 5);
            var areaOnSource = Area2D.Create(0, 0, 5, 5);

            Should.Throw <MapIsNotInitializedException>(() => _mapBuilder.AddAssociatedAreas(areaOnDest, areaOnSource));
        }
Exemplo n.º 2
0
        public void Should_Discard_All_The_Settings_That_Were_Made_Before_Init()
        {
            _mapBuilder.InitNewMap(_initialMapping);
            _mapBuilder.SetIgnoredSourcedArea(Area2D.Create(0, 0, 5, 5));
            _mapBuilder.ReduceDestArea(Area2D.Create(0, 0, 5, 5));
            _mapBuilder.AddAssociatedAreas(Area2D.Create(0, 0, 2, 2), Area2D.Create(3, 0, 2, 2));
            _mapBuilder.AddAssociatedAreas(Area2D.Create(1, 1, 2, 2), Area2D.Create(1, 3, 2, 2));

            _mapBuilder.InitNewMap(_destArea, _sourceArea);
            var mapping = _mapBuilder.Build();

            foreach (var destPoint in mapping.DestPoints)
            {
                _destArea.GetPointIndex(destPoint).ShouldBeGreaterThan(-1);
                mapping.GetPointSourceArea(destPoint).IsSameAs(_sourceArea).ShouldBeTrue();
            }

            foreach (var point in _destArea.Points)
            {
                mapping.DestPoints.Contains(point).ShouldBeTrue();
                mapping.GetPointSourceArea(point).IsSameAs(_sourceArea).ShouldBeTrue();
            }
        }