quick code snippet to setup automoq

 This is a quick start example of setup mock for Automoq. 

var mocker = new AutoMocker();
var creditCardValidator = mocker.CreateInstance<CreditCardValidator>();

mocker.GetMock<ICreditCardValidator>().Setup(x => x.Validate("fakecardnunber", new DateTime(2024, 12, 12))).Returns(new CreditCardValidationResult("", true));

var result = creditCardValidator.Validate("fakecardnunber", new DateTime(2024, 12, 12));
Assert.IsTrue(result.Valid);                    

Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm