public void TestExecuteOperation()
        {
            var signal1 = new Signal(new[] { 3, 2, 2, 1, 8d });
            var signal2 = new Signal(new[] { 5, 1, -3, 2d });
            var signal3 = new Signal(new[] { 1, 2, 3, 4, 5, 6d });
            var signal4 = new Signal(new double[] { });
            var signal5 = new Signal(null);

            Assert.IsTrue(TestUtils.SequenceEquals(new[] { 9, 5, 2, 7, 13, 6d }, WaveMath.ExecuteOperation(WaveMath.OperationEnum.Sum, signal1, signal2, signal3, signal4, signal5).Samples));
            Assert.IsTrue(TestUtils.SequenceEquals(new[] { -7, -1, 4, 1, -3, 6d }, WaveMath.ExecuteOperation(WaveMath.OperationEnum.Subtract, signal1, signal2, signal3, signal4, signal5).Samples));
            Assert.IsTrue(TestUtils.SequenceEquals(new[] { 15, 4, -18, 8, 40, 6d }, WaveMath.ExecuteOperation(WaveMath.OperationEnum.Multiply, signal1, signal2, signal3, signal4, signal5).Samples));
            Assert.IsTrue(TestUtils.SequenceEquals(new[] { 0.0666666, 1, -0.5, 2, 0.625, 6d }, WaveMath.ExecuteOperation(WaveMath.OperationEnum.Divide, signal1, signal2, signal3, signal4, signal5).Samples));
            Assert.IsTrue(TestUtils.SequenceEquals(new[] { 0.0666666, 1, -0.5, 2, 0.625, 6d }, WaveMath.ExecuteOperation(WaveMath.OperationEnum.Divide, signal1, signal2, signal3, signal4, signal5).Samples));
            Assert.IsNull(WaveMath.ExecuteOperation(WaveMath.OperationEnum.Sum, null, signal4, signal5));
        }
        /// <summary>
        /// Executes the block
        /// </summary>
        public override void Execute()
        {
            SetOperationDescription();

            var inputNode1 = InputNodes[0].ConnectingNode as BlockOutputNode;
            var inputNode2 = InputNodes[1].ConnectingNode as BlockOutputNode;

            if (inputNode1 == null || inputNode1.Object.Count == 0 || inputNode2 == null)
            {
                return;
            }
            if (inputNode2.Object.Count > inputNode1.Object.Count)
            {
                inputNode1 = InputNodes[1].ConnectingNode as BlockOutputNode;
                inputNode2 = InputNodes[0].ConnectingNode as BlockOutputNode;
            }

            OutputNodes[0].Object.Clear();
            for (var i = 0; i < inputNode1.Object.Count; i++)
            {
                var    signal1 = inputNode1.Object[i];
                Signal signal2;
                if (i < inputNode2.Object.Count)
                {
                    signal2 = inputNode2.Object[i];
                }
                else if (inputNode2.Object.Count > 0)
                {
                    signal2 = inputNode2.Object[0];
                }
                else
                {
                    OutputNodes[0].Object.Add(signal1.Clone());
                    continue;
                }
                OutputNodes[0].Object.Add(WaveMath.ExecuteOperation(Operation, signal1, signal2));
            }
            if (Cascade && OutputNodes[0].ConnectingNode != null)
            {
                OutputNodes[0].ConnectingNode.Root.Execute();
            }
        }