|
|
|
@ -4,46 +4,42 @@ using Xunit;
|
|
|
|
|
|
|
|
|
|
namespace Volo.Abp.TextTemplating.VirtualFiles
|
|
|
|
|
{
|
|
|
|
|
//TODO: Make tests running again!
|
|
|
|
|
//public class VirtualFileTemplateContributor_Tests : AbpTextTemplatingTestBase
|
|
|
|
|
//{
|
|
|
|
|
// [Fact]
|
|
|
|
|
// public async Task Should_Get_Localized_Content_By_Culture()
|
|
|
|
|
// {
|
|
|
|
|
// var contributor = new VirtualFileTemplateContentContributor(
|
|
|
|
|
// "/SampleTemplates/WelcomeEmail"
|
|
|
|
|
// );
|
|
|
|
|
public class VirtualFileTemplateContributor_Tests : AbpTextTemplatingTestBase
|
|
|
|
|
{
|
|
|
|
|
private readonly ITemplateDefinitionManager _templateDefinitionManager;
|
|
|
|
|
private readonly VirtualFileTemplateContentContributor _virtualFileTemplateContentContributor;
|
|
|
|
|
|
|
|
|
|
// contributor.Initialize(
|
|
|
|
|
// new TemplateContentContributorInitializationContext(
|
|
|
|
|
// new TemplateDefinition("Test"),
|
|
|
|
|
// ServiceProvider
|
|
|
|
|
// )
|
|
|
|
|
// );
|
|
|
|
|
public VirtualFileTemplateContributor_Tests()
|
|
|
|
|
{
|
|
|
|
|
_templateDefinitionManager = GetRequiredService<ITemplateDefinitionManager>();
|
|
|
|
|
_virtualFileTemplateContentContributor = GetRequiredService<VirtualFileTemplateContentContributor>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (await contributor
|
|
|
|
|
// .GetOrNullAsync("en")).ShouldBe("Welcome {{model.name}} to the abp.io!");
|
|
|
|
|
[Fact]
|
|
|
|
|
public async Task Should_Get_Localized_Content_By_Culture()
|
|
|
|
|
{
|
|
|
|
|
(await _virtualFileTemplateContentContributor.GetOrNullAsync(
|
|
|
|
|
new TemplateContentContributorContext(_templateDefinitionManager.Get(TestTemplates.WelcomeEmail),
|
|
|
|
|
ServiceProvider,
|
|
|
|
|
"en")))
|
|
|
|
|
.ShouldBe("Welcome {{model.name}} to the abp.io!");
|
|
|
|
|
|
|
|
|
|
// (await contributor
|
|
|
|
|
// .GetOrNullAsync("tr")).ShouldBe("Merhaba {{model.name}}, abp.io'ya hoşgeldiniz!");
|
|
|
|
|
// }
|
|
|
|
|
(await _virtualFileTemplateContentContributor.GetOrNullAsync(
|
|
|
|
|
new TemplateContentContributorContext(_templateDefinitionManager.Get(TestTemplates.WelcomeEmail),
|
|
|
|
|
ServiceProvider,
|
|
|
|
|
"tr")))
|
|
|
|
|
.ShouldBe("Merhaba {{model.name}}, abp.io'ya hoşgeldiniz!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// [Fact]
|
|
|
|
|
// public async Task Should_Get_Non_Localized_Template_Content()
|
|
|
|
|
// {
|
|
|
|
|
// var contributor = new VirtualFileTemplateContentContributor(
|
|
|
|
|
// "/SampleTemplates/ForgotPasswordEmail.tpl"
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
|
|
// contributor.Initialize(
|
|
|
|
|
// new TemplateContentContributorInitializationContext(
|
|
|
|
|
// new TemplateDefinition("Test"),
|
|
|
|
|
// ServiceProvider
|
|
|
|
|
// )
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
|
|
// (await contributor
|
|
|
|
|
// .GetOrNullAsync()).ShouldBe("{{l \"HelloText\"}}. Please click to the following link to get an email to reset your password!");
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
[Fact]
|
|
|
|
|
public async Task Should_Get_Non_Localized_Template_Content()
|
|
|
|
|
{
|
|
|
|
|
(await _virtualFileTemplateContentContributor.GetOrNullAsync(
|
|
|
|
|
new TemplateContentContributorContext(
|
|
|
|
|
_templateDefinitionManager.Get(TestTemplates.ForgotPasswordEmail),
|
|
|
|
|
ServiceProvider,
|
|
|
|
|
null)))
|
|
|
|
|
.ShouldBe("{{L \"HelloText\" model.name}}, {{L \"HowAreYou\" }}. Please click to the following link to get an email to reset your password!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|