Beispiel #1
0
        public void AddConnectionRegistersConnection()
        {
            // Arrange
            var neuron     = new Neuron();
            var connection = new NeuronConnection(neuron, 1m);

            // Act
            neuron.AddIncomingConnection(connection);

            // Assert
            neuron.Inputs.Single().ShouldBe(connection);
        }
Beispiel #2
0
        public void EvaluateNeuronShouldResultInCorrectTotal(decimal input, decimal weight, decimal expected)
        {
            // Arrange
            var source     = new Neuron();
            var target     = new Neuron();
            var connection = new NeuronConnection(source, weight);

            target.AddIncomingConnection(connection);
            source.Value = input;

            // Act
            decimal sum = target.Evaluate();

            // Assert
            sum.ShouldBe(expected);
        }