public void ApplyWeightAdjustments_UpdatesWeight()
        {
            //// SETUP
            const double InitialWeight = 0.25d;
            const double FireInput = 1.234d;
            const double ErrorSignal1A = -2.3d;
            const double ErrorSignal1B = -9.87d;
            const double AccumulatedError1 = ErrorSignal1A + ErrorSignal1B;
            const double ErrorSignal2 = 3.2345d;
            const float Momentum = 0.9f;
            const float LearningRate = 0.1f;

            const double ExpectedWeight1 = (AccumulatedError1 * FireInput * LearningRate) + InitialWeight;
            const double ExpectedWeight2 = ExpectedWeight1 + (ErrorSignal2 * FireInput * LearningRate) + (Momentum * (AccumulatedError1 * FireInput * LearningRate));

            var mockTarget = new Mock<ISupervisedLearnerNode>();
            var mockSource = new Mock<ISupervisedLearnerNode>();

            // Create the test object.
            var connection = new BackpropagationConnection(InitialWeight, mockSource.Object, mockTarget.Object);
            connection.Fire(FireInput);

            // EXECUTION
            connection.ReportError(ErrorSignal1A);
            connection.ReportError(ErrorSignal1B);
            connection.ApplyWeightAdjustments(LearningRate, Momentum);
            var actual1 = connection.Weight;

            connection.ClearCachedErrors();
            connection.ReportError(ErrorSignal2);
            connection.ApplyWeightAdjustments(LearningRate, Momentum);
            var actual2 = connection.Weight;

            // VERIFICATION
            Assert.AreEqual(ExpectedWeight1, actual1, Epsilon);
            Assert.AreEqual(ExpectedWeight2, actual2, Epsilon);
        }
        public void ClearCachedErrors_PropogatesThroughNetwork()
        {
            //// SETUP
            const double InitialWeight = 0.25d;

            var mockTarget = new Mock<ISupervisedLearnerNode>();
            var mockSource = new Mock<ISupervisedLearnerNode>();

            // Create the test object.
            var connection = new BackpropagationConnection(InitialWeight, mockSource.Object, mockTarget.Object);

            // EXECUTION
            connection.ClearCachedErrors();

            // VERIFICATION
            mockTarget.Verify(mock => mock.ClearCachedErrors(), Times.Once());
        }