public void TryStrictMultiplySucceedTest()
        {
            for (int paramIndex = 0; paramIndex < _parameters.Length; ++paramIndex)
            {
                GroupElement[] bases = StaticHelperClass.GenerateRandomBases(8, paramIndex);

                GroupElement[] values = StaticHelperClass.GenerateRandomBases(10, paramIndex);
                ClosedDLRepOfGroupElement[] udlArray = new ClosedDLRepOfGroupElement[values.Length];
                GroupElement expectedProduct         = _parameters[paramIndex].Group.Identity;
                for (int udlIndex = 0; udlIndex < udlArray.Length; ++udlIndex)
                {
                    udlArray[udlIndex] = new ClosedDLRepOfGroupElement(bases, values[udlIndex], _parameters[paramIndex].Group);
                    expectedProduct   *= values[udlIndex];
                }

                ClosedDLRepOfGroupElement product;
                bool success = ClosedDLRepOfGroupElement.TryStrictMultiply(udlArray, out product);
                Assert.IsTrue(success, "TryStrictMultiply should have succeeded.");
                Assert.IsNotNull(product, "product should be set to not null");
                Assert.IsTrue(product.AreBasesEqual(udlArray[0]), "product should have same bases as other members of udlArray");
                Assert.AreEqual(expectedProduct, product.Value, "Product of values computed incorrectly");
            }
        }
        public void ClosedDLTryStrictMultiplyFailTest()
        {
            int paramIndex = 0;

            GroupElement[] bases = StaticHelperClass.GenerateRandomBases(8, paramIndex);

            GroupElement[] values = StaticHelperClass.GenerateRandomBases(10, paramIndex);
            ClosedDLRepOfGroupElement[] udlArray = new ClosedDLRepOfGroupElement[values.Length];
            GroupElement expectedProduct         = _parameters[paramIndex].Group.Identity;

            for (int udlIndex = 0; udlIndex < udlArray.Length; ++udlIndex)
            {
                udlArray[udlIndex] = new ClosedDLRepOfGroupElement(bases, values[udlIndex], _parameters[paramIndex].Group);
                expectedProduct   *= values[udlIndex];
            }

            // fail with different bases
            GroupElement[] wrongBases = StaticHelperClass.GenerateRandomBases(8, paramIndex);
            udlArray[udlArray.Length - 1] = new ClosedDLRepOfGroupElement(wrongBases, values[0], _parameters[paramIndex].Group);
            ClosedDLRepOfGroupElement product = udlArray[0];
            bool success = ClosedDLRepOfGroupElement.TryStrictMultiply(udlArray, out product);

            Assert.IsFalse(success, "TryStrictMultiply should have failed");
            Assert.IsNull(product, "product should be set to null");

            success = ClosedDLRepOfGroupElement.TryStrictMultiply(null, out product);
            Assert.IsFalse(success, "TryStrictMultiply should have failed");
            Assert.IsNull(product, "product should be set to null");

            wrongBases = StaticHelperClass.GenerateRandomBases(18, paramIndex);
            udlArray[udlArray.Length - 1] = new ClosedDLRepOfGroupElement(wrongBases, values[0], _parameters[paramIndex].Group);
            product = udlArray[0];
            success = ClosedDLRepOfGroupElement.TryStrictMultiply(udlArray, out product);
            Assert.IsFalse(success, "TryStrictMultiply should have failed");
            Assert.IsNull(product, "product should be set to null");
        }