Skip to content

Commit b971018

Browse files
committed
resolved #17: Fixed unit test running problem
1 parent cdf20d3 commit b971018

File tree

7 files changed

+42
-8
lines changed

7 files changed

+42
-8
lines changed

src/AbpCompanyName.AbpProjectName.Core/Web/WebContentFolderHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public static class WebContentDirectoryFinder
1212
{
1313
public static string CalculateContentRootFolder()
1414
{
15-
var coreAssemblyDirectoryPath = Path.GetDirectoryName(typeof(AbpProjectNameCoreModule).Assembly.Location);
15+
var coreAssemblyDirectoryPath = Path.GetDirectoryName(AppContext.BaseDirectory);
1616
if (coreAssemblyDirectoryPath == null)
1717
{
1818
throw new ApplicationException("Could not find location of AbpCompanyName.AbpProjectName.Core assembly!");

src/AbpCompanyName.AbpProjectName.EntityFrameworkCore/AbpCompanyName.AbpProjectName.EntityFrameworkCore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<PackageReference Include="Abp.EntityFrameworkCore" Version="1.5.0" />
2020
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" />
2121
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.1" />
22-
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.0.0">
22+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0">
2323
<PrivateAssets>All</PrivateAssets>
2424
</PackageReference>
2525
</ItemGroup>

src/AbpCompanyName.AbpProjectName.Web/AbpCompanyName.AbpProjectName.Web.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.1" />
3939
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" />
4040
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.0" />
41-
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.0.0">
41+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0">
4242
<PrivateAssets>All</PrivateAssets>
4343
</PackageReference>
4444
<PackageReference Include="Abp.AspNetCore" Version="1.5.1" />

test/AbpCompanyName.AbpProjectName.Tests/AbpCompanyName.AbpProjectName.Tests.csproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
1010
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
1111
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
12+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
13+
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
1214
</PropertyGroup>
1315

1416
<ItemGroup>
@@ -17,16 +19,16 @@
1719
</ItemGroup>
1820

1921
<ItemGroup>
20-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170106-08" />
22+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
2123
<PackageReference Include="xunit" Version="2.2.0" />
2224
<PackageReference Include="xunit.extensibility.execution" Version="2.2.0" />
2325
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
2426
<PackageReference Include="Shouldly" Version="2.8.2" />
2527
<PackageReference Include="Abp.TestBase" Version="1.5.1" />
26-
<PackageReference Include="NSubstitute" Version="2.0.0-rc" />
27-
<PackageReference Include="Castle.Windsor.MsDependencyInjection" Version="1.3.0" />
28+
<PackageReference Include="NSubstitute" Version="2.0.2" />
29+
<PackageReference Include="Castle.Windsor.MsDependencyInjection" Version="1.3.3" />
2830
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="1.1.1" />
29-
<PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.1-beta-003206" />
31+
<PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.0" />
3032
</ItemGroup>
3133

3234
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">

test/AbpCompanyName.AbpProjectName.Web.Tests/AbpCompanyName.AbpProjectName.Web.Tests.csproj

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
1111
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
1212
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
1315
</PropertyGroup>
1416

1517
<ItemGroup>
@@ -18,7 +20,7 @@
1820
</ItemGroup>
1921

2022
<ItemGroup>
21-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170106-08" />
23+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
2224
<PackageReference Include="xunit" Version="2.2.0" />
2325
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
2426
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
@@ -31,4 +33,29 @@
3133
<Reference Include="Microsoft.CSharp" />
3234
</ItemGroup>
3335

36+
<ItemGroup>
37+
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
38+
</ItemGroup>
39+
40+
<!-- Below ItemGroup and Target tags are added according to https://github.com/aspnet/Hosting/issues/959#issuecomment-286351703 -->
41+
42+
<!-- Solves Problem#2 (404 when executing service calls hosted in other assemblies) -->
43+
<!-- https://github.com/Microsoft/vstest/issues/196.-->
44+
<ItemGroup>
45+
<None Update="xunit.runner.json">
46+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
47+
</None>
48+
</ItemGroup>
49+
50+
<!-- https://github.com/NuGet/Home/issues/4412. -->
51+
<Target Name="CopyDepsFiles" AfterTargets="Build" Condition="'$(TargetFramework)'!=''">
52+
<ItemGroup>
53+
<DepsFilePaths Include="$([System.IO.Path]::ChangeExtension('%(_ResolvedProjectReferencePaths.FullPath)', '.deps.json'))" />
54+
</ItemGroup>
55+
56+
<Copy SourceFiles="%(DepsFilePaths.FullPath)" DestinationFolder="$(OutputPath)" Condition="Exists('%(DepsFilePaths.FullPath)')" />
57+
</Target>
58+
59+
60+
3461
</Project>

test/AbpCompanyName.AbpProjectName.Web.Tests/Startup.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
using Abp.AspNetCore.TestBase;
44
using Abp.Dependency;
55
using AbpCompanyName.AbpProjectName.EntityFrameworkCore;
6+
using AbpCompanyName.AbpProjectName.Web.Controllers;
67
using Castle.MicroKernel.Registration;
78
using Microsoft.AspNetCore.Builder;
89
using Microsoft.AspNetCore.Hosting;
10+
using Microsoft.AspNetCore.Mvc.ApplicationParts;
911
using Microsoft.EntityFrameworkCore;
1012
using Microsoft.Extensions.DependencyInjection;
1113
using Microsoft.Extensions.Logging;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"shadowCopy": false
3+
}

0 commit comments

Comments
 (0)