Ejemplo n.º 1
0
        public void Getting_an_islands_location_for_an_island_that_does_not_exist()
        {
            // Given
            var unused             = 0.0;
            var width              = 1000;
            var height             = 2000;
            var viewControlData    = new ViewControlData(unused, unused, unused, width, height);
            var releaseBranchName  = "ReleaseBranch";
            var unusedColour       = Color.FromRgb(255, 255, 255);
            var releaseArchipelago = new Branch(releaseBranchName, unusedColour);

            Islands islands = new Islands(viewControlData, releaseArchipelago);

            // When
            bool exceptionRaised = false;

            try
            {
                islands.GetLocation("branch-that-does-not-exist");
            }
            catch (IndexOutOfRangeException)
            {
                exceptionRaised = true;
            }

            // Then
            Assert.IsTrue(exceptionRaised);
        }
Ejemplo n.º 2
0
        public void Getting_an_islands_location()
        {
            // Given
            var unused             = 0.0;
            var width              = 1000;
            var height             = 2000;
            var viewControlData    = new ViewControlData(unused, unused, unused, width, height);
            var releaseBranchName  = "ReleaseBranch";
            var unusedColour       = Color.FromRgb(255, 255, 255);
            var releaseArchipelago = new Branch(releaseBranchName, unusedColour);

            Islands islands = new Islands(viewControlData, releaseArchipelago);
            var     branch  = new Branch("existingBranch", unusedColour);

            islands.Add(branch);

            // When
            var actualLocation = islands.GetLocation("existingBranch");

            // Then
            var expectedLocation = branch.Shape.CentrePoint;

            Assert.AreEqual(expectedLocation, actualLocation);
        }