Пример #1
0
    public async Task GetUrlAsync()
    {
        using (_currentTenant.Change(null))
        {
            var url = await _appUrlProvider.GetUrlAsync("MVC");

            url.ShouldBe("https://abp.io");

            url = await _appUrlProvider.GetUrlAsync("MVC", "PasswordReset");

            url.ShouldBe("https://abp.io/account/reset-password");
        }

        using (_currentTenant.Change(Guid.NewGuid(), "community"))
        {
            var url = await _appUrlProvider.GetUrlAsync("MVC");

            url.ShouldBe("https://community.abp.io");

            url = await _appUrlProvider.GetUrlAsync("MVC", "PasswordReset");

            url.ShouldBe("https://community.abp.io/account/reset-password");
        }

        var tenantId = Guid.NewGuid();

        using (_currentTenant.Change(tenantId))
        {
            var url = await _appUrlProvider.GetUrlAsync("BLAZOR");

            url.ShouldBe($"https://{tenantId}.abp.io");

            url = await _appUrlProvider.GetUrlAsync("BLAZOR", "PasswordReset");

            url.ShouldBe($"https://{tenantId}.abp.io/account/reset-password");
        }

        await Assert.ThrowsAsync <AbpException>(async() =>
        {
            await _appUrlProvider.GetUrlAsync("ANGULAR");
        });
    }
 private static Task <string> GetResetPasswordUrlAsync(IAppUrlProvider appUrlProvider, string appName)
 {
     return(appUrlProvider.GetUrlAsync(appName, AccountUrlNames.ResetPassword));
 }
 public static Task <string> GetResetPasswordUrlAsync(this IAppUrlProvider appUrlProvider, string appName)
 {
     return(appUrlProvider.GetUrlAsync(appName, AccountUrlNames.PasswordReset));
 }