public void GetTotalsForNeurologyForm()
        {
            // Arrange
            var neurologyForm = new NeurologyForm()
            {
                AnalContraction = BinaryObservation.No,
                AnalSensation = BinaryObservation.Yes
            };

            neurologyForm.UpdateLevelAt("C2", "2", "2", "2", "2", "0", "0");
            neurologyForm.UpdateLevelAt("C3", "2", "2", "2", "2", "0", "0");
            neurologyForm.UpdateLevelAt("C4", "2", "2", "2", "2", "0", "0");
            neurologyForm.UpdateLevelAt("C5", "2", "2", "2", "2", "5", "5");
            neurologyForm.UpdateLevelAt("C6", "1", "1", "1", "0", "1", "1");
            neurologyForm.UpdateLevelAt("C7", "1", "0", "1", "0", "0", "0");
            neurologyForm.UpdateLevelAt("C8", "1", "0", "1", "0", "0", "0");
            neurologyForm.UpdateLevelAt("T1", "1", "0", "1", "0", "0", "0");
            neurologyForm.UpdateLevelAt("T2", "NT", "NT", "NT", "NT", "0", "0");
            neurologyForm.UpdateLevelAt("T3", "NT", "NT", "NT", "NT", "0", "0");
            neurologyForm.UpdateLevelAt("T4", "NT", "NT", "NT", "NT", "0", "0");
            neurologyForm.UpdateLevelAt("T5", "NT", "NT", "NT", "NT", "0", "0");
            neurologyForm.UpdateLevelAt("T6", "NT", "NT", "NT", "NT", "0", "0");
            neurologyForm.UpdateLevelAt("T7", "NT", "NT", "NT", "NT", "0", "0");
            neurologyForm.UpdateLevelAt("T8", "NT", "NT", "NT", "NT", "0", "0");
            neurologyForm.UpdateLevelAt("T9", "NT", "NT", "NT", "NT", "0", "0");
            neurologyForm.UpdateLevelAt("T10", "NT", "NT", "NT", "NT", "0", "0");
            neurologyForm.UpdateLevelAt("T11", "NT", "NT", "NT", "NT", "0", "0");
            neurologyForm.UpdateLevelAt("T12", "NT", "NT", "NT", "NT", "0", "0");
            neurologyForm.UpdateLevelAt("L1", "NT", "NT", "NT", "NT", "0", "0");
            neurologyForm.UpdateLevelAt("L2", "NT", "NT", "NT", "NT", "NT", "NT");
            neurologyForm.UpdateLevelAt("L3", "NT", "NT", "NT", "NT", "NT", "NT");
            neurologyForm.UpdateLevelAt("L4", "NT", "NT", "NT", "NT", "NT", "NT");
            neurologyForm.UpdateLevelAt("L5", "NT", "NT", "NT", "NT", "NT", "NT");
            neurologyForm.UpdateLevelAt("S1", "NT", "NT", "NT", "NT", "NT", "NT");
            neurologyForm.UpdateLevelAt("S2", "NT", "NT", "NT", "NT", "0", "0");
            neurologyForm.UpdateLevelAt("S3", "NT", "NT", "NT", "NT", "0", "0");
            neurologyForm.UpdateLevelAt("S4_5", "NT", "NT", "NT", "NT", "0", "0");

            // Act
            var summary = Algorithm.GetTotalsSummaryFor(neurologyForm);

            // Assert
            Assert.AreEqual("B,C,D", summary.AsiaImpairmentScale);
            Assert.AreEqual("I", summary.Completeness);
            Assert.AreEqual("UTD", summary.LeftLowerMotorTotal);
            Assert.AreEqual("C5", summary.LeftMotor);
            Assert.AreEqual("UTD", summary.LeftMotorTotal);
            Assert.AreEqual("NA", summary.LeftMotorZpp);
            Assert.AreEqual("UTD", summary.LeftPrickTotal);
            Assert.AreEqual("C5", summary.LeftSensory);
            Assert.AreEqual("NA", summary.LeftSensoryZpp);
            Assert.AreEqual("UTD", summary.LeftTouchTotal);
            Assert.AreEqual("6", summary.LeftUpperMotorTotal);
            Assert.AreEqual("UTD", summary.LowerMotorTotal);
            Assert.AreEqual("C5", summary.NeurologicalLevelOfInjury);
            Assert.AreEqual("UTD", summary.PrickTotal);
            Assert.AreEqual("UTD", summary.RightLowerMotorTotal);
            Assert.AreEqual("C5", summary.RightMotor);
            Assert.AreEqual("UTD", summary.RightMotorTotal);
            Assert.AreEqual("NA", summary.RightMotorZpp);
            Assert.AreEqual("UTD", summary.RightPrickTotal);
            Assert.AreEqual("C5", summary.RightSensory);
            Assert.AreEqual("NA", summary.RightSensoryZpp);
            Assert.AreEqual("UTD", summary.RightTouchTotal);
            Assert.AreEqual("6", summary.RightUpperMotorTotal);
            Assert.AreEqual("UTD", summary.TouchTotal);
            Assert.AreEqual("12", summary.UpperMotorTotal);
        }
        public void BindTo(NeurologyForm neurologyForm)
        {
            neurologyForm.AnalContraction = AnalContraction;
            neurologyForm.AnalSensation = AnalSensation;

            if (!string.IsNullOrEmpty(RightLowestNonKeyMuscleWithMotorFunction))
                neurologyForm.SetRightLowestNonKeyMuscleWithMotorFunction(RightLowestNonKeyMuscleWithMotorFunction);

            if (!string.IsNullOrEmpty(LeftLowestNonKeyMuscleWithMotorFunction))
                neurologyForm.SetLeftLowestNonKeyMuscleWithMotorFunction(LeftLowestNonKeyMuscleWithMotorFunction);

            neurologyForm.UpdateLevelAt("C2", C2RightTouch, C2LeftTouch, C2RightPrick, C2LeftPrick, "0", "0");
            neurologyForm.UpdateLevelAt("C3", C3RightTouch, C3LeftTouch, C3RightPrick, C3LeftPrick, "0", "0");
            neurologyForm.UpdateLevelAt("C4", C4RightTouch, C4LeftTouch, C4RightPrick, C4LeftPrick, "0", "0");
            neurologyForm.UpdateLevelAt("C5", C5RightTouch, C5LeftTouch, C5RightPrick, C5LeftPrick, C5RightMotor, C5LeftMotor);
            neurologyForm.UpdateLevelAt("C6", C6RightTouch, C6LeftTouch, C6RightPrick, C6LeftPrick, C6RightMotor, C6LeftMotor);
            neurologyForm.UpdateLevelAt("C7", C7RightTouch, C7LeftTouch, C7RightPrick, C7LeftPrick, C7RightMotor, C7LeftMotor);
            neurologyForm.UpdateLevelAt("C8", C8RightTouch, C8LeftTouch, C8RightPrick, C8LeftPrick, C8RightMotor, C8LeftMotor);
            neurologyForm.UpdateLevelAt("T1", T1RightTouch, T1LeftTouch, T1RightPrick, T1LeftPrick, T1RightMotor, T1LeftMotor);
            neurologyForm.UpdateLevelAt("T2", T2RightTouch, T2LeftTouch, T2RightPrick, T2LeftPrick, "0", "0");
            neurologyForm.UpdateLevelAt("T3", T3RightTouch, T3LeftTouch, T3RightPrick, T3LeftPrick, "0", "0");
            neurologyForm.UpdateLevelAt("T4", T4RightTouch, T4LeftTouch, T4RightPrick, T4LeftPrick, "0", "0");
            neurologyForm.UpdateLevelAt("T5", T5RightTouch, T5LeftTouch, T5RightPrick, T5LeftPrick, "0", "0");
            neurologyForm.UpdateLevelAt("T6", T6RightTouch, T6LeftTouch, T6RightPrick, T6LeftPrick, "0", "0");
            neurologyForm.UpdateLevelAt("T7", T7RightTouch, T7LeftTouch, T7RightPrick, T7LeftPrick, "0", "0");
            neurologyForm.UpdateLevelAt("T8", T8RightTouch, T8LeftTouch, T8RightPrick, T8LeftPrick, "0", "0");
            neurologyForm.UpdateLevelAt("T9", T9RightTouch, T9LeftTouch, T9RightPrick, T9LeftPrick, "0", "0");
            neurologyForm.UpdateLevelAt("T10", T10RightTouch, T10LeftTouch, T10RightPrick, T10LeftPrick, "0", "0");
            neurologyForm.UpdateLevelAt("T11", T11RightTouch, T11LeftTouch, T11RightPrick, T11LeftPrick, "0", "0");
            neurologyForm.UpdateLevelAt("T12", T12RightTouch, T12LeftTouch, T12RightPrick, T12LeftPrick, "0", "0");
            neurologyForm.UpdateLevelAt("L1", L1RightTouch, L1LeftTouch, L1RightPrick, L1LeftPrick, "0", "0");
            neurologyForm.UpdateLevelAt("L2", L2RightTouch, L2LeftTouch, L2RightPrick, L2LeftPrick, L2RightMotor, L2LeftMotor);
            neurologyForm.UpdateLevelAt("L3", L3RightTouch, L3LeftTouch, L3RightPrick, L3LeftPrick, L3RightMotor, L3LeftMotor);
            neurologyForm.UpdateLevelAt("L4", L4RightTouch, L4LeftTouch, L4RightPrick, L4LeftPrick, L4RightMotor, L4LeftMotor);
            neurologyForm.UpdateLevelAt("L5", L5RightTouch, L5LeftTouch, L5RightPrick, L5LeftPrick, L5RightMotor, L5LeftMotor);
            neurologyForm.UpdateLevelAt("S1", S1RightTouch, S1LeftTouch, S1RightPrick, S1LeftPrick, S1RightMotor, S1LeftMotor);
            neurologyForm.UpdateLevelAt("S2", S2RightTouch, S2LeftTouch, S2RightPrick, S2LeftPrick, "0", "0");
            neurologyForm.UpdateLevelAt("S3", S3RightTouch, S3LeftTouch, S3RightPrick, S3LeftPrick, "0", "0");
            neurologyForm.UpdateLevelAt("S4_5", S4_5RightTouch, S4_5LeftTouch, S4_5RightPrick, S4_5LeftPrick, "0", "0");
        }
        private static void AddValuesFromDermatomeToForm(XElement dermatomeElement, NeurologyForm neurologyForm)
        {
            // Right Touch
            var rightTouchName = dermatomeElement.Element("RightTouch").Value;
            var rightPrickName = dermatomeElement.Element("RightPrick").Value;
            var leftTouchName = dermatomeElement.Element("LeftTouch").Value;
            var leftPrickName = dermatomeElement.Element("LeftPrick").Value;

            var rightMotorElement = dermatomeElement.Element("RightMotor");
            var rightMotorName = rightMotorElement == null ? "0" : rightMotorElement.Value;

            var leftMotorElement = dermatomeElement.Element("LeftMotor");
            var leftMotorName = leftMotorElement == null ? "0" : leftMotorElement.Value;

            neurologyForm.UpdateLevelAt(dermatomeElement.Attribute("name").Value,
                    rightTouchName, leftTouchName,
                    rightPrickName, leftPrickName,
                    rightMotorName, leftMotorName);
        }