public void ConvertOne()
 {
     BinaryValidator binaryValidator = new BinaryValidator();
     BinaryConverter binaryConverter = new BinaryConverter(binaryValidator);
     int convertedValue = binaryConverter.ConvertToDecimalNumber("1");
     Assert.That(convertedValue == 1);
 }
 public void ConvertNumberShouldSucceed(string binaryNumber, int result)
 {
     BinaryValidator binaryValidator = new BinaryValidator();
     BinaryConverter binaryConverter = new BinaryConverter(binaryValidator);
     int convertedValue = binaryConverter.ConvertToDecimalNumber(binaryNumber);
     Assert.That(convertedValue == result);
 }
 public void ThrowsArgumentExceptionWhenParameterIsNotBinaryNumber()
 {
     IBinaryValidator binaryValidator = new BinaryValidatorAlwaysInvalid();
     BinaryConverter binaryConverter = new BinaryConverter(binaryValidator);
     Assert.Throws<ArgumentException>(
         () => binaryConverter.ConvertToDecimalNumber("a")
         );
 }
        public void ThrowsArgumentExceptionWhenParameterIsNotBinaryNumberVersionWithRhinoMocks()
        {
            IBinaryValidator binaryValidator = MockRepository.GenerateStub<IBinaryValidator>();
            binaryValidator.Stub(x => x.IsValidBinaryNumber(Arg<string>.Is.Anything))
                .Return(false);

            BinaryConverter binaryConverter = new BinaryConverter(binaryValidator);
            Assert.Throws<ArgumentException>(
                () => binaryConverter.ConvertToDecimalNumber("a")
                );
        }