public void PDFGradientDescriptorColorFunction3_Test()
        {
            PDFGradientDescriptor target = new PDFGradientLinearDescriptor();

            Assert.IsNotNull(target);
            Assert.IsTrue(target.GradientType == GradientType.Linear);
            Assert.IsFalse(target.Repeating);
            Assert.IsNotNull(target.Colors);
            Assert.AreEqual(0, target.Colors.Count);

            target.Colors = new List <PDFGradientColor>(new PDFGradientColor[]
            {
                new PDFGradientColor(PDFColors.Red),
                new PDFGradientColor(PDFColors.Green)
            });

            var fn = target.GetGradientFunction(PDFPoint.Empty, new PDFSize(100, 100));

            Assert.IsInstanceOfType(fn, typeof(PDFGradientFunction2));

            var fn2 = fn as PDFGradientFunction2;

            Assert.AreEqual(fn2.ColorZero, PDFColors.Red);
            Assert.AreEqual(fn2.ColorOne, PDFColors.Green);
            Assert.AreEqual(0.0, fn2.DomainStart);
            Assert.AreEqual(1.0, fn2.DomainEnd);
            Assert.AreEqual(1.0, fn2.Exponent);

            //Radial gradient at 0 and 50% test

            target = new PDFGradientRadialDescriptor();
            Assert.IsNotNull(target);
            Assert.IsTrue(target.GradientType == GradientType.Radial);
            Assert.IsFalse(target.Repeating);
            Assert.IsNotNull(target.Colors);
            Assert.AreEqual(0, target.Colors.Count);

            target.Colors = new List <PDFGradientColor>(new PDFGradientColor[]
            {
                new PDFGradientColor(PDFColors.Red),
                new PDFGradientColor(PDFColors.Green, 50, null)
            });

            fn = target.GetGradientFunction(PDFPoint.Empty, new PDFSize(100, 100));
            Assert.IsInstanceOfType(fn, typeof(PDFGradientFunction2));

            fn2 = fn as PDFGradientFunction2;
            Assert.AreEqual(fn2.ColorZero, PDFColors.Red);
            Assert.AreEqual(fn2.ColorOne, PDFColors.Green);
            Assert.AreEqual(0.0, fn2.DomainStart);
            Assert.AreEqual(2.0, fn2.DomainEnd);
            Assert.AreEqual(1.0, fn2.Exponent);

            //Radial gradient at 50% and 100% test

            target = new PDFGradientRadialDescriptor();
            Assert.IsNotNull(target);
            Assert.IsTrue(target.GradientType == GradientType.Radial);
            Assert.IsFalse(target.Repeating);
            Assert.IsNotNull(target.Colors);
            Assert.AreEqual(0, target.Colors.Count);

            target.Colors = new List <PDFGradientColor>(new PDFGradientColor[]
            {
                new PDFGradientColor(PDFColors.Red, 50, null),
                new PDFGradientColor(PDFColors.Green, 100, null)
            });

            fn = target.GetGradientFunction(PDFPoint.Empty, new PDFSize(100, 100));

            //This should not be a function 2 type as we add the Red colour at 0% too.
            Assert.IsNotInstanceOfType(fn, typeof(PDFGradientFunction2));
        }