public void GivenInvalidiBinaryStringExpectCorrectException() { //Arrange const string binaryStringWithRandomDistribution = "asfger"; //Act int maxNumOfConsecutiveZeros = AsciiHelper.GetMaxNumOfConsecutiveZeros(binaryStringWithRandomDistribution); }
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 GivenBinaryStringWith10AtStartExpectCorrectMaxNumOfConsecutiveZeros() { //Arrange const string binaryStringWithRandomDistribution = "10111111111"; const int expectedMaxNumOfConsecutiveZeros = 1; //Act int maxNumOfConsecutiveZeros = AsciiHelper.GetMaxNumOfConsecutiveZeros(binaryStringWithRandomDistribution); //Assert Assert.AreEqual(expectedMaxNumOfConsecutiveZeros, maxNumOfConsecutiveZeros); }
public void GivenBinaryStringWith0sAtEndFollowedBy1ExpectCorrectMaxNumOfConsecutiveZeros() { //Arrange const string binaryStringWithRandomDistribution = "111000001"; const int expectedMaxNumOfConsecutiveZeros = 5; //Act int maxNumOfConsecutiveZeros = AsciiHelper.GetMaxNumOfConsecutiveZeros(binaryStringWithRandomDistribution); //Assert Assert.AreEqual(expectedMaxNumOfConsecutiveZeros, maxNumOfConsecutiveZeros); }