public void Combine_WithTwoBoxes3By3_ShouldCombineIntoSingle6By6()
        {
            // Arrange
            var box1 = new AxisAlignedBoundingBox(new Vector2D(1, 1), new Vector2D(4, 4));
            var box2 = new AxisAlignedBoundingBox(new Vector2D(4, 4), new Vector2D(7, 7));

            // Act
            var actual = AxisAlignedBoundingBoxExtentions.Combine(box1, box2);

            // Assert
            Assert.NotNull(actual);
            Assert.Equal(36, actual.Volume);
            Assert.Equal(1, actual.LeftBottom.X);
            Assert.Equal(1, actual.LeftBottom.Y);
            Assert.Equal(7, actual.RightTop.X);
            Assert.Equal(7, actual.RightTop.Y);
        }
예제 #2
0
 public TreeNode(TreeNode <TValue> left, TreeNode <TValue> right)
 {
     Left  = left ?? throw new ArgumentNullException(nameof(left));
     Right = right ?? throw new ArgumentNullException(nameof(right));
     Box   = AxisAlignedBoundingBoxExtentions.Combine(left.Box, right.Box);
 }
 public void Combine_WithNullParameters_ShouldThrowArgumentNullException()
 {
     // Act, Assert
     Assert.Throws <ArgumentNullException>(() => AxisAlignedBoundingBoxExtentions.Combine(null, null));
 }