Esempio n. 1
0
        public void ConstructorValidNhsNumberUnformattedInputStringTest()
        {
            string expectedFormattedValue = "437 262 3623";
            string testValue = "4372623623";

            NhsNumber targetNhsNumber = new NhsNumber(testValue);

            Assert.AreNotEqual <string>(testValue, targetNhsNumber.ToString(), string.Format("Actual value [{1}] does not match expected [{0}]", expectedFormattedValue, targetNhsNumber.ToString()));
            Assert.AreEqual <string>(expectedFormattedValue, targetNhsNumber.ToString(), string.Format("Actual value [{1}] does not match expected [{0}]", expectedFormattedValue, targetNhsNumber.ToString()));
        }
Esempio n. 2
0
        public void ParseNhsNumberGoodParameterTest()
        {
            string testValue          = "4372623623";
            string testExpectedOutput = "437 262 3623";

            NhsNumber targetNhsNumber = NhsNumber.ParseNhsNumber(testValue);

            Assert.AreEqual <string>(testExpectedOutput, targetNhsNumber.ToString(), "ParseNhsNumber method call should create valid NhsNumber.");
        }
Esempio n. 3
0
        /// <summary>
        /// Set internal state of the control.
        /// </summary>
        /// <param name="identifierType">identifer type</param>
        /// <param name="identifier">identifier</param>
        private void SetInternalState(IdentifierType identifierType, string identifier)
        {
            string    text      = string.Empty;
            NhsNumber nhsNumber = null;

            if (identifierType == IdentifierType.Other || this.initializing)
            {
                text = identifier;
            }
            else if (identifierType == IdentifierType.NhsNumber && identifier != IdentifierLabelControl.Resources.IdentifierDefaultDesignTimeValue)
            {
                nhsNumber = new NhsNumber(identifier);
                text      = nhsNumber.ToString();
            }

            this.identifierType = identifierType;
            this.nhsNumber      = nhsNumber;
            base.Text           = text;
        }
Esempio n. 4
0
        public void ConstructorValidNhsNumberUnformattedInputStringTest()
        {
            string expectedFormattedValue = "437 262 3623";
            string testValue = "4372623623";

            NhsNumber targetNhsNumber = new NhsNumber(testValue);

            Assert.AreNotEqual<string>(testValue, targetNhsNumber.ToString(), string.Format("Actual value [{1}] does not match expected [{0}]", expectedFormattedValue, targetNhsNumber.ToString()));
            Assert.AreEqual<string>(expectedFormattedValue, targetNhsNumber.ToString(), string.Format("Actual value [{1}] does not match expected [{0}]", expectedFormattedValue, targetNhsNumber.ToString()));
        }