From 255affb4487ac2c21c6dc42750ef14bf1fe248e5 Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Mon, 23 Mar 2015 12:40:20 +0100 Subject: [PATCH] Test that we can call ReturnParameter on C# events. --- tests/service/CSharpProjectAnalysis.fs | 14 ++++++++++++++ tests/service/data/CSharp_Analysis/CSharpClass.cs | 13 +++++++++++++ 2 files changed, 27 insertions(+) diff --git a/tests/service/CSharpProjectAnalysis.fs b/tests/service/CSharpProjectAnalysis.fs index b15e8a1415..e8c3b246d7 100644 --- a/tests/service/CSharpProjectAnalysis.fs +++ b/tests/service/CSharpProjectAnalysis.fs @@ -87,5 +87,19 @@ let ``Test that csharp references are recognized as such`` () = //String.IsNullOrWhiteSpace(members.["InterfaceEvent"].XmlDocSig) |> shouldEqual false () + | None -> + Assert.Fail ("CSharpClass was not found in CSharp_Analysis assembly!") + + + match ass.Contents.Entities |> Seq.tryFind (fun e -> e.DisplayName = "CustomEventClass") with + | Some found -> + // this is no F# thing + found.IsFSharp |> shouldEqual false + + let members = found.MembersFunctionsAndValues |> Seq.map (fun e -> e.CompiledName, e) |> dict + members.ContainsKey "OnWorklistTextRequested" |> shouldEqual true + let ev = members.["OnWorklistTextRequested"] + ev.IsEvent |> should be True + obj.ReferenceEquals(ev.ReturnParameter, null) |> should be False | None -> Assert.Fail ("CSharpClass was not found in CSharp_Analysis assembly!") \ No newline at end of file diff --git a/tests/service/data/CSharp_Analysis/CSharpClass.cs b/tests/service/data/CSharp_Analysis/CSharpClass.cs index 46f2b9fa46..2e030c9e45 100644 --- a/tests/service/data/CSharp_Analysis/CSharpClass.cs +++ b/tests/service/data/CSharp_Analysis/CSharpClass.cs @@ -87,4 +87,17 @@ event EventHandler ICSharpExplicitInterface.ExplicitEvent remove { throw new NotImplementedException(); } } } + + public class CustomEventClass + { + + /// + /// Event triggered when WorklistText is required + /// + [System.Runtime.InteropServices.ComVisible(false)] + public delegate void WorklistTextRequested(int medicalRecordId, string accessionNo, + int templateId, string specificationCode, string specificationText, string aeTitle); + + public event WorklistTextRequested OnWorklistTextRequested; + } }