diff --git a/src/embed_tests/TestMethodBinder.cs b/src/embed_tests/TestMethodBinder.cs index fa1a47db7..d2fd8b7a2 100644 --- a/src/embed_tests/TestMethodBinder.cs +++ b/src/embed_tests/TestMethodBinder.cs @@ -925,7 +925,12 @@ def call_method(instance): public class CSharpClass2 { - public string CalledMethodMessage { get; private set; } + public string CalledMethodMessage { get; private set; } = string.Empty; + + public void Clear() + { + CalledMethodMessage = string.Empty; + } public void Method() { @@ -967,6 +972,10 @@ public void PyObjectArgsHavePrecedenceOverOtherTypes() pyInstance.InvokeMethod("Method", pyArg); }); + Assert.AreEqual("Overload 4", instance.CalledMethodMessage); + Assert.IsFalse(Exceptions.ErrorOccurred()); + instance.Clear(); + // With the first named argument Assert.DoesNotThrow(() => { @@ -974,6 +983,10 @@ public void PyObjectArgsHavePrecedenceOverOtherTypes() pyInstance.InvokeMethod("Method", new[] { pyArg }, kwargs); }); + Assert.AreEqual("Overload 4", instance.CalledMethodMessage); + Assert.IsFalse(Exceptions.ErrorOccurred()); + instance.Clear(); + // Snake case version Assert.DoesNotThrow(() => { @@ -982,7 +995,6 @@ public void PyObjectArgsHavePrecedenceOverOtherTypes() }); Assert.AreEqual("Overload 4", instance.CalledMethodMessage); - Assert.IsFalse(Exceptions.ErrorOccurred()); }