|
6 | 6 | using BenchmarkDotNet.Validators;
|
7 | 7 | using Xunit;
|
8 | 8 | using Xunit.Abstractions;
|
| 9 | +#pragma warning disable CS0414 |
9 | 10 |
|
10 | 11 | namespace BenchmarkDotNet.Tests.Validators
|
11 | 12 | {
|
12 | 13 | [SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
|
13 | 14 | [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
| 15 | + [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Local")] |
14 | 16 | public class ParamsValidatorTests
|
15 | 17 | {
|
16 | 18 | private readonly ITestOutputHelper output;
|
@@ -56,6 +58,18 @@ private void Check<T>(params string[] messageParts)
|
56 | 58 | [Fact] public void PropMultiple2Test() => Check<PropMultiple2>(nameof(PropMultiple2.Input), "single attribute", P, Ps);
|
57 | 59 | [Fact] public void PropMultiple3Test() => Check<PropMultiple3>(nameof(PropMultiple3.Input), "single attribute", Pa, Ps);
|
58 | 60 | [Fact] public void PropMultiple4Test() => Check<PropMultiple4>(nameof(PropMultiple4.Input), "single attribute", P, Pa, Ps);
|
| 61 | + [Fact] public void PrivateSetter1Test() => Check<PrivateSetter1>(nameof(PrivateSetter1.Input), "setter is not public", P); |
| 62 | + [Fact] public void PrivateSetter2Test() => Check<PrivateSetter2>(nameof(PrivateSetter2.Input), "setter is not public", Pa); |
| 63 | + [Fact] public void PrivateSetter3Test() => Check<PrivateSetter3>(nameof(PrivateSetter3.Input), "setter is not public", Ps); |
| 64 | + [Fact] public void NoSetter1Test() => Check<NoSetter1>(nameof(NoSetter1.Input), "no setter", P); |
| 65 | + [Fact] public void NoSetter2Test() => Check<NoSetter2>(nameof(NoSetter2.Input), "no setter", Pa); |
| 66 | + [Fact] public void NoSetter3Test() => Check<NoSetter3>(nameof(NoSetter3.Input), "no setter", Ps); |
| 67 | + [Fact] public void InternalField1Test() => Check<InternalField1>(nameof(InternalField1.Input), "it's not public", P); |
| 68 | + [Fact] public void InternalField2Test() => Check<InternalField2>(nameof(InternalField2.Input), "it's not public", Pa); |
| 69 | + [Fact] public void InternalField3Test() => Check<InternalField3>(nameof(InternalField3.Input), "it's not public", Ps); |
| 70 | + [Fact] public void InternalProp1Test() => Check<InternalProp1>(nameof(InternalProp1.Input), "setter is not public", P); |
| 71 | + [Fact] public void InternalProp2Test() => Check<InternalProp2>(nameof(InternalProp2.Input), "setter is not public", Pa); |
| 72 | + [Fact] public void InternalProp3Test() => Check<InternalProp3>(nameof(InternalProp3.Input), "setter is not public", Ps); |
59 | 73 |
|
60 | 74 | public class Base
|
61 | 75 | {
|
@@ -119,6 +133,78 @@ public class NonStaticReadonly3 : Base
|
119 | 133 | public readonly bool Input = false;
|
120 | 134 | }
|
121 | 135 |
|
| 136 | + public class PrivateSetter1 : Base |
| 137 | + { |
| 138 | + [Params(false, true)] |
| 139 | + public bool Input { get; private set; } |
| 140 | + } |
| 141 | + |
| 142 | + public class PrivateSetter2 : Base |
| 143 | + { |
| 144 | + [ParamsAllValues] |
| 145 | + public bool Input { get; private set; } |
| 146 | + } |
| 147 | + |
| 148 | + public class PrivateSetter3 : Base |
| 149 | + { |
| 150 | + [ParamsSource(nameof(Source))] |
| 151 | + public bool Input { get; private set; } |
| 152 | + } |
| 153 | + |
| 154 | + public class NoSetter1 : Base |
| 155 | + { |
| 156 | + [Params(false, true)] |
| 157 | + public bool Input { get; } = false; |
| 158 | + } |
| 159 | + |
| 160 | + public class NoSetter2 : Base |
| 161 | + { |
| 162 | + [ParamsAllValues] |
| 163 | + public bool Input { get; } = false; |
| 164 | + } |
| 165 | + |
| 166 | + public class NoSetter3 : Base |
| 167 | + { |
| 168 | + [ParamsSource(nameof(Source))] |
| 169 | + public bool Input { get; } = false; |
| 170 | + } |
| 171 | + |
| 172 | + public class InternalField1 : Base |
| 173 | + { |
| 174 | + [Params(false, true)] |
| 175 | + internal bool Input = false; |
| 176 | + } |
| 177 | + |
| 178 | + public class InternalField2 : Base |
| 179 | + { |
| 180 | + [ParamsAllValues] |
| 181 | + internal bool Input = false; |
| 182 | + } |
| 183 | + |
| 184 | + public class InternalField3 : Base |
| 185 | + { |
| 186 | + [ParamsSource(nameof(Source))] |
| 187 | + internal bool Input = false; |
| 188 | + } |
| 189 | + |
| 190 | + public class InternalProp1 : Base |
| 191 | + { |
| 192 | + [Params(false, true)] |
| 193 | + internal bool Input { get; set; } |
| 194 | + } |
| 195 | + |
| 196 | + public class InternalProp2 : Base |
| 197 | + { |
| 198 | + [ParamsAllValues] |
| 199 | + internal bool Input { get; set; } |
| 200 | + } |
| 201 | + |
| 202 | + public class InternalProp3 : Base |
| 203 | + { |
| 204 | + [ParamsSource(nameof(Source))] |
| 205 | + internal bool Input { get; set; } |
| 206 | + } |
| 207 | + |
122 | 208 | public class FieldMultiple1 : Base
|
123 | 209 | {
|
124 | 210 | [Params(false, true)]
|
|
0 commit comments