Example #1
0
 public void Initialise()
 {
     _pinValidationService = Substitute.For <IPinValidationService>();
     _pinValidationService.RequiredPinDigits.Returns(4);
     _pinValidationService.GetEncryptedPin(TestPin).Returns(EncryptedPin.EncryptPin(TestPin));
     _pinValidationService.IsPinCorrect(Arg.Any <EncryptedPin>(), TestPin).Returns(true);
 }
Example #2
0
        public CashCard(string pin, IPinValidationService pinValidationService)
        {
            // This would probably in production come from a data store somewhere that tracked unique card ids but for this exercise this works almost as well as I don't have this store available
            CardId = Guid.NewGuid();

            Balance = 0;

            _pinValidationService = pinValidationService;
            Pin = _pinValidationService.GetEncryptedPin(pin);
        }