Exemplo n.º 1
0
        public void NeuronShouldRespectInitialValue()
        {
            // Arrange / Act
            var neuron = new Neuron(42);

            // Assert
            neuron.Value.ShouldBe(42);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }