Skip to content

Commit

Permalink
Fixed more unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Whit Waldo <[email protected]>
  • Loading branch information
WhitWaldo committed Jan 19, 2025
1 parent 385284c commit 220818e
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions test/Dapr.Actors.Test/Description/MethodDescriptionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// ------------------------------------------------------------------------

using System;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -36,7 +37,7 @@ public void MethodDescription_CreatMethodDescription()

description.MethodInfo.ShouldBeSameAs(methodInfo);
description.Name.ShouldBe("GetString");
description.ReturnType.ShouldBeOfType<Task<string>>();
description.ReturnType.ShouldBe(typeof(Task<string>));
description.Id.ShouldNotBe(0);
description.Arguments.ShouldBeEmpty();
description.HasCancellationToken.ShouldBeFalse();
Expand Down Expand Up @@ -66,11 +67,8 @@ public void MethodDescription_CreateGeneratesArgumentDescriptions_WhenMethodHasA

// Assert
description.Arguments.ShouldNotBeNull();
description.Arguments.ShouldBeOfType<MethodArgumentDescription>();
description.Arguments.ShouldBeEquivalentTo(new[]
{
new { Name = "number" }, new { Name = "choice" }, new { Name = "information" }
});
description.Arguments.ShouldBeOfType<MethodArgumentDescription[]>();
description.Arguments.Select(m => new {m.Name}).ShouldBe(new[] {new {Name = "number"}, new {Name = "choice"}, new {Name = "information"}});
}

[Fact]
Expand Down Expand Up @@ -98,7 +96,7 @@ public void MethodDescription_CreateThrowsArgumentException_WhenMethodHasTokenAs

// Assert
var exception = Should.Throw<ArgumentException>(action);
exception.Message.ShouldBe("Method 'MethodWithTokenNotLast' of actor interface '*+ITestActor' has a '*.CancellationToken' parameter that is not the last parameter. If an actor method accepts a '*.CancellationToken' parameter, it must be the last parameter.*");
exception.Message.ShouldMatch(@"Method 'MethodWithTokenNotLast' of actor interface '.*\+ITestActor' has a '.*\.CancellationToken' parameter that is not the last parameter. If an actor method accepts a '.*\.CancellationToken' parameter, it must be the last parameter\..*");
exception.ParamName.ShouldBe("actorInterfaceType");
}

Expand Down

0 comments on commit 220818e

Please sign in to comment.