Skip to content

Commit

Permalink
Enable dotnet test support for MTP
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 committed Feb 20, 2025
1 parent c3ab500 commit 03c5a49
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jobs:
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
run: dotnet build --no-restore -p:TreatWarningsAsErrors=true
- name: Test
run: dotnet test --no-build --verbosity normal
9 changes: 9 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
<!-- aligned NuGet PackageVersion for package-bundles -->
<ComponentsPackagesVersion>4.7.11</ComponentsPackagesVersion>
<GrpcPackagesVersion>1.6.1</GrpcPackagesVersion>

<EnableMSTestRunner>true</EnableMSTestRunner>
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
<TestingPlatformShowTestsFailure>true</TestingPlatformShowTestsFailure>
<MSTestAnalysisMode>Recommended</MSTestAnalysisMode>

<!-- MSTEST0001: Explicitly enable or disable tests parallelization -->
<!-- TODO: Evaluate whether or not test projects are parallelizable or not. -->
<NoWarn>$(NoWarn);MSTEST0001</NoWarn>
</PropertyGroup>

<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" Condition="Exists($([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../')))"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<ImplicitUsings>enable</ImplicitUsings>
<EnableMSTestRunner>true</EnableMSTestRunner>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ public void DateHelper_GetValueFromDateTimeOffset()

// DateTime?
Assert.AreEqual(dateTimeOffset.DateTime, DateHelper.GetValueFromDateTimeOffset<DateTime?>(dateTimeOffset));
Assert.AreEqual(null, DateHelper.GetValueFromDateTimeOffset<DateTime?>(null));
Assert.IsNull(DateHelper.GetValueFromDateTimeOffset<DateTime?>(null));

// DateTimeOffset
Assert.AreEqual(dateTimeOffset, DateHelper.GetValueFromDateTimeOffset<DateTimeOffset>(dateTimeOffset));
Assert.AreEqual(default(DateTimeOffset), DateHelper.GetValueFromDateTimeOffset<DateTimeOffset>(null));

// DateTimeOffset?
Assert.AreEqual(dateTimeOffset, DateHelper.GetValueFromDateTimeOffset<DateTimeOffset?>(dateTimeOffset));
Assert.AreEqual(null, DateHelper.GetValueFromDateTimeOffset<DateTimeOffset?>(null));
Assert.IsNull(DateHelper.GetValueFromDateTimeOffset<DateTimeOffset?>(null));
}

private class Fixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<ImplicitUsings>enable</ImplicitUsings>
<EnableMSTestRunner>true</EnableMSTestRunner>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ public void DictionaryStaticDataStore_ManyParallelCallsShouldNotReloadData()
}

[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
public void DictionaryStaticDataStore_SyncWithThrowIfNotLoaded_ShouldRaiseException()
{
// arrange
Expand All @@ -178,7 +177,7 @@ public void DictionaryStaticDataStore_SyncWithThrowIfNotLoaded_ShouldRaiseExcept
sut.Setup(s => s.ShouldRefresh()).Returns(false);

// act
var result = sut.Object.GetAll(throwIfNotLoaded: true);
Assert.ThrowsExactly<InvalidOperationException>(() => sut.Object.GetAll(throwIfNotLoaded: true));

// assert
// expected exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ public void StaticDataStore_SyncNotLoaded_ShouldReturnDefault()
}

[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
public void StaticDataStore_SyncThrowIfNotLoaded_ShouldRaiseException()
{
// arrange
Expand All @@ -153,7 +152,7 @@ public void StaticDataStore_SyncThrowIfNotLoaded_ShouldRaiseException()
sut.Setup(s => s.ShouldRefresh()).Returns(false);

// act
var result = sut.Object.GetValue(throwIfNotLoaded: true);
Assert.ThrowsExactly<InvalidOperationException>(() => sut.Object.GetValue(throwIfNotLoaded: true));

// assert
// expected exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<EnableMSTestRunner>true</EnableMSTestRunner>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion Havit.Blazor.Components.Web.Tests/SelectorHelpersTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void SelectorHelpers_GetText()
[TestMethod]
public void SelectorHelpers_GetValue()
{
Assert.AreEqual(null, SelectorHelpers.GetValue<int?, string>(i => "X" + i, null)); // use default
Assert.IsNull(SelectorHelpers.GetValue<int?, string>(i => "X" + i, null)); // use default
Assert.AreEqual("X1", SelectorHelpers.GetValue<int?, string>(i => "X" + i, 1)); // use value selector
Assert.AreEqual(1, SelectorHelpers.GetValue<int?, int?>(null, 1)); // use value selector
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<EnableMSTestRunner>true</EnableMSTestRunner>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<EnableMSTestRunner>true</EnableMSTestRunner>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<EnableMSTestRunner>true</EnableMSTestRunner>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<TargetFrameworks>net9.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<ImplicitUsings>enable</ImplicitUsings>
<EnableMSTestRunner>true</EnableMSTestRunner>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand Down

0 comments on commit 03c5a49

Please sign in to comment.