From dbf242a81763fb685a35d1eedc659727c5a5f1b6 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Sat, 18 Jan 2025 17:45:05 -0600 Subject: [PATCH] Fixed additional unit tests Signed-off-by: Whit Waldo --- .../ActorInterfaceDescriptionTests.cs | 12 ++++++------ .../Description/InterfaceDescriptionTests.cs | 19 +++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/test/Dapr.Actors.Test/Description/ActorInterfaceDescriptionTests.cs b/test/Dapr.Actors.Test/Description/ActorInterfaceDescriptionTests.cs index ae5b828c..3193a795 100644 --- a/test/Dapr.Actors.Test/Description/ActorInterfaceDescriptionTests.cs +++ b/test/Dapr.Actors.Test/Description/ActorInterfaceDescriptionTests.cs @@ -49,7 +49,7 @@ public void ActorInterfaceDescription_CreateThrowsArgumentException_WhenTypeIsNo // Assert var exception = Should.Throw(action); - exception.Message.ShouldBe("The type 'System.Object' is not an Actor interface as it is not an interface.*"); + exception.Message.ShouldMatch(@"The type 'System.Object' is not an Actor interface as it is not an interface.*"); exception.ParamName.ShouldBe("actorInterfaceType"); } @@ -64,7 +64,7 @@ public void ActorInterfaceDescription_CreateThrowsArgumentException_WhenTypeIsNo // Assert var exception = Should.Throw(action); - exception.Message.ShouldBe("The type 'System.ICloneable' is not an actor interface as it does not derive from the interface 'Dapr.Actors.IActor'.*"); + exception.Message.ShouldMatch(@"The type 'System.ICloneable' is not an actor interface as it does not derive from the interface 'Dapr.Actors.IActor'.*"); exception.ParamName.ShouldBe("actorInterfaceType"); } @@ -79,7 +79,7 @@ public void ActorInterfaceDescription_CreateThrowsArgumentException_WhenActorInt // Assert var exception = Should.Throw(action); - exception.Message.ShouldBe("The type '*+IClonableActor' is not an actor interface as it derive from a non actor interface 'System.ICloneable'. All actor interfaces must derive from 'Dapr.Actors.IActor'.*"); + exception.Message.ShouldMatch(@"The type '.*\+IClonableActor' is not an actor interface as it derive from a non actor interface 'System.ICloneable'. All actor interfaces must derive from 'Dapr.Actors.IActor'.*"); exception.ParamName.ShouldBe("actorInterfaceType"); } @@ -112,7 +112,7 @@ public void ActorInterfaceDescription_CreateUsingCRCIdThrowsArgumentException_Wh // Assert var exception = Should.Throw(action); - exception.Message.ShouldBe("The type 'System.Object' is not an Actor interface as it is not an interface.*"); + exception.Message.ShouldMatch(@"The type 'System.Object' is not an Actor interface as it is not an interface.*"); exception.ParamName.ShouldBe("actorInterfaceType"); } @@ -127,7 +127,7 @@ public void ActorInterfaceDescription_CreateUsingCRCIdThrowsArgumentException_Wh // Assert var exception = Should.Throw(action); - exception.Message.ShouldBe("The type 'System.ICloneable' is not an actor interface as it does not derive from the interface 'Dapr.Actors.IActor'.*"); + exception.Message.ShouldMatch(@"The type 'System.ICloneable' is not an actor interface as it does not derive from the interface 'Dapr.Actors.IActor'.*"); exception.ParamName.ShouldBe("actorInterfaceType"); } @@ -142,7 +142,7 @@ public void ActorInterfaceDescription_CreateUsingCRCIdThrowsArgumentException_Wh // Assert var exception = Should.Throw(action); - exception.Message.ShouldBe("The type '*+IClonableActor' is not an actor interface as it derive from a non actor interface 'System.ICloneable'. All actor interfaces must derive from 'Dapr.Actors.IActor'.*"); + exception.Message.ShouldMatch(@"The type '.*\+IClonableActor' is not an actor interface as it derive from a non actor interface 'System.ICloneable'. All actor interfaces must derive from 'Dapr.Actors.IActor'.*"); exception.ParamName.ShouldBe("actorInterfaceType"); } diff --git a/test/Dapr.Actors.Test/Description/InterfaceDescriptionTests.cs b/test/Dapr.Actors.Test/Description/InterfaceDescriptionTests.cs index ab275bb3..3e264b37 100644 --- a/test/Dapr.Actors.Test/Description/InterfaceDescriptionTests.cs +++ b/test/Dapr.Actors.Test/Description/InterfaceDescriptionTests.cs @@ -63,7 +63,7 @@ public void InterfaceDescription_CreateThrowsArgumentException_WhenTypeIsGeneric // Assert var exception = Should.Throw(action); - exception.Message.ShouldBe("The actor interface '*+IGenericActor`1' is using generics. Generic interfaces cannot be remoted.*"); + exception.Message.ShouldMatch(@"The actor interface '.*\+IGenericActor`1' is using generics. Generic interfaces cannot be remoted.*"); exception.ParamName.ShouldBe("actorInterfaceType"); } @@ -78,7 +78,7 @@ public void InterfaceDescription_CreateThrowsArgumentException_WhenTypeIsGeneric // Assert var exception = Should.Throw(action); - exception.Message.ShouldBe("The actor interface '*+IGenericActor`1[*IActor*]' is using generics. Generic interfaces cannot be remoted.*"); + exception.Message.ShouldMatch(@"The actor interface '.*\+IGenericActor`1\[.*IActor.*\]' is using generics. Generic interfaces cannot be remoted.*"); exception.ParamName.ShouldBe("actorInterfaceType"); } @@ -93,7 +93,7 @@ public void InterfaceDescription_CreateGeneratesMethodDescriptions_WhenTypeHasTa // Assert description.Methods.ShouldNotBeNull(); - description.Methods.ShouldBeOfType(); + description.Methods.ShouldBeOfType(); description.Methods.ShouldBeEquivalentTo( new { Name = "GetInt" } ); @@ -110,7 +110,7 @@ public void InterfaceDescription_CreateGeneratesMethodDescriptions_WhenTypeHasVo // Assert description.Methods.ShouldNotBeNull(); - description.Methods.ShouldBeOfType(); + description.Methods.ShouldBeOfType(); description.Methods.ShouldBeEquivalentTo(new[] { new { Name = "GetString" }, new { Name = "MethodWithArguments" } }); } @@ -128,8 +128,7 @@ public void InterfaceDescription_CreateThrowsArgumentException_WhenMethodsAreNot // Assert var exception = Should.Throw(action); - exception.Message.ShouldBe( - "Method 'GetString' of actor interface '*+IVoidActor' does not return Task or Task<>. The actor interface methods must be async and must return either Task or Task<>.*"); + exception.Message.ShouldMatch(@"Method 'GetString' of actor interface '.*\+IVoidActor' does not return Task or Task<>. The actor interface methods must be async and must return either Task or Task<>.*"); exception.ParamName.ShouldBe("actorInterfaceType"); } @@ -144,7 +143,7 @@ public void InterfaceDescription_CreateThrowsArgumentException_WhenMethodsAreNot // Assert var exception = Should.Throw(action); - exception.Message.ShouldBe("Method 'GetString' of actor interface '*+IMethodActor' returns '*.Task`1[*System.String*]'*"); + exception.Message.ShouldMatch(@"Method 'GetString' of actor interface '.*\+IMethodActor' returns '.*\.Task`1\[.*System.String.*\]'.*"); exception.ParamName.ShouldBe("actorInterfaceType"); } @@ -159,7 +158,7 @@ public void InterfaceDescription_CreateThrowsArgumentException_WhenMethodsAreOve // Assert var exception = Should.Throw(action); - exception.Message.ShouldBe("Method 'GetString' of actor interface '*+IOverloadedMethodActor' is overloaded. The actor interface methods cannot be overloaded.*"); + exception.Message.ShouldMatch(@"Method 'GetString' of actor interface '.*\+IOverloadedMethodActor' is overloaded. The actor interface methods cannot be overloaded.*"); exception.ParamName.ShouldBe("actorInterfaceType"); } @@ -174,7 +173,7 @@ public void InterfaceDescription_CreateThrowsArgumentException_WhenMethodIsGener // Assert var exception = Should.Throw(action); - exception.Message.ShouldBe("Method 'Get' of actor interface '*+IGenericMethodActor' is using generics. The actor interface methods cannot use generics.*"); + exception.Message.ShouldMatch(@"Method 'Get' of actor interface '.*\+IGenericMethodActor' is using generics. The actor interface methods cannot use generics.*"); exception.ParamName.ShouldBe("actorInterfaceType"); } @@ -189,7 +188,7 @@ public void InterfaceDescription_CreateThrowsArgumentException_WhenMethodHasVari // Assert var exception = Should.Throw(action); - exception.Message.ShouldBe("Method 'MethodWithVarArgs' of actor interface '*+IVariableActor' is using a variable argument list. The actor interface methods cannot have a variable argument list.*"); + exception.Message.ShouldMatch(@"Method 'MethodWithVarArgs' of actor interface '.*\+IVariableActor' is using a variable argument list. The actor interface methods cannot have a variable argument list.*"); exception.ParamName.ShouldBe("actorInterfaceType"); }