Skip to content

Commit 590943f

Browse files
committed
resolved #20: Don't run multi tenant tests when multi tenancy is disabled.
1 parent 74f06b2 commit 590943f

File tree

8 files changed

+27
-4
lines changed

8 files changed

+27
-4
lines changed

aspnet-core/src/AbpCompanyName.AbpProjectName.Core/AbpProjectNameConsts.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ public class AbpProjectNameConsts
55
public const string LocalizationSourceName = "AbpProjectName";
66

77
public const string ConnectionStringName = "Default";
8+
9+
public const bool MultiTenancyEnabled = true;
810
}
911
}

aspnet-core/src/AbpCompanyName.AbpProjectName.Core/AbpProjectNameCoreModule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public override void PreInitialize()
2626
AbpProjectNameLocalizationConfigurer.Configure(Configuration.Localization);
2727

2828
//Enable this line to create a multi-tenant application.
29-
Configuration.MultiTenancy.IsEnabled = true;
29+
Configuration.MultiTenancy.IsEnabled = AbpProjectNameConsts.MultiTenancyEnabled;
3030

3131
//Configure roles
3232
AppRoleConfig.Configure(Configuration.Modules.Zero().RoleManagement);

aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Mvc/wwwroot/view-resources/Views/Shared/Components/TenantChange/Default.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Mvc/wwwroot/view-resources/Views/Shared/Components/TenantChange/_ChangeModal.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aspnet-core/test/AbpCompanyName.AbpProjectName.Tests/AbpCompanyName.AbpProjectName.Tests.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,10 @@
3232
<Reference Include="Microsoft.CSharp" />
3333
</ItemGroup>
3434

35+
<ItemGroup>
36+
<None Update="appsettings.json">
37+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
38+
</None>
39+
</ItemGroup>
40+
3541
</Project>

aspnet-core/test/AbpCompanyName.AbpProjectName.Tests/AbpProjectNameTestBase.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,6 @@ protected void LoginAsDefaultTenantAdmin()
208208

209209
protected void LoginAsHost(string userName)
210210
{
211-
Resolve<IMultiTenancyConfig>().IsEnabled = true;
212-
213211
AbpSession.TenantId = null;
214212

215213
var user =
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Xunit;
2+
3+
namespace AbpCompanyName.AbpProjectName.Tests
4+
{
5+
public sealed class MultiTenantFactAttribute : FactAttribute
6+
{
7+
public MultiTenantFactAttribute()
8+
{
9+
if (!AbpProjectNameConsts.MultiTenancyEnabled)
10+
{
11+
Skip = "MultiTenancy is disabled.";
12+
}
13+
}
14+
}
15+
}

aspnet-core/test/AbpCompanyName.AbpProjectName.Tests/Sessions/SessionAppService_Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public SessionAppService_Tests()
1414
_sessionAppService = Resolve<ISessionAppService>();
1515
}
1616

17-
[Fact]
17+
[MultiTenantFact]
1818
public async Task Should_Get_Current_User_When_Logged_In_As_Host()
1919
{
2020
//Arrange

0 commit comments

Comments
 (0)