Skip to content

Commit

Permalink
#4 Finally banish the old testing framework
Browse files Browse the repository at this point in the history
  • Loading branch information
sguldmund committed Jan 12, 2024
1 parent 3407527 commit 866cfdd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
19 changes: 11 additions & 8 deletions test/Pose.Tests/IL/StubsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,27 @@
using System.Linq;
using FluentAssertions;
using Pose.IL;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert;

// ReSharper disable PossibleNullReferenceException

namespace Pose.Tests
{
[TestClass]
public class StubsTests
{
[TestMethod]
[Fact]
public void TestGenerateStubForStaticMethod()
{
var methodInfo = typeof(Console).GetMethod("WriteLine", new[] { typeof(string) });
// Arrange
var methodInfo = typeof(Console).GetMethod(nameof(Console.WriteLine), new[] { typeof(string) });
var dynamicMethod = Stubs.GenerateStubForDirectCall(methodInfo);
var count = dynamicMethod.GetParameters().Length;

var dynamicMethodParameters = dynamicMethod.GetParameters();
var methodParameters = methodInfo.GetParameters();

Assert.AreEqual(methodInfo.GetParameters().Length, dynamicMethod.GetParameters().Length);
Assert.AreEqual(methodInfo.GetParameters()[0].ParameterType, dynamicMethod.GetParameters()[0].ParameterType);
// Assert
dynamicMethodParameters.Should().HaveSameCount(methodParameters);
dynamicMethodParameters.FirstOrDefault()?.ParameterType.Should().Be(methodParameters.FirstOrDefault()?.ParameterType);
}

[Fact]
Expand Down
3 changes: 0 additions & 3 deletions test/Pose.Tests/Pose.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="15.9.0" />
<PackageReference Include="MSTest.TestAdapter" Version="1.1.18" />
<PackageReference Include="MSTest.TestFramework" Version="1.1.18" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
Expand Down

0 comments on commit 866cfdd

Please sign in to comment.