Skip to content

Commit b374c45

Browse files
Style changes to provide Preconditions and Collections as global static imports (#32)
1 parent 30250bd commit b374c45

File tree

13 files changed

+71
-91
lines changed

13 files changed

+71
-91
lines changed

OnixLabs.Core.UnitTests/Collections/CollectionTests.cs

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void CollectionsEmptyEnumerableShouldProduceTheExpectedResult()
4646
{
4747
// Given
4848
IEnumerable<object> expected = Enumerable.Empty<object>();
49-
IEnumerable<object> actual = Collection.EmptyEnumerable<object>();
49+
IEnumerable<object> actual = EmptyEnumerable<object>();
5050

5151
// Then
5252
Assert.Equal(expected, actual);
@@ -57,7 +57,7 @@ public void CollectionsEmptyArrayShouldProduceTheExpectedResult()
5757
{
5858
// Given
5959
object[] expected = Array.Empty<object>();
60-
object[] actual = Collection.EmptyArray<object>();
60+
object[] actual = EmptyArray<object>();
6161

6262
// Then
6363
Assert.Equal(expected, actual);
@@ -68,7 +68,7 @@ public void CollectionsEmptyImmutableArrayShouldProduceTheExpectedResult()
6868
{
6969
// Given
7070
ImmutableArray<object> expected = ImmutableArray.Create<object>();
71-
ImmutableArray<object> actual = Collection.EmptyImmutableArray<object>();
71+
ImmutableArray<object> actual = EmptyImmutableArray<object>();
7272

7373
// Then
7474
Assert.Equal(expected, actual);
@@ -79,7 +79,7 @@ public void CollectionsEmptyListShouldProduceTheExpectedResult()
7979
{
8080
// Given
8181
List<object> expected = new();
82-
List<object> actual = Collection.EmptyList<object>();
82+
List<object> actual = EmptyList<object>();
8383

8484
// Then
8585
Assert.Equal(expected, actual);
@@ -90,7 +90,7 @@ public void CollectionsEmptyImmutableListShouldProduceTheExpectedResult()
9090
{
9191
// Given
9292
ImmutableList<object> expected = ImmutableList.Create<object>();
93-
ImmutableList<object> actual = Collection.EmptyImmutableList<object>();
93+
ImmutableList<object> actual = EmptyImmutableList<object>();
9494

9595
// Then
9696
Assert.Equal(expected, actual);
@@ -101,7 +101,7 @@ public void CollectionsEmptyDictionaryShouldProduceTheExpectedResult()
101101
{
102102
// Given
103103
Dictionary<object, object> expected = new();
104-
Dictionary<object, object> actual = Collection.EmptyDictionary<object, object>();
104+
Dictionary<object, object> actual = EmptyDictionary<object, object>();
105105

106106
// Then
107107
Assert.Equal(expected, actual);
@@ -112,7 +112,7 @@ public void CollectionsEmptyImmutableDictionaryShouldProduceTheExpectedResult()
112112
{
113113
// Given
114114
ImmutableDictionary<object, object> expected = ImmutableDictionary.Create<object, object>();
115-
ImmutableDictionary<object, object> actual = Collection.EmptyImmutableDictionary<object, object>();
115+
ImmutableDictionary<object, object> actual = EmptyImmutableDictionary<object, object>();
116116

117117
// Then
118118
Assert.Equal(expected, actual);
@@ -123,7 +123,7 @@ public void CollectionsEmptySortedDictionaryShouldProduceTheExpectedResult()
123123
{
124124
// Given
125125
SortedDictionary<object, object> expected = new();
126-
SortedDictionary<object, object> actual = Collection.EmptySortedDictionary<object, object>();
126+
SortedDictionary<object, object> actual = EmptySortedDictionary<object, object>();
127127

128128
// Then
129129
Assert.Equal(expected, actual);
@@ -134,7 +134,7 @@ public void CollectionsEmptyImmutableSortedDictionaryShouldProduceTheExpectedRes
134134
{
135135
// Given
136136
ImmutableSortedDictionary<object, object> expected = ImmutableSortedDictionary.Create<object, object>();
137-
ImmutableSortedDictionary<object, object> actual = Collection.EmptyImmutableSortedDictionary<object, object>();
137+
ImmutableSortedDictionary<object, object> actual = EmptyImmutableSortedDictionary<object, object>();
138138

139139
// Then
140140
Assert.Equal(expected, actual);
@@ -145,7 +145,7 @@ public void CollectionsEmptyHashSetShouldProduceTheExpectedResult()
145145
{
146146
// Given
147147
HashSet<object> expected = new();
148-
HashSet<object> actual = Collection.EmptyHashSet<object>();
148+
HashSet<object> actual = EmptyHashSet<object>();
149149

150150
// Then
151151
Assert.Equal(expected, actual);
@@ -156,7 +156,7 @@ public void CollectionsEmptyImmutableHashSetShouldProduceTheExpectedResult()
156156
{
157157
// Given
158158
ImmutableHashSet<object> expected = ImmutableHashSet.Create<object>();
159-
ImmutableHashSet<object> actual = Collection.EmptyImmutableHashSet<object>();
159+
ImmutableHashSet<object> actual = EmptyImmutableHashSet<object>();
160160

161161
// Then
162162
Assert.Equal(expected, actual);
@@ -167,7 +167,7 @@ public void CollectionsEmptySortedSetShouldProduceTheExpectedResult()
167167
{
168168
// Given
169169
SortedSet<object> expected = new();
170-
SortedSet<object> actual = Collection.EmptySortedSet<object>();
170+
SortedSet<object> actual = EmptySortedSet<object>();
171171

172172
// Then
173173
Assert.Equal(expected, actual);
@@ -178,7 +178,7 @@ public void CollectionsEmptyImmutableSortedSetShouldProduceTheExpectedResult()
178178
{
179179
// Given
180180
ImmutableSortedSet<object> expected = ImmutableSortedSet.Create<object>();
181-
ImmutableSortedSet<object> actual = Collection.EmptyImmutableSortedSet<object>();
181+
ImmutableSortedSet<object> actual = EmptyImmutableSortedSet<object>();
182182

183183
// Then
184184
Assert.Equal(expected, actual);
@@ -189,7 +189,7 @@ public void CollectionsEmptyStackShouldProduceTheExpectedResult()
189189
{
190190
// Given
191191
Stack<object> expected = new();
192-
Stack<object> actual = Collection.EmptyStack<object>();
192+
Stack<object> actual = EmptyStack<object>();
193193

194194
// Then
195195
Assert.Equal(expected, actual);
@@ -200,7 +200,7 @@ public void CollectionsEmptyImmutableStackShouldProduceTheExpectedResult()
200200
{
201201
// Given
202202
ImmutableStack<object> expected = ImmutableStack.Create<object>();
203-
ImmutableStack<object> actual = Collection.EmptyImmutableStack<object>();
203+
ImmutableStack<object> actual = EmptyImmutableStack<object>();
204204

205205
// Then
206206
Assert.Equal(expected, actual);
@@ -211,7 +211,7 @@ public void CollectionsEmptyQueueShouldProduceTheExpectedResult()
211211
{
212212
// Given
213213
Queue<object> expected = new();
214-
Queue<object> actual = Collection.EmptyQueue<object>();
214+
Queue<object> actual = EmptyQueue<object>();
215215

216216
// Then
217217
Assert.Equal(expected, actual);
@@ -222,7 +222,7 @@ public void CollectionsEmptyImmutableQueueShouldProduceTheExpectedResult()
222222
{
223223
// Given
224224
ImmutableQueue<object> expected = ImmutableQueue.Create<object>();
225-
ImmutableQueue<object> actual = Collection.EmptyImmutableQueue<object>();
225+
ImmutableQueue<object> actual = EmptyImmutableQueue<object>();
226226

227227
// Then
228228
Assert.Equal(expected, actual);
@@ -233,7 +233,7 @@ public void CollectionsEnumerableOfShouldReturnTheExpectedResult()
233233
{
234234
// Given
235235
IEnumerable<object> expected = EnumerableInitializers;
236-
IEnumerable<object> actual = Collection.EnumerableOf(EnumerableInitializers);
236+
IEnumerable<object> actual = EnumerableOf(EnumerableInitializers);
237237

238238
// Then
239239
Assert.True(expected.SequenceEqual(actual));
@@ -244,7 +244,7 @@ public void CollectionsArrayOfShouldReturnTheExpectedResult()
244244
{
245245
// Given
246246
object[] expected = EnumerableInitializers.ToArray();
247-
object[] actual = Collection.ArrayOf(EnumerableInitializers);
247+
object[] actual = ArrayOf(EnumerableInitializers);
248248

249249
// Then
250250
Assert.True(expected.SequenceEqual(actual));
@@ -255,7 +255,7 @@ public void CollectionsImmutableArrayOfShouldReturnTheExpectedResult()
255255
{
256256
// Given
257257
ImmutableArray<object> expected = ImmutableArray.Create(EnumerableInitializers);
258-
ImmutableArray<object> actual = Collection.ImmutableArrayOf(EnumerableInitializers);
258+
ImmutableArray<object> actual = ImmutableArrayOf(EnumerableInitializers);
259259

260260
// Then
261261
Assert.True(expected.SequenceEqual(actual));
@@ -266,7 +266,7 @@ public void CollectionsListOfShouldReturnTheExpectedResult()
266266
{
267267
// Given
268268
List<object> expected = new(EnumerableInitializers);
269-
List<object> actual = Collection.ListOf(EnumerableInitializers);
269+
List<object> actual = ListOf(EnumerableInitializers);
270270

271271
// Then
272272
Assert.True(expected.SequenceEqual(actual));
@@ -277,7 +277,7 @@ public void CollectionsImmutableListOfShouldReturnTheExpectedResult()
277277
{
278278
// Given
279279
ImmutableList<object> expected = ImmutableList.Create(EnumerableInitializers);
280-
ImmutableList<object> actual = Collection.ImmutableListOf(EnumerableInitializers);
280+
ImmutableList<object> actual = ImmutableListOf(EnumerableInitializers);
281281

282282
// Then
283283
Assert.True(expected.SequenceEqual(actual));
@@ -288,7 +288,7 @@ public void CollectionsDictionaryOfShouldReturnTheExpectedResult()
288288
{
289289
// Given
290290
Dictionary<object, object> expected = new(DictionaryInitializers);
291-
Dictionary<object, object> actual = Collection.DictionaryOf(DictionaryInitializers);
291+
Dictionary<object, object> actual = DictionaryOf(DictionaryInitializers);
292292

293293
// Then
294294
Assert.True(expected.SequenceEqual(actual));
@@ -299,7 +299,7 @@ public void CollectionsImmutableDictionaryOfShouldReturnTheExpectedResult()
299299
{
300300
// Given
301301
ImmutableDictionary<object, object> expected = new Dictionary<object, object>(DictionaryInitializers).ToImmutableDictionary();
302-
ImmutableDictionary<object, object> actual = Collection.ImmutableDictionaryOf(DictionaryInitializers);
302+
ImmutableDictionary<object, object> actual = ImmutableDictionaryOf(DictionaryInitializers);
303303

304304
// Then
305305
Assert.True(expected.SequenceEqual(actual));
@@ -309,8 +309,8 @@ public void CollectionsImmutableDictionaryOfShouldReturnTheExpectedResult()
309309
public void CollectionsSortedDictionaryOfShouldReturnTheExpectedResult()
310310
{
311311
// Given
312-
SortedDictionary<string, object> expected = new(Collection.DictionaryOf(SortedDictionaryInitializers));
313-
SortedDictionary<string, object> actual = Collection.SortedDictionaryOf(SortedDictionaryInitializers);
312+
SortedDictionary<string, object> expected = new(DictionaryOf(SortedDictionaryInitializers));
313+
SortedDictionary<string, object> actual = SortedDictionaryOf(SortedDictionaryInitializers);
314314

315315
// Then
316316
Assert.True(expected.SequenceEqual(actual));
@@ -320,9 +320,9 @@ public void CollectionsSortedDictionaryOfShouldReturnTheExpectedResult()
320320
public void CollectionsImmutableSortedDictionaryOfShouldReturnTheExpectedResult()
321321
{
322322
// Given
323-
SortedDictionary<string, object> sorted = new(Collection.DictionaryOf(SortedDictionaryInitializers));
323+
SortedDictionary<string, object> sorted = new(DictionaryOf(SortedDictionaryInitializers));
324324
ImmutableSortedDictionary<string, object> expected = sorted.ToImmutableSortedDictionary();
325-
ImmutableSortedDictionary<string, object> actual = Collection.ImmutableSortedDictionaryOf(SortedDictionaryInitializers);
325+
ImmutableSortedDictionary<string, object> actual = ImmutableSortedDictionaryOf(SortedDictionaryInitializers);
326326

327327
// Then
328328
Assert.True(expected.SequenceEqual(actual));
@@ -333,7 +333,7 @@ public void CollectionsHashSetOfShouldReturnTheExpectedResult()
333333
{
334334
// Given
335335
HashSet<object> expected = new(EnumerableInitializers);
336-
HashSet<object> actual = Collection.HashSetOf(EnumerableInitializers);
336+
HashSet<object> actual = HashSetOf(EnumerableInitializers);
337337

338338
// Then
339339
Assert.True(expected.SequenceEqual(actual));
@@ -344,7 +344,7 @@ public void CollectionsImmutableHashSetOfShouldReturnTheExpectedResult()
344344
{
345345
// Given
346346
ImmutableHashSet<object> expected = ImmutableHashSet.Create(EnumerableInitializers);
347-
ImmutableHashSet<object> actual = Collection.ImmutableHashSetOf(EnumerableInitializers);
347+
ImmutableHashSet<object> actual = ImmutableHashSetOf(EnumerableInitializers);
348348

349349
// Then
350350
Assert.True(expected.SequenceEqual(actual));
@@ -355,7 +355,7 @@ public void CollectionsSortedSetOfShouldReturnTheExpectedResult()
355355
{
356356
// Given
357357
SortedSet<int> expected = new(NumericInitializers);
358-
SortedSet<int> actual = Collection.SortedSetOf(NumericInitializers);
358+
SortedSet<int> actual = SortedSetOf(NumericInitializers);
359359

360360
// Then
361361
Assert.True(expected.SequenceEqual(actual));
@@ -366,7 +366,7 @@ public void CollectionsImmutableSortedSetOfShouldReturnTheExpectedResult()
366366
{
367367
// Given
368368
ImmutableSortedSet<int> expected = ImmutableSortedSet.Create(NumericInitializers);
369-
ImmutableSortedSet<int> actual = Collection.ImmutableSortedSetOf(NumericInitializers);
369+
ImmutableSortedSet<int> actual = ImmutableSortedSetOf(NumericInitializers);
370370

371371
// Then
372372
Assert.True(expected.SequenceEqual(actual));
@@ -377,7 +377,7 @@ public void CollectionsStackOfShouldReturnTheExpectedResult()
377377
{
378378
// Given
379379
Stack<object> expected = new(EnumerableInitializers);
380-
Stack<object> actual = Collection.StackOf(EnumerableInitializers);
380+
Stack<object> actual = StackOf(EnumerableInitializers);
381381

382382
// Then
383383
Assert.True(expected.SequenceEqual(actual));
@@ -388,7 +388,7 @@ public void CollectionsImmutableStackOfShouldReturnTheExpectedResult()
388388
{
389389
// Given
390390
ImmutableStack<object> expected = ImmutableStack.Create(EnumerableInitializers);
391-
ImmutableStack<object> actual = Collection.ImmutableStackOf(EnumerableInitializers);
391+
ImmutableStack<object> actual = ImmutableStackOf(EnumerableInitializers);
392392

393393
// Then
394394
Assert.True(expected.SequenceEqual(actual));
@@ -399,7 +399,7 @@ public void CollectionsQueueOfShouldReturnTheExpectedResult()
399399
{
400400
// Given
401401
Queue<object> expected = new(EnumerableInitializers);
402-
Queue<object> actual = Collection.QueueOf(EnumerableInitializers);
402+
Queue<object> actual = QueueOf(EnumerableInitializers);
403403

404404
// Then
405405
Assert.True(expected.SequenceEqual(actual));
@@ -410,7 +410,7 @@ public void CollectionsImmutableQueueOfShouldReturnTheExpectedResult()
410410
{
411411
// Given
412412
ImmutableQueue<object> expected = ImmutableQueue.Create(EnumerableInitializers);
413-
ImmutableQueue<object> actual = Collection.ImmutableQueueOf(EnumerableInitializers);
413+
ImmutableQueue<object> actual = ImmutableQueueOf(EnumerableInitializers);
414414

415415
// Then
416416
Assert.True(expected.SequenceEqual(actual));

OnixLabs.Core.UnitTests/Linq/IEnumerableExtensionTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ public void NoneShouldProduceExpectedResultFalseAll()
372372
public void SumShouldProduceExpectedResult()
373373
{
374374
// Given
375-
IEnumerable<decimal> elements = Collection.ListOf<decimal>(12.34m, 34.56m, 56.78m);
375+
IEnumerable<decimal> elements = ListOf(12.34m, 34.56m, 56.78m);
376376
decimal expected = 103.68m;
377377

378378
// When
@@ -389,7 +389,7 @@ public void SumWithSelectorShouldProduceExpectedResult()
389389
Numeric<decimal> element1 = new(1234.567m);
390390
Numeric<decimal> element2 = new(890.1234m);
391391
Numeric<decimal> element3 = new(56.78901m);
392-
IEnumerable<Numeric<decimal>> elements = Collection.ListOf(element1, element2, element3);
392+
IEnumerable<Numeric<decimal>> elements = ListOf(element1, element2, element3);
393393
decimal expected = 2181.47941m;
394394

395395
// When
Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
43
<TargetFramework>net7.0</TargetFramework>
5-
64
<IsPackable>false</IsPackable>
7-
85
<LangVersion>11</LangVersion>
96
</PropertyGroup>
10-
117
<ItemGroup>
12-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
13-
<PackageReference Include="xunit" Version="2.4.2" />
8+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2"/>
9+
<PackageReference Include="xunit" Version="2.4.2"/>
1410
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
1511
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1612
<PrivateAssets>all</PrivateAssets>
@@ -20,14 +16,15 @@
2016
<PrivateAssets>all</PrivateAssets>
2117
</PackageReference>
2218
</ItemGroup>
23-
2419
<ItemGroup>
25-
<ProjectReference Include="..\OnixLabs.Core.UnitTests.Data\OnixLabs.Core.UnitTests.Data.csproj" />
26-
<ProjectReference Include="..\OnixLabs.Core\OnixLabs.Core.csproj" />
20+
<ProjectReference Include="..\OnixLabs.Core.UnitTests.Data\OnixLabs.Core.UnitTests.Data.csproj"/>
21+
<ProjectReference Include="..\OnixLabs.Core\OnixLabs.Core.csproj"/>
2722
</ItemGroup>
28-
2923
<ItemGroup>
30-
<Folder Include="Text" />
24+
<Folder Include="Text"/>
25+
</ItemGroup>
26+
<ItemGroup>
27+
<Using Include="OnixLabs.Core.Preconditions" Static="True"/>
28+
<Using Include="OnixLabs.Core.Collections.Collection" Static="True"/>
3129
</ItemGroup>
32-
3330
</Project>

0 commit comments

Comments
 (0)