Esempio n. 1
0
        public int GetMaxNumOfConsecutiveZerosFromAsciiValueSum(FullName fullName)
        {
            int    sumOfAsciiValues = AsciiHelper.SumAsciiValuesInString($"{fullName.FirstName} {fullName.LastName}");
            string sumOfAsciiValuesAsBinaryString = AsciiHelper.ConvertNumToBinaryString(sumOfAsciiValues);
            int    maxNumOfConsecutiveZeros       = AsciiHelper.GetMaxNumOfConsecutiveZeros(sumOfAsciiValuesAsBinaryString);

            return(maxNumOfConsecutiveZeros);
        }
        public void GivenStringExpectCorrectAsciiValueSum()
        {
            //Arrange
            const string name = "Dave Kay";
            const int    expectedAsciiValueSum = 709;

            //Act
            int sumOfAsciiValues = AsciiHelper.SumAsciiValuesInString(name);

            //Assert
            Assert.AreEqual(expectedAsciiValueSum, sumOfAsciiValues);
        }