Skip to content

Commit

Permalink
Fixed additional 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 18, 2025
1 parent 36d22c0 commit dbf242a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void ActorInterfaceDescription_CreateThrowsArgumentException_WhenTypeIsNo

// Assert
var exception = Should.Throw<ArgumentException>(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");
}

Expand All @@ -64,7 +64,7 @@ public void ActorInterfaceDescription_CreateThrowsArgumentException_WhenTypeIsNo

// Assert
var exception = Should.Throw<ArgumentException>(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");
}

Expand All @@ -79,7 +79,7 @@ public void ActorInterfaceDescription_CreateThrowsArgumentException_WhenActorInt

// Assert
var exception = Should.Throw<ArgumentException>(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");
}

Expand Down Expand Up @@ -112,7 +112,7 @@ public void ActorInterfaceDescription_CreateUsingCRCIdThrowsArgumentException_Wh

// Assert
var exception = Should.Throw<ArgumentException>(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");
}

Expand All @@ -127,7 +127,7 @@ public void ActorInterfaceDescription_CreateUsingCRCIdThrowsArgumentException_Wh

// Assert
var exception = Should.Throw<ArgumentException>(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");
}

Expand All @@ -142,7 +142,7 @@ public void ActorInterfaceDescription_CreateUsingCRCIdThrowsArgumentException_Wh

// Assert
var exception = Should.Throw<ArgumentException>(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");
}

Expand Down
19 changes: 9 additions & 10 deletions test/Dapr.Actors.Test/Description/InterfaceDescriptionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void InterfaceDescription_CreateThrowsArgumentException_WhenTypeIsGeneric

// Assert
var exception = Should.Throw<ArgumentException>(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");
}

Expand All @@ -78,7 +78,7 @@ public void InterfaceDescription_CreateThrowsArgumentException_WhenTypeIsGeneric

// Assert
var exception = Should.Throw<ArgumentException>(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");
}

Expand All @@ -93,7 +93,7 @@ public void InterfaceDescription_CreateGeneratesMethodDescriptions_WhenTypeHasTa

// Assert
description.Methods.ShouldNotBeNull();
description.Methods.ShouldBeOfType<MethodDescription>();
description.Methods.ShouldBeOfType<MethodDescription[]>();
description.Methods.ShouldBeEquivalentTo(

Check failure on line 97 in test/Dapr.Actors.Test/Description/InterfaceDescriptionTests.cs

View workflow job for this annotation

GitHub Actions / Test .NET 9.0

Dapr.Actors.Description.InterfaceDescriptionTests.InterfaceDescription_CreateGeneratesMethodDescriptions_WhenTypeHasTaskMethods_ButDoesNotSeeInheritedMethods: Shouldly.ShouldAssertException : Comparing object equivalence, at path:

Check failure on line 97 in test/Dapr.Actors.Test/Description/InterfaceDescriptionTests.cs

View workflow job for this annotation

GitHub Actions / Test .NET 8.0

Dapr.Actors.Description.InterfaceDescriptionTests.InterfaceDescription_CreateGeneratesMethodDescriptions_WhenTypeHasTaskMethods_ButDoesNotSeeInheritedMethods: Shouldly.ShouldAssertException : Comparing object equivalence, at path:

Check failure on line 97 in test/Dapr.Actors.Test/Description/InterfaceDescriptionTests.cs

View workflow job for this annotation

GitHub Actions / Test .NET 6.0

Dapr.Actors.Description.InterfaceDescriptionTests.InterfaceDescription_CreateGeneratesMethodDescriptions_WhenTypeHasTaskMethods_ButDoesNotSeeInheritedMethods: Shouldly.ShouldAssertException : Comparing object equivalence, at path:

Check failure on line 97 in test/Dapr.Actors.Test/Description/InterfaceDescriptionTests.cs

View workflow job for this annotation

GitHub Actions / Test .NET 7.0

Dapr.Actors.Description.InterfaceDescriptionTests.InterfaceDescription_CreateGeneratesMethodDescriptions_WhenTypeHasTaskMethods_ButDoesNotSeeInheritedMethods: Shouldly.ShouldAssertException : Comparing object equivalence, at path:
new { Name = "GetInt" }
);
Expand All @@ -110,7 +110,7 @@ public void InterfaceDescription_CreateGeneratesMethodDescriptions_WhenTypeHasVo

// Assert
description.Methods.ShouldNotBeNull();
description.Methods.ShouldBeOfType<MethodDescription>();
description.Methods.ShouldBeOfType<MethodDescription[]>();
description.Methods.ShouldBeEquivalentTo(new[] { new { Name = "GetString" }, new { Name = "MethodWithArguments" } });

Check failure on line 114 in test/Dapr.Actors.Test/Description/InterfaceDescriptionTests.cs

View workflow job for this annotation

GitHub Actions / Test .NET 9.0

Dapr.Actors.Description.InterfaceDescriptionTests.InterfaceDescription_CreateGeneratesMethodDescriptions_WhenTypeHasVoidMethods: Shouldly.ShouldAssertException : Comparing object equivalence, at path:

Check failure on line 114 in test/Dapr.Actors.Test/Description/InterfaceDescriptionTests.cs

View workflow job for this annotation

GitHub Actions / Test .NET 8.0

Dapr.Actors.Description.InterfaceDescriptionTests.InterfaceDescription_CreateGeneratesMethodDescriptions_WhenTypeHasVoidMethods: Shouldly.ShouldAssertException : Comparing object equivalence, at path:

Check failure on line 114 in test/Dapr.Actors.Test/Description/InterfaceDescriptionTests.cs

View workflow job for this annotation

GitHub Actions / Test .NET 6.0

Dapr.Actors.Description.InterfaceDescriptionTests.InterfaceDescription_CreateGeneratesMethodDescriptions_WhenTypeHasVoidMethods: Shouldly.ShouldAssertException : Comparing object equivalence, at path:

Check failure on line 114 in test/Dapr.Actors.Test/Description/InterfaceDescriptionTests.cs

View workflow job for this annotation

GitHub Actions / Test .NET 7.0

Dapr.Actors.Description.InterfaceDescriptionTests.InterfaceDescription_CreateGeneratesMethodDescriptions_WhenTypeHasVoidMethods: Shouldly.ShouldAssertException : Comparing object equivalence, at path:
}

Expand All @@ -128,8 +128,7 @@ public void InterfaceDescription_CreateThrowsArgumentException_WhenMethodsAreNot

// Assert
var exception = Should.Throw<ArgumentException>(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");
}

Expand All @@ -144,7 +143,7 @@ public void InterfaceDescription_CreateThrowsArgumentException_WhenMethodsAreNot

// Assert
var exception = Should.Throw<ArgumentException>(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");
}

Expand All @@ -159,7 +158,7 @@ public void InterfaceDescription_CreateThrowsArgumentException_WhenMethodsAreOve

// Assert
var exception = Should.Throw<ArgumentException>(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");
}

Expand All @@ -174,7 +173,7 @@ public void InterfaceDescription_CreateThrowsArgumentException_WhenMethodIsGener

// Assert
var exception = Should.Throw<ArgumentException>(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");
}

Expand All @@ -189,7 +188,7 @@ public void InterfaceDescription_CreateThrowsArgumentException_WhenMethodHasVari

// Assert
var exception = Should.Throw<ArgumentException>(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");
}

Expand Down

0 comments on commit dbf242a

Please sign in to comment.