System.Drawing.PrimitivesTest.RectangleFTests.UnionTest C# (CSharp) Method

UnionTest() private method

private UnionTest ( float x, float y, float width, float height ) : void
x float
y float
width float
height float
return void
        public void UnionTest(float x, float y, float width, float height)
        {
            RectangleF a = new RectangleF(x, y, width, height);
            RectangleF b = new RectangleF(width, height, x, y);

            float x1 = Math.Min(a.X, b.X);
            float x2 = Math.Max(a.X + a.Width, b.X + b.Width);
            float y1 = Math.Min(a.Y, b.Y);
            float y2 = Math.Max(a.Y + a.Height, b.Y + b.Height);

            RectangleF expectedRectangle = new RectangleF(x1, y1, x2 - x1, y2 - y1);

            Assert.Equal(expectedRectangle, RectangleF.Union(a, b));
        }