Alba seems to run forever un mstest?
sommmen opened this issue · 2 comments
sommmen commented
Hello,
I'm trying out alba so i might have missed something.
Using MsTest:
[TestClass]
public class ManagementReportControllerTest
{
public IAlbaHost Host { get; set; }
[TestInitialize]
public async Task TestInitialize()
{
//Host = await AlbaHost.For<Program>(x =>
//{
// x.ConfigureServices((context, services) =>
// {
// //services.AddSingleton<IService, ServiceA>();
// });
//});
}
[TestCleanup]
public void TestCleanup()
{
}
[TestMethod]
public async Task GetKpiClasses()
{
Host = await AlbaHost.For<Program>(x =>
{
x.ConfigureServices((context, services) =>
{
//services.AddLogging(c => c.ClearProviders());
});
});
var doc = await Host.GetAsJson<JsonDocument>("/api/ManagementReport/KpiClasses");
}
}
The AlbaHost seems to build fine but the test keeps running indefinitely.
I'm seeing no logging anywhere so i don't know what's going on and why this just keeps on running.
csproj;
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Alba" Version="7.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.2.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.2.2" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\WebApi\WebApi.csproj" />
</ItemGroup>
<ItemGroup>
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
</ItemGroup>
</Project>
InternalsVisible is setup correctly.
sommmen commented
Edit; this seems to work when running dotnet test but then fails in visual studio. It could be the resharper plugin it had issues with testing before.
sommmen commented
It seems to be resharper.