Skip to content

Commit

Permalink
Test that we can call ReturnParameter on C# events.
Browse files Browse the repository at this point in the history
  • Loading branch information
matthid committed Mar 23, 2015
1 parent c2e3880 commit 255affb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/service/CSharpProjectAnalysis.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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!")
13 changes: 13 additions & 0 deletions tests/service/data/CSharp_Analysis/CSharpClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,17 @@ event EventHandler ICSharpExplicitInterface.ExplicitEvent
remove { throw new NotImplementedException(); }
}
}

public class CustomEventClass
{

/// <summary>
/// Event triggered when WorklistText is required
/// </summary>
[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;
}
}

0 comments on commit 255affb

Please sign in to comment.