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