質問編集履歴
1
コードの記述方法についてご指摘をいただいたため、修正しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,198 @@
|
|
1
|
+
```ここに言語を入力
|
2
|
+
|
3
|
+
using System;
|
4
|
+
|
5
|
+
using System.Collections.Specialized;
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
namespace CommonTest
|
10
|
+
|
11
|
+
{
|
12
|
+
|
13
|
+
[TestClass()]
|
14
|
+
|
15
|
+
public class ConfigUtilTest
|
16
|
+
|
17
|
+
{
|
18
|
+
|
19
|
+
private TestContext testContextInstance;
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
private TestContext TestContext
|
24
|
+
|
25
|
+
{
|
26
|
+
|
27
|
+
get
|
28
|
+
|
29
|
+
{
|
30
|
+
|
31
|
+
return testContextInstance;
|
32
|
+
|
33
|
+
}
|
34
|
+
|
35
|
+
set
|
36
|
+
|
37
|
+
{
|
38
|
+
|
39
|
+
testContextInstance = value;
|
40
|
+
|
41
|
+
}
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
[TestMethod()]
|
48
|
+
|
49
|
+
public void GetSettingsTest()
|
50
|
+
|
51
|
+
{
|
52
|
+
|
53
|
+
Assert.AreEqual("Value1", ConfigUtil.GetSettings("testSettings", "Key1"), "Key1");
|
54
|
+
|
55
|
+
Assert.AreEqual("Value2", ConfigUtil.GetSettings("testSettings", "Key2"), "Key2");
|
56
|
+
|
57
|
+
Assert.IsNull(ConfigUtil.GetSettings("testSettings", "Key3"));
|
58
|
+
|
59
|
+
Assert.IsNull(ConfigUtil.GetSettings("aaa", "Key1"));
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
Assert.AreEqual("ValueA", ConfigUtil.GetSettings("KeyA"), "KeyA");
|
64
|
+
|
65
|
+
Assert.IsNull(ConfigUtil.GetSettings("KeyB"));
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
}
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
[TestMethod()]
|
74
|
+
|
75
|
+
public void GetSectionTest()
|
76
|
+
|
77
|
+
{
|
78
|
+
|
79
|
+
Assert.IsNull(ConfigUtil.GetSection(null), "セクションキーがnull");
|
80
|
+
|
81
|
+
Assert.IsNotNull(ConfigUtil.GetSection("testSettings"), "セクションキーがnullでない");
|
82
|
+
|
83
|
+
}
|
84
|
+
|
85
|
+
}
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
internal class TestContext
|
90
|
+
|
91
|
+
{
|
92
|
+
|
93
|
+
}
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
class TestClassAttribute : Attribute
|
98
|
+
|
99
|
+
{
|
100
|
+
|
101
|
+
}
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
class TestMethodAttribute : Attribute
|
106
|
+
|
107
|
+
{
|
108
|
+
|
109
|
+
}
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
class Assert
|
114
|
+
|
115
|
+
{
|
116
|
+
|
117
|
+
internal static void AreEqual(string v1, object p, string v2)
|
118
|
+
|
119
|
+
{
|
120
|
+
|
121
|
+
throw new NotImplementedException();
|
122
|
+
|
123
|
+
}
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
internal static void IsNotNull(object v1, string v2)
|
128
|
+
|
129
|
+
{
|
130
|
+
|
131
|
+
throw new NotImplementedException();
|
132
|
+
|
133
|
+
}
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
internal static void IsNull(object v)
|
138
|
+
|
139
|
+
{
|
140
|
+
|
141
|
+
throw new NotImplementedException();
|
142
|
+
|
143
|
+
}
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
internal static void IsNull(object v1, string v2)
|
148
|
+
|
149
|
+
{
|
150
|
+
|
151
|
+
throw new NotImplementedException();
|
152
|
+
|
153
|
+
}
|
154
|
+
|
155
|
+
}
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
class ConfigUtil
|
160
|
+
|
161
|
+
{
|
162
|
+
|
163
|
+
internal static object GetSection(object p)
|
164
|
+
|
165
|
+
{
|
166
|
+
|
167
|
+
throw new NotImplementedException();
|
168
|
+
|
169
|
+
}
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
internal static object GetSettings(string v1, string v2)
|
174
|
+
|
175
|
+
{
|
176
|
+
|
177
|
+
throw new NotImplementedException();
|
178
|
+
|
179
|
+
}
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
internal static object GetSettings(string v)
|
184
|
+
|
185
|
+
{
|
186
|
+
|
187
|
+
throw new NotImplementedException();
|
188
|
+
|
189
|
+
}
|
190
|
+
|
191
|
+
}
|
192
|
+
|
193
|
+
}
|
194
|
+
|
1
|
-
### 前提・実現したいこと
|
195
|
+
``````### 前提・実現したいこと
|
2
196
|
|
3
197
|
|
4
198
|
|
@@ -32,198 +226,6 @@
|
|
32
226
|
|
33
227
|
|
34
228
|
|
35
|
-
using System;
|
36
|
-
|
37
|
-
using System.Collections.Specialized;
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
namespace CommonTest
|
42
|
-
|
43
|
-
{
|
44
|
-
|
45
|
-
[TestClass()]
|
46
|
-
|
47
|
-
public class ConfigUtilTest
|
48
|
-
|
49
|
-
{
|
50
|
-
|
51
|
-
private TestContext testContextInstance;
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
private TestContext TestContext
|
56
|
-
|
57
|
-
{
|
58
|
-
|
59
|
-
get
|
60
|
-
|
61
|
-
{
|
62
|
-
|
63
|
-
return testContextInstance;
|
64
|
-
|
65
|
-
}
|
66
|
-
|
67
|
-
set
|
68
|
-
|
69
|
-
{
|
70
|
-
|
71
|
-
testContextInstance = value;
|
72
|
-
|
73
|
-
}
|
74
|
-
|
75
|
-
}
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
[TestMethod()]
|
80
|
-
|
81
|
-
public void GetSettingsTest()
|
82
|
-
|
83
|
-
{
|
84
|
-
|
85
|
-
Assert.AreEqual("Value1", ConfigUtil.GetSettings("testSettings", "Key1"), "Key1");
|
86
|
-
|
87
|
-
Assert.AreEqual("Value2", ConfigUtil.GetSettings("testSettings", "Key2"), "Key2");
|
88
|
-
|
89
|
-
Assert.IsNull(ConfigUtil.GetSettings("testSettings", "Key3"));
|
90
|
-
|
91
|
-
Assert.IsNull(ConfigUtil.GetSettings("aaa", "Key1"));
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
Assert.AreEqual("ValueA", ConfigUtil.GetSettings("KeyA"), "KeyA");
|
96
|
-
|
97
|
-
Assert.IsNull(ConfigUtil.GetSettings("KeyB"));
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
}
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
[TestMethod()]
|
106
|
-
|
107
|
-
public void GetSectionTest()
|
108
|
-
|
109
|
-
{
|
110
|
-
|
111
|
-
Assert.IsNull(ConfigUtil.GetSection(null), "セクションキーがnull");
|
112
|
-
|
113
|
-
Assert.IsNotNull(ConfigUtil.GetSection("testSettings"), "セクションキーがnullでない");
|
114
|
-
|
115
|
-
}
|
116
|
-
|
117
|
-
}
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
internal class TestContext
|
122
|
-
|
123
|
-
{
|
124
|
-
|
125
|
-
}
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
class TestClassAttribute : Attribute
|
130
|
-
|
131
|
-
{
|
132
|
-
|
133
|
-
}
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
class TestMethodAttribute : Attribute
|
138
|
-
|
139
|
-
{
|
140
|
-
|
141
|
-
}
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
class Assert
|
146
|
-
|
147
|
-
{
|
148
|
-
|
149
|
-
internal static void AreEqual(string v1, object p, string v2)
|
150
|
-
|
151
|
-
{
|
152
|
-
|
153
|
-
throw new NotImplementedException();
|
154
|
-
|
155
|
-
}
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
internal static void IsNotNull(object v1, string v2)
|
160
|
-
|
161
|
-
{
|
162
|
-
|
163
|
-
throw new NotImplementedException();
|
164
|
-
|
165
|
-
}
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
internal static void IsNull(object v)
|
170
|
-
|
171
|
-
{
|
172
|
-
|
173
|
-
throw new NotImplementedException();
|
174
|
-
|
175
|
-
}
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
internal static void IsNull(object v1, string v2)
|
180
|
-
|
181
|
-
{
|
182
|
-
|
183
|
-
throw new NotImplementedException();
|
184
|
-
|
185
|
-
}
|
186
|
-
|
187
|
-
}
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
class ConfigUtil
|
192
|
-
|
193
|
-
{
|
194
|
-
|
195
|
-
internal static object GetSection(object p)
|
196
|
-
|
197
|
-
{
|
198
|
-
|
199
|
-
throw new NotImplementedException();
|
200
|
-
|
201
|
-
}
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
internal static object GetSettings(string v1, string v2)
|
206
|
-
|
207
|
-
{
|
208
|
-
|
209
|
-
throw new NotImplementedException();
|
210
|
-
|
211
|
-
}
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
internal static object GetSettings(string v)
|
216
|
-
|
217
|
-
{
|
218
|
-
|
219
|
-
throw new NotImplementedException();
|
220
|
-
|
221
|
-
}
|
222
|
-
|
223
|
-
}
|
224
|
-
|
225
|
-
}
|
226
|
-
|
227
229
|
|
228
230
|
|
229
231
|
```
|