public void IsValidReturnUrl_NullReturnUrl_ThrowsException() { var service = new AgreementConsentService( Mock.Of <IEventService>(), Mock.Of <IIdentityServerInteractionService>(), Mock.Of <IScopeRepository>()); Assert.ThrowsAsync <ArgumentNullException>(async() => await service.IsValidReturnUrl(null)); }
public async Task IsValidReturnUrl_BadReturnUrl_ReturnsFalse() { var service = new AgreementConsentService( Mock.Of <IEventService>(), Mock.Of <IIdentityServerInteractionService>(), Mock.Of <IScopeRepository>()); var isValidReturnUrl = await service.IsValidReturnUrl(new Uri("https://www.badurl.co.uk/")); isValidReturnUrl.Should().BeFalse(); }
public async Task IsValidReturnUrl_ValidReturnUrl_ReturnsFalse() { var mockInteractionService = new Mock <IIdentityServerInteractionService>(); mockInteractionService.Setup(i => i.GetAuthorizationContextAsync(It.IsNotNull <string>())) .ReturnsAsync(new AuthorizationRequest()); var service = new AgreementConsentService( Mock.Of <IEventService>(), mockInteractionService.Object, Mock.Of <IScopeRepository>()); var isValidReturnUrl = await service.IsValidReturnUrl(new Uri("https://www.goodurl.co.uk/")); isValidReturnUrl.Should().BeTrue(); }