-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTestInterfacesMethods.cs
More file actions
55 lines (45 loc) · 1.99 KB
/
TestInterfacesMethods.cs
File metadata and controls
55 lines (45 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
namespace Nahoum.UnityJSInterop.Tests
{
public class TestClassImplementingInterface : ITestInterface
{
[ExposeWeb]
/// <summary>
/// Tests that even though the method is not directly exposed, it may be used because the interface exposes it
/// </summary>
public string TestGetStringFromClass() => SampleValues.TestString;
/// <summary>
/// Exposed method from the interface - Also need to add the attribute here for safety
/// </summary>
[ExposeWeb]
public string TestGetStringFromInterfaceDeclaration() => SampleValues.TestString;
/// <summary>
/// Gets the interface instance
/// </summary>
[ExposeWeb] public static ITestInterface GetNewInstanceOfInterface() => new TestClassImplementingInterface();
[ExposeWeb]
/// <summary>
/// This one is not exposed, but it is used by the interface
/// </summary>
public float GetSampleFloat() => SampleValues.TestFloat;
[ExposeWeb]
public string TestGetStringFromInterface() => SampleValues.TestString2;
}
[ExposeWeb]
public interface ITestInterface
{
/// <summary>
/// Test returning a string (direct interface implementation / aka c# feature) on static
/// </summary>
public static string TestGetStringFromInterfaceStatic() => SampleValues.TestString;
/// <summary>
/// Test what it gives to exposeweb on the interface but not on the implementation
/// </summary>
public float GetSampleFloat();
/// <summary>
/// Test returning a string (direct interface implementation / aka c# feature) on any instance
/// This WONT work as it is not static, and that's ok - it's just a test to ensure it doesn't bug on generation but is just ignored
/// </summary>
public string TestGetStringFromInterface() => SampleValues.TestString;
public string TestGetStringFromInterfaceDeclaration();
}
}