public void AutoFixture_Without_Automoq() { // Arrange var mockAggregationService = new Mock <IAggregationService>(); var mockConfigurationService = new Mock <IConfigurationService>(); var mockSecurityService = new Mock <ISecurityService>(); var mockCmsModel = new Mock <ICmsModel>(); var registration = new Registration( () => mockAggregationService.Object, () => mockConfigurationService.Object, () => mockSecurityService.Object); var viewModel = new RegistrationDetailsVM() { ClientReference = "asd" }; // Act var result = registration.ValidateRegistrationDetails(viewModel, mockCmsModel.Object); // Assert Assert.IsNotNull(result); Assert.AreEqual(RegistrationNextActionEnum.RegistrationBlocked, result.NextAction); mockSecurityService.Verify(x => x.Reg(It.Is <RegistrationRequest>(y => y.RegCode == viewModel.ClientReference)), Times.Once); }
public void AutoFixture_With_AutoData_Automoq([Frozen] Mock <ISecurityService> mockSecurityService, Registration registration, RegistrationDetailsVM viewModel, ICmsModel cms) { // Arrange // Act RegistrationResultVM result = registration.ValidateRegistrationDetails(viewModel, cms); // allows new parameters in Registration constructor // Assert Assert.IsNotNull(result); Assert.AreEqual(RegistrationNextActionEnum.RegistrationBlocked, result.NextAction); mockSecurityService.Verify(x => x.Reg(It.Is <RegistrationRequest>(y => y.RegCode == viewModel.ClientReference)), Times.Once); }
public RegistrationResultVM ValidateRegistrationDetails(RegistrationDetailsVM viewModel, ICmsModel cms) { if (cms == null) { throw new ArgumentNullException(nameof(cms)); } bool regResult = p3.Invoke().Reg(new RegistrationRequest { RegCode = viewModel.ClientReference }); return(new RegistrationResultVM { NextAction = RegistrationNextActionEnum.RegistrationBlocked }); }