forked from microsoft/ClearScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBaseTestObject.cs
166 lines (131 loc) · 8.19 KB
/
BaseTestObject.cs
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using System.Diagnostics.CodeAnalysis;
namespace Microsoft.ClearScript.Test
{
public class BaseTestObject : IBaseTestInterface, IExplicitBaseTestInterface
{
public int[] BaseField;
public short BaseScalarField;
public TestEnum BaseEnumField;
public TimeSpan BaseStructField;
public int[] BaseProperty { get; set; }
public short BaseScalarProperty { get; set; }
public TestEnum BaseEnumProperty { get; set; }
public TimeSpan BaseStructProperty { get; set; }
public byte BaseReadOnlyProperty => 117;
public event EventHandler<TestEventArgs<short>> BaseEvent;
public void BaseFireEvent(short arg)
{
BaseEvent?.Invoke(this, new TestEventArgs<short> { Arg = arg });
}
public double BaseMethod(string arg1, int arg2)
{
return TestUtil.CalcTestValue(new Guid("d5114f53-ca6a-4993-8117-7f8194088c08"), this, arg1.Length, arg2);
}
public double BaseMethod<T>(string arg1, int arg2, T arg3) where T : struct
{
return TestUtil.CalcTestValue(new Guid("d18ddd76-a035-44b4-b18b-7c4c7d313c4f"), this, arg1.Length, arg2, arg3.ToString().Length);
}
public double BaseMethod<T>(int arg) where T : struct
{
return TestUtil.CalcTestValue(new Guid("53b0fe2a-6b7c-4516-93de-db706b1bf1bb"), this, typeof(T).Name.Length, arg);
}
public double BaseBindTestMethod<T>(T arg)
{
return TestUtil.CalcTestValue(new Guid("c0f52143-a775-4b71-b206-a759285a35a5"), this, typeof(T), arg);
}
#region IBaseTestInterface implementation
public int[] BaseInterfaceProperty { get; set; }
public short BaseInterfaceScalarProperty { get; set; }
public TestEnum BaseInterfaceEnumProperty { get; set; }
public TimeSpan BaseInterfaceStructProperty { get; set; }
public byte BaseInterfaceReadOnlyProperty => 73;
public event EventHandler<TestEventArgs<short>> BaseInterfaceEvent;
public void BaseInterfaceFireEvent(short arg)
{
BaseInterfaceEvent?.Invoke(this, new TestEventArgs<short> { Arg = arg });
}
public double BaseInterfaceMethod(string arg1, int arg2)
{
return TestUtil.CalcTestValue(new Guid("f58f24cd-1d08-4224-bf78-7dcdb01b733f"), this, arg1.Length, arg2);
}
public double BaseInterfaceMethod<T>(string arg1, int arg2, T arg3) where T : struct
{
return TestUtil.CalcTestValue(new Guid("73cd3acf-3c94-4993-8786-70ba0f86f1a7"), this, arg1.Length, arg2, arg3.ToString().Length);
}
public double BaseInterfaceMethod<T>(int arg) where T : struct
{
return TestUtil.CalcTestValue(new Guid("28cf53e3-6422-4ac8-82d6-0d3d00e7bc1d"), this, typeof(T).Name.Length, arg);
}
public double BaseInterfaceBindTestMethod<T>(T arg)
{
return TestUtil.CalcTestValue(new Guid("302f0d74-7ee8-4e0c-b383-7816d79a889b"), this, typeof(T), arg);
}
#endregion
#region IExplicitBaseTestInterface implementation
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Justification = "This member requires explicit implementation for testing purposes.")]
int[] IExplicitBaseTestInterface.ExplicitBaseInterfaceProperty { get; set; }
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Justification = "This member requires explicit implementation for testing purposes.")]
short IExplicitBaseTestInterface.ExplicitBaseInterfaceScalarProperty { get; set; }
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Justification = "This member requires explicit implementation for testing purposes.")]
TestEnum IExplicitBaseTestInterface.ExplicitBaseInterfaceEnumProperty { get; set; }
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Justification = "This member requires explicit implementation for testing purposes.")]
TimeSpan IExplicitBaseTestInterface.ExplicitBaseInterfaceStructProperty { get; set; }
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Justification = "This member requires explicit implementation for testing purposes.")]
byte IExplicitBaseTestInterface.ExplicitBaseInterfaceReadOnlyProperty => 17;
private event EventHandler<TestEventArgs<short>> ExplicitBaseInterfaceEventImpl;
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Justification = "This member requires explicit implementation for testing purposes.")]
event EventHandler<TestEventArgs<short>> IExplicitBaseTestInterface.ExplicitBaseInterfaceEvent
{
add => ExplicitBaseInterfaceEventImpl += value;
remove => ExplicitBaseInterfaceEventImpl -= value;
}
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Justification = "This member requires explicit implementation for testing purposes.")]
void IExplicitBaseTestInterface.ExplicitBaseInterfaceFireEvent(short arg)
{
ExplicitBaseInterfaceEventImpl?.Invoke(this, new TestEventArgs<short> { Arg = arg });
}
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Justification = "This member requires explicit implementation for testing purposes.")]
double IExplicitBaseTestInterface.ExplicitBaseInterfaceMethod(string arg1, int arg2)
{
return TestUtil.CalcTestValue(new Guid("354a43bc-7d15-4aeb-b4c9-c6e03893c5f2"), this, arg1.Length, arg2);
}
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Justification = "This member requires explicit implementation for testing purposes.")]
double IExplicitBaseTestInterface.ExplicitBaseInterfaceMethod<T>(string arg1, int arg2, T arg3)
{
return TestUtil.CalcTestValue(new Guid("b6496578-af16-4424-b16b-808de442d9e3"), this, arg1.Length, arg2, arg3.ToString().Length);
}
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Justification = "This member requires explicit implementation for testing purposes.")]
double IExplicitBaseTestInterface.ExplicitBaseInterfaceMethod<T>(int arg)
{
return TestUtil.CalcTestValue(new Guid("b9810875-3ccf-400f-b106-d2869905f9bc"), this, typeof(T).Name.Length, arg);
}
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Justification = "This member requires explicit implementation for testing purposes.")]
double IExplicitBaseTestInterface.ExplicitBaseInterfaceBindTestMethod<T>(T arg)
{
return TestUtil.CalcTestValue(new Guid("5937707d-9158-4d72-986b-8eb13da5c079"), this, typeof(T), arg);
}
#endregion
}
public static class BaseTestObjectExtensions
{
public static double BaseExtensionMethod(this BaseTestObject self, string arg1, int arg2)
{
return TestUtil.CalcTestValue(new Guid("ffac885b-0e3b-4438-99e1-64f4d2c6f769"), self, arg1.Length, arg2);
}
public static double BaseExtensionMethod<T>(this BaseTestObject self, string arg1, int arg2, T arg3) where T : struct
{
return TestUtil.CalcTestValue(new Guid("6ee07aa3-4548-4d59-b7d6-77725bb2c900"), self, arg1.Length, arg2, arg3.ToString().Length);
}
public static double BaseExtensionMethod<T>(this BaseTestObject self, int arg) where T : struct
{
return TestUtil.CalcTestValue(new Guid("2db0feaf-8618-4676-a7ba-552a20853fcd"), self, typeof(T).Name.Length, arg);
}
public static double BaseExtensionBindTestMethod<T>(this BaseTestObject self, T arg)
{
return TestUtil.CalcTestValue(new Guid("fdef26a4-2155-4be5-a245-4810ae66c491"), self, typeof(T), arg);
}
}
}