Skip to content
This repository was archived by the owner on Nov 25, 2023. It is now read-only.

Commit c4cb8db

Browse files
committed
Fix unit tests
1 parent d993380 commit c4cb8db

File tree

2 files changed

+571
-563
lines changed

2 files changed

+571
-563
lines changed

src/InvvardDev.EZLayoutDisplay.Tests/Helper/EZLayoutMakerTest.cs

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ namespace InvvardDev.EZLayoutDisplay.Tests.Helper
1010
{
1111
public class EZLayoutMakerTest
1212
{
13+
private const string HashId = "hashid-1";
14+
1315
private static ErgodoxLayout InitializeDataTree()
1416
{
1517
return new ErgodoxLayout
@@ -18,7 +20,7 @@ private static ErgodoxLayout InitializeDataTree()
1820
HashId = "",
1921
Revisions = new List<Revision>
2022
{
21-
new Revision { Layers = new List<ErgodoxLayer> { new ErgodoxLayer() { Color = "", Title = "", Position = 0, Keys = new List<ErgodoxKey>() } } }
23+
new Revision { HashId = HashId, Layers = new List<ErgodoxLayer> { new ErgodoxLayer() { Color = "", Title = "", Position = 0, Keys = new List<ErgodoxKey>() } } }
2224
}
2325
};
2426
}
@@ -29,13 +31,13 @@ public void PrepareEZLayout_InitializeEZLayout(string expectedTitle, string expe
2931
{
3032
// Arrange
3133
var revision = new Revision { Layers = new List<ErgodoxLayer>() };
32-
ErgodoxLayout ergodoxLayout = new ErgodoxLayout { Title = expectedTitle, HashId = expectedHashId, Revisions = new List<Revision>() };
34+
ErgodoxLayout ergodoxLayout = new ErgodoxLayout { Title = expectedTitle, HashId = expectedHashId, Revisions = new List<Revision> { new Revision { HashId = HashId } } };
3335
ergodoxLayout.Revisions.Add(revision);
3436
EZLayout ezLayoutResult;
3537

3638
// Act
3739
var ezLayoutMaker = new EZLayoutMaker();
38-
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout);
40+
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout, HashId);
3941

4042
// Assert
4143
Assert.Equal(expectedTitle, ezLayoutResult.Name);
@@ -48,13 +50,16 @@ public void PrepareEZLayout_InitializeEZLayer(int expectedIndex, string expected
4850
{
4951
// Arrange
5052
var ergodoxLayer = new ErgodoxLayer() { Color = expectedColor, Title = expectedTitle, Position = expectedIndex, Keys = new List<ErgodoxKey>() };
51-
ErgodoxLayout ergodoxLayout = new ErgodoxLayout { Title = "", HashId = "", Revisions = new List<Revision> { new Revision { Layers = new List<ErgodoxLayer> { ergodoxLayer } } } };
53+
ErgodoxLayout ergodoxLayout = new ErgodoxLayout
54+
{
55+
Title = "", HashId = "", Revisions = new List<Revision> { new Revision { HashId = HashId, Layers = new List<ErgodoxLayer> { ergodoxLayer } } }
56+
};
5257

5358
EZLayout ezLayoutResult;
5459

5560
// Act
5661
var ezLayoutMaker = new EZLayoutMaker();
57-
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout);
62+
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout, HashId);
5863

5964
// Assert
6065
Assert.Single(ezLayoutResult.EZLayers);
@@ -75,13 +80,16 @@ public void PrepareEZLayout_ColorKey(string layerColor, string keyColor, string
7580
{
7681
// Arrange
7782
var ergodoxLayer = new ErgodoxLayer { Color = layerColor, Keys = new List<ErgodoxKey> { new ErgodoxKey { GlowColor = keyColor } } };
78-
ErgodoxLayout ergodoxLayout = new ErgodoxLayout { Title = "", HashId = "", Revisions = new List<Revision> { new Revision { Layers = new List<ErgodoxLayer> { ergodoxLayer } } } };
83+
ErgodoxLayout ergodoxLayout = new ErgodoxLayout
84+
{
85+
Title = "", HashId = "", Revisions = new List<Revision> { new Revision { HashId = HashId, Layers = new List<ErgodoxLayer> { ergodoxLayer } } }
86+
};
7987

8088
EZLayout ezLayoutResult;
8189

8290
// Act
8391
var ezLayoutMaker = new EZLayoutMaker();
84-
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout);
92+
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout, HashId);
8593

8694
// Assert
8795
Assert.Equal(expectedColor, ezLayoutResult.EZLayers.First().EZKeys.First().Color);
@@ -99,7 +107,7 @@ public void PrepareEZLayout_KeyCodeUnknown()
99107

100108
// Act
101109
var ezLayoutMaker = new EZLayoutMaker();
102-
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout);
110+
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout, HashId);
103111

104112
// Assert
105113
Assert.Single(ezLayoutResult.EZLayers);
@@ -121,7 +129,7 @@ public void PrepareEZLayout_InitializeEZKey(string expectedKeyCode, string expec
121129

122130
// Act
123131
var ezLayoutMaker = new EZLayoutMaker();
124-
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout);
132+
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout, HashId);
125133

126134
// Assert
127135
Assert.Single(ezLayoutResult.EZLayers);
@@ -157,7 +165,7 @@ public void PrepareEZLayout_KeyCategoryWithSimpleLabel(string keyCode, string ex
157165

158166
// Act
159167
var ezLayoutMaker = new EZLayoutMaker();
160-
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout);
168+
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout, HashId);
161169

162170
// Assert
163171
Assert.Single(ezLayoutResult.EZLayers);
@@ -183,7 +191,7 @@ public void PrepareEZLayout_KeyCategoryOSM(string keyCode, string command, strin
183191

184192
// Act
185193
var ezLayoutMaker = new EZLayoutMaker();
186-
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout);
194+
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout, HashId);
187195

188196
// Assert
189197
Assert.Single(ezLayoutResult.EZLayers);
@@ -223,7 +231,7 @@ public void PrepareEZLayout_KeyCategoryLayer(string keyCode, string expectedLabe
223231

224232
// Act
225233
var ezLayoutMaker = new EZLayoutMaker();
226-
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout);
234+
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout, HashId);
227235

228236
// Assert
229237
Assert.Single(ezLayoutResult.EZLayers);
@@ -252,7 +260,7 @@ public void PrepareEZLayout_KeyCategoryLayerShortcut(string keyCode,
252260

253261
// Act
254262
var ezLayoutMaker = new EZLayoutMaker();
255-
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout);
263+
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout, HashId);
256264

257265
// Assert
258266
Assert.Single(ezLayoutResult.EZLayers);
@@ -294,7 +302,7 @@ public void PrepareEZLayout_KeyCategoryWithGlyphs(string keyCode, string expecte
294302

295303
// Act
296304
var ezLayoutMaker = new EZLayoutMaker();
297-
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout);
305+
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout, HashId);
298306

299307
// Assert
300308
Assert.Single(ezLayoutResult.EZLayers);
@@ -325,7 +333,7 @@ public void PrepareEZLayout_KeyCategoryDualFunction(string keyCode,
325333

326334
// Act
327335
var ezLayoutMaker = new EZLayoutMaker();
328-
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout);
336+
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout, HashId);
329337

330338
// Assert
331339
Assert.Single(ezLayoutResult.EZLayers);
@@ -359,7 +367,7 @@ public void PrepareEZLayout_KeyCategoryShortcuts(string keyCode, string command,
359367

360368
// Act
361369
var ezLayoutMaker = new EZLayoutMaker();
362-
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout);
370+
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout, HashId);
363371

364372
// Assert
365373
Assert.Single(ezLayoutResult.EZLayers);
@@ -428,7 +436,7 @@ public void PrepareEZLayout_ProcessModifiers(bool leftAlt,
428436

429437
// Act
430438
var ezLayoutMaker = new EZLayoutMaker();
431-
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout);
439+
ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout, HashId);
432440

433441
// Assert
434442
Assert.Single(ezLayoutResult.EZLayers);

0 commit comments

Comments
 (0)