Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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();
        }