public async Task TryingToCreateProfileContact_EverythingValid_SuccessfullyCreated() { var partnerContactRepository = new Mock <IPartnerContactRepository>(); var partnerContactResult = PartnerContactErrorCodes.None; partnerContactRepository .Setup(x => x.CreateIfNotExistAsync(It.IsAny <PartnerContactModel>())) .ReturnsAsync(partnerContactResult) .Verifiable(); PartnerContactService partnerContactService; using (var logFactory = LogFactory.Create().AddUnbufferedConsole()) { partnerContactService = new PartnerContactService( partnerContactRepository.Object, logFactory); } var actual = await partnerContactService.CreateIfNotExistsAsync(new PartnerContactModel { }); Assert.Equal(partnerContactResult, actual); }
public async Task TryingToCreateProfileContact_ProfileContactAlreadyExists_ErrorCodeIsReturned() { var partnerContactRepository = new Mock <IPartnerContactRepository>(); var partnerContactResult = PartnerContactErrorCodes.PartnerContactAlreadyExists; partnerContactRepository .Setup(x => x.CreateIfNotExistAsync(It.IsAny <PartnerContactModel>())) .ReturnsAsync(partnerContactResult); PartnerContactService partnerContactService; using (var logFactory = LogFactory.Create().AddUnbufferedConsole()) { partnerContactService = new PartnerContactService( partnerContactRepository.Object, logFactory); } var actual = await partnerContactService.CreateIfNotExistsAsync(new PartnerContactModel { }); Assert.Equal(partnerContactResult, actual); }