public async Task ShouldDeleteOtpDocumentAfterValidation() { OtpDocument deletedDoc = null; _otpRepository .Setup(r => r.Delete(It.IsAny <OtpDocument>())) .Callback((OtpDocument doc) => deletedDoc = doc); var result = await _otpService.ValidateAsync(_defaultRequest); deletedDoc.Should().Be(_defaultOtpDoc); }
public async Task ShouldCreateOtpDocumentOnSuccess() { OtpDocument docAdded = null; _otpRepository.Setup(r => r.Create(It.IsAny <OtpDocument>())) .Callback((OtpDocument doc) => docAdded = doc); var request = CreateRequest(); await _otpService.SendAsync(request); docAdded.Should().NotBeNull(); docAdded.id.Should().NotBeNullOrWhiteSpace(); docAdded.UserUuid.Should().Be(request.User.UserUuid); docAdded.UserId.Should().Be(request.User.GetId()); docAdded.OtpCreatedTime.Should().BeCloseTo(DateTime.UtcNow); }