public void GenerateConnectionsWith_WithExistingConnectionOutput_DoesNotAddNewOutgoingConnection()
        {
            // Act
            _hiddenNeuron.GenerateConnectionsWith(_outputNeuron);
            _hiddenNeuron.GenerateConnectionsWith(_outputNeuron);
            _hiddenNeuron.GenerateConnectionsWith(_outputNeuron);
            _hiddenNeuron.GenerateConnectionsWith(_outputNeuron);

            // Assert
            Assert.IsTrue(_hiddenNeuron.GetOutgoingConnections().Count() == 1);
        }
        /// <summary>
        /// Creates the incoming and outgoing connections between this neuron and a previous hidden neuron.
        /// </summary>
        /// <param name="incomingNeuron">The incoming neuron to connect this neuron to.</param>
        public void GenerateConnectionsWith(IHiddenNeuron incomingNeuron)
        {
            if (incomingNeuron == null)
            {
                throw new ArgumentNullException("incomingNeuron");
            }

            // Create connection only if this neuron doesn't already have an incoming connection from the incoming hidden neuron.
            if (!GetIncomingConnections().Any(c => c.FromNeuron == incomingNeuron))
            {
                Connections.Add(new IncomingConnection(incomingNeuron));
            }

            // Create connection only if the incoming hidden neuron doesn't already have an outgoing connection to this neuron.
            if (!incomingNeuron.GetOutgoingConnections().Any(c => c.ToNeuron == this))
            {
                incomingNeuron.Connections.Add(new OutgoingConnection(this));
            }
        }