|
14 | 14 |
|
15 | 15 | namespace BenchmarkDotNet.IntegrationTests |
16 | 16 | { |
17 | | - public class ParamSourceTests: BenchmarkTestExecutor |
| 17 | + public class ParamSourceTests : BenchmarkTestExecutor |
18 | 18 | { |
19 | 19 | public ParamSourceTests(ITestOutputHelper output) : base(output) { } |
20 | 20 |
|
@@ -204,5 +204,43 @@ public void SourceWithExplicitCastToTarget_InProcessToolchain_Throws() |
204 | 204 | // public void SourceWithExplicitCastToTarget_Succeeds(IToolchain toolchain) => CanExecuteWithExtraInfo(typeof(SourceWithExplicitCastToTarget), toolchain); |
205 | 205 | Assert.ThrowsAny<Exception>(() => CanExecuteWithExtraInfo(typeof(SourceWithExplicitCastToTarget), InProcessEmitToolchain.Instance)); |
206 | 206 | } |
| 207 | + |
| 208 | + public abstract class OverridePropertyBase |
| 209 | + { |
| 210 | + public abstract int[] GetSourceProperty { get; } |
| 211 | + |
| 212 | + [ParamsSource(nameof(GetSourceProperty))] |
| 213 | + public int ParamsTarget { get; set; } |
| 214 | + } |
| 215 | + |
| 216 | + public class OverrideProperty : OverridePropertyBase |
| 217 | + { |
| 218 | + public override int[] GetSourceProperty => new int[] { 1, 2, 3 }; |
| 219 | + |
| 220 | + [Benchmark] |
| 221 | + public int Benchmark() => ParamsTarget; |
| 222 | + } |
| 223 | + |
| 224 | + [Theory, MemberData(nameof(GetToolchains), DisableDiscoveryEnumeration = true)] |
| 225 | + public void OverrideProperty_Succeeds(IToolchain toolchain) => CanExecuteWithExtraInfo(typeof(OverrideProperty), toolchain); |
| 226 | + |
| 227 | + public abstract class OverrideMethodBase |
| 228 | + { |
| 229 | + public abstract int[] GetSourceMethod(); |
| 230 | + |
| 231 | + [ParamsSource(nameof(GetSourceMethod))] |
| 232 | + public int ParamsTarget { get; set; } |
| 233 | + } |
| 234 | + |
| 235 | + public class OverrideMethod : OverrideMethodBase |
| 236 | + { |
| 237 | + public override int[] GetSourceMethod() => new int[] { 1, 2, 3 }; |
| 238 | + |
| 239 | + [Benchmark] |
| 240 | + public int Benchmark() => ParamsTarget; |
| 241 | + } |
| 242 | + |
| 243 | + [Theory, MemberData(nameof(GetToolchains), DisableDiscoveryEnumeration = true)] |
| 244 | + public void OverrideMethod_Succeeds(IToolchain toolchain) => CanExecuteWithExtraInfo(typeof(OverrideMethod), toolchain); |
207 | 245 | } |
208 | 246 | } |
0 commit comments