Browse Source

Merge pull request #18661 from abpframework/zh-hans-unit-tests

Fix the unit tests.
pull/18663/head
maliming 2 years ago
committed by GitHub
parent
commit
d142dd8fde
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      framework/test/Volo.Abp.Authorization.Tests/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions_Tests.cs
  2. 2
      framework/test/Volo.Abp.GlobalFeatures.Tests/Volo/Abp/GlobalFeatures/AbpGlobalFeatureNotEnableException_Localization_Test.cs

10
framework/test/Volo.Abp.Authorization.Tests/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions_Tests.cs

@ -22,27 +22,27 @@ public class AbpAuthorizationServiceExtensions_Tests : AuthorizationTestBase
{
var exception = new AbpAuthorizationException(code: AbpAuthorizationErrorCodes.GivenPolicyHasNotGranted);
var errorInfo = _exceptionToErrorInfoConverter.Convert(exception);
errorInfo.Message.ShouldBe("授权失败! 提供的策略尚未授予.");
errorInfo.Message.ShouldBe("授权失败!提供的策略尚未授予。");
exception = new AbpAuthorizationException(code: AbpAuthorizationErrorCodes.GivenPolicyHasNotGrantedWithPolicyName)
.WithData("PolicyName", "my_policy_name");
errorInfo = _exceptionToErrorInfoConverter.Convert(exception);
errorInfo.Message.ShouldBe("授权失败! 提供的策略尚未授予: my_policy_name");
errorInfo.Message.ShouldBe("授权失败!提供的策略尚未授予: my_policy_name");
exception = new AbpAuthorizationException(code: AbpAuthorizationErrorCodes.GivenPolicyHasNotGrantedForGivenResource)
.WithData("ResourceName", "my_resource_name");
errorInfo = _exceptionToErrorInfoConverter.Convert(exception);
errorInfo.Message.ShouldBe("授权失败! 提供的策略未授予提供的资源: my_resource_name");
errorInfo.Message.ShouldBe("授权失败!提供的策略未授予提供的资源:my_resource_name");
exception = new AbpAuthorizationException(code: AbpAuthorizationErrorCodes.GivenRequirementHasNotGrantedForGivenResource)
.WithData("ResourceName", "my_resource_name");
errorInfo = _exceptionToErrorInfoConverter.Convert(exception);
errorInfo.Message.ShouldBe("授权失败! 提供的要求未授予提供的资源: my_resource_name");
errorInfo.Message.ShouldBe("授权失败!提供的要求未授予提供的资源:my_resource_name");
exception = new AbpAuthorizationException(code: AbpAuthorizationErrorCodes.GivenRequirementsHasNotGrantedForGivenResource)
.WithData("ResourceName", "my_resource_name");
errorInfo = _exceptionToErrorInfoConverter.Convert(exception);
errorInfo.Message.ShouldBe("授权失败! 提供的要求未授予提供的资源: my_resource_name");
errorInfo.Message.ShouldBe("授权失败!提供的要求未授予提供的资源:my_resource_name");
}
}
}

2
framework/test/Volo.Abp.GlobalFeatures.Tests/Volo/Abp/GlobalFeatures/AbpGlobalFeatureNotEnableException_Localization_Test.cs

@ -23,7 +23,7 @@ public class AbpGlobalFeatureNotEnableException_Localization_Test : GlobalFeatur
.WithData("ServiceName", "MyService")
.WithData("GlobalFeatureName", "TestFeature"); ;
var errorInfo = _exceptionToErrorInfoConverter.Convert(exception);
errorInfo.Message.ShouldBe("'MyService'服务需要启用'TestFeature'功能.");
errorInfo.Message.ShouldBe("'MyService' 服务需要启用 'TestFeature'。");
}
}
}

Loading…
Cancel
Save