private async void ErrorForSameSessionId() { var dbContext = GetOtpContext(); var otpRepository = new OtpRepository(dbContext); var sessionId = TestBuilder.Faker().Random.Hash(); var otpToken = TestBuilder.Faker().Random.Number().ToString(); var testOtpResponse = new Response(ResponseType.InternalServerError, "OtpGeneration Saving failed"); await otpRepository.Save(otpToken, sessionId); var response = await otpRepository.Save(otpToken, sessionId); response.Should().BeEquivalentTo(testOtpResponse); dbContext.Database.EnsureDeleted(); }
private async void ReturnNullForInvalidSessionId() { var dbContext = GetOtpContext(); var otpRepository = new OtpRepository(dbContext); await otpRepository.Save(TestBuilder.Faker().Random.Number().ToString() , TestBuilder.Faker().Random.Hash()); var response = await otpRepository.GetWith(TestBuilder.Faker().Random.Hash()); var otpRequest = response.ValueOr((OtpRequest)null); otpRequest.Should().BeNull(); dbContext.Database.EnsureDeleted(); }
private async void SaveOtpGenerationRequest() { var faker = TestBuilder.Faker(); var dbContext = GetOtpContext(); var otpRepository = new OtpRepository(dbContext); var sessionId = faker.Random.Hash(); var otpToken = faker.Random.Number().ToString(); var testOtpResponse = new Response(ResponseType.Success, "Otp Created"); var response = await otpRepository.Save(otpToken, sessionId); response.Should().BeEquivalentTo(testOtpResponse); dbContext.Database.EnsureDeleted(); }