Beispiel #1
0
        public void Throw_if_not_binary_input(string binaryString, string expectedNotAllowedCharacters)
        {
            Action act = () => BinaryService.BinaryToDecimal(binaryString);

            act.Should()
            .Throw <ArgumentOutOfRangeException>()
            .WithMessage($"Only 1, 0 and whitespace allowed. Contains not allowed characters: {expectedNotAllowedCharacters}  ");
        }
        private static List <string> SplitIntoNibbles(string binaryString)
        {
            binaryString = SeparatorService.RemoveSeparatorBlanks(binaryString);
            binaryString = BinaryService.AddZerosToFillHighestNibbleWithZeros(binaryString);
            binaryString = SeparatorService.AddSeparatorBlanks(binaryString, 4);

            return(binaryString.Split(" ")
                   .Reverse()
                   .ToList());
        }
Beispiel #3
0
        public void Converter_binary_to_decimal(string binaryString, string expectedDecimalString)
        {
            var result = BinaryService.BinaryToDecimal(binaryString);

            result.Should().Be(expectedDecimalString);
        }
Beispiel #4
0
 public ServiceTests()
 {
     _customBinaryService   = new BinaryService();
     _customVariableService = new VariableService();
     _chromeConfig          = new ChromeConfig();
 }
 public CustomServiceTests()
 {
     _customBinaryService   = new BinaryService();
     _customVariableService = new VariableService();
 }