Skip to content

Commit 954dbd5

Browse files
committed
Adding and improving GetPropertyListValueTaskTests tests
1 parent 34b8dff commit 954dbd5

File tree

1 file changed

+59
-44
lines changed

1 file changed

+59
-44
lines changed

tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GetPropertyListValueTaskTests.cs

Lines changed: 59 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
namespace Xamarin.MacDev.Tasks {
99
[TestFixture]
10-
public class GetPropertyListValueTaskTests : TestBase
11-
{
10+
public class GetPropertyListValueTaskTests : TestBase {
1211

1312
void TestExecuteTask (string property, string expected)
1413
{
@@ -133,75 +132,91 @@ public void TestGetDateProperty ()
133132
}
134133

135134
[Test]
136-
public void TestGetArrayIndexProperty ()
135+
public void TestGetArrayIndexOutOfBounds ()
137136
{
138-
for (var index = 0; index < 3; index++)
139-
{
140-
var property = $"KeyArray:{index}";
141-
var expected = $"Array Item {index}";
137+
var property = $"KeyArray:99";
142138

143-
TestExecuteTask (property, expected);
144-
}
139+
TestExecuteTask(property, null);
145140
}
146141

147142
[Test]
148-
public void TestGetArrayArrayIndexProperty ()
143+
[TestCase(0)]
144+
[TestCase(1)]
145+
[TestCase(2)]
146+
public void TestGetArrayIndexProperty (int index)
149147
{
150-
for (var index = 0; index < 3; index++)
151-
{
152-
var property = $"KeyArray:3:{index}";
153-
var expected = $"Array Array Item 3.{index}";
148+
var property = $"KeyArray:{index}";
149+
var expected = $"Array Item {index}";
154150

155-
TestExecuteTask (property, expected);
156-
}
151+
TestExecuteTask(property, expected);
157152
}
158153

159154
[Test]
160-
public void TestGetArrayDictionaryKeyProperty ()
155+
[TestCase(0)]
156+
[TestCase(1)]
157+
[TestCase(2)]
158+
public void TestGetArrayArrayIndexProperty (int index)
161159
{
162-
for (var index = 0; index < 3; index++)
163-
{
164-
var property = $"KeyArray:4:Item{index}";
165-
var expected = $"Array Dictionary Item 4.{index}";
160+
var property = $"KeyArray:3:{index}";
161+
var expected = $"Array Array Item 3.{index}";
166162

167-
TestExecuteTask (property, expected);
168-
}
163+
TestExecuteTask (property, expected);
169164
}
170165

171166
[Test]
172-
public void TestGetDictionaryKeyProperty ()
167+
[TestCase(0)]
168+
[TestCase(1)]
169+
[TestCase(2)]
170+
public void TestGetArrayDictionaryKeyProperty (int index)
173171
{
174-
for (var index = 0; index < 3; index++)
175-
{
176-
var property = $"KeyDictionary:Item{index}";
177-
var expected = $"Dictionary Item {index}";
172+
var property = $"KeyArray:4:Item{index}";
173+
var expected = $"Array Dictionary Item 4.{index}";
178174

179-
TestExecuteTask (property, expected);
180-
}
175+
TestExecuteTask (property, expected);
181176
}
182177

183178
[Test]
184-
public void TestGetDictionaryDictionaryKeyProperty ()
179+
public void TestGetDictionaryKeyNotFound ()
185180
{
186-
for (var index = 0; index < 3; index++)
187-
{
188-
var property = $"KeyDictionary:Item3:Item{index}";
189-
var expected = $"Dictionary Dictionary Item 3.{index}";
181+
var property = $"KeyDictionary:ItemKeyNotFound";
190182

191-
TestExecuteTask (property, expected);
192-
}
183+
TestExecuteTask (property, null);
193184
}
194185

195186
[Test]
196-
public void TestGetDictionaryArrayKeyProperty ()
187+
[TestCase(0)]
188+
[TestCase(1)]
189+
[TestCase(2)]
190+
public void TestGetDictionaryKeyProperty (int index)
197191
{
198-
for (var index = 0; index < 3; index++)
199-
{
200-
var property = $"KeyDictionary:Item4:{index}";
201-
var expected = $"Dictionary Array Item 4.{index}";
192+
var property = $"KeyDictionary:Item{index}";
193+
var expected = $"Dictionary Item {index}";
202194

203-
TestExecuteTask (property, expected);
204-
}
195+
TestExecuteTask (property, expected);
196+
}
197+
198+
[Test]
199+
[TestCase(0)]
200+
[TestCase(1)]
201+
[TestCase(2)]
202+
public void TestGetDictionaryDictionaryKeyProperty (int index)
203+
{
204+
var property = $"KeyDictionary:Item3:Item{index}";
205+
var expected = $"Dictionary Dictionary Item 3.{index}";
206+
207+
TestExecuteTask (property, expected);
208+
}
209+
210+
[Test]
211+
[TestCase(0)]
212+
[TestCase(1)]
213+
[TestCase(2)]
214+
public void TestGetDictionaryArrayKeyProperty (int index)
215+
{
216+
var property = $"KeyDictionary:Item4:{index}";
217+
var expected = $"Dictionary Array Item 4.{index}";
218+
219+
TestExecuteTask (property, expected);
205220
}
206221

207222
}

0 commit comments

Comments
 (0)