Skip to content

Commit 2acb8d0

Browse files
author
José Miguel Sánchez Fernández
authored
Merge pull request #2 from VisualStudioEX3/feature/refactor-tests
Feature/refactor tests
2 parents ae305a6 + c1749a0 commit 2acb8d0

File tree

5 files changed

+16
-15
lines changed

5 files changed

+16
-15
lines changed

DIV2.Format.Exporter.Tests/DIV2.Format.Exporter.Tests.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.0-preview-20210127-04" />
11-
<PackageReference Include="MSTest.TestAdapter" Version="2.2.0-preview-20210115-03" />
12-
<PackageReference Include="MSTest.TestFramework" Version="2.2.0-preview-20210115-03" />
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
11+
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
12+
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
1313
</ItemGroup>
1414

1515
<ItemGroup>

DIV2.Format.Exporter.Tests/Tests/ColorRangeTableTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ public void AreEqual()
6363
public void AreNotEqual()
6464
{
6565
var a = new ColorRangeTable();
66-
6766
var b = new ColorRangeTable();
6867
byte startIndex = 64;
6968
for (int i = 0; i < ColorRangeTable.LENGTH; i++)

DIV2.Format.Exporter.Tests/Tests/ColorTests.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,9 @@ public void WriteByIndex()
9797
[TestMethod]
9898
public void FailWriteByIndex()
9999
{
100-
Assert.ThrowsException<IndexOutOfRangeException>(() =>
101-
{
102-
var color = new Color();
103-
color[-1] = 0;
104-
});
105-
Assert.ThrowsException<IndexOutOfRangeException>(() =>
106-
{
107-
var color = new Color();
108-
color[Color.LENGTH + 1] = 0;
109-
});
100+
var color = new Color();
101+
Assert.ThrowsException<IndexOutOfRangeException>(() => color[-1] = 0);
102+
Assert.ThrowsException<IndexOutOfRangeException>(() => color[Color.LENGTH + 1] = 0);
110103
}
111104

112105
[TestMethod]

DIV2.Format.Exporter.Tests/Tests/FPGTests.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ public void AddMapWithTheSamePalette()
259259
public void AddMapWithDifferentPalette()
260260
{
261261
const string PLAYER_MAP_FILENAME_FIELD = "PLAYER.MAP";
262+
262263
string playerMapPath = this.GetAssetPath(SharedConstants.FILENAME_IMG_PLAYER_MAP);
263264

264265
var pal = new PAL(this.GetAssetPath(SharedConstants.FILENAME_PAL_DIV));
@@ -325,6 +326,7 @@ public void FailContainsMap()
325326
public void RemoveMapByGraphId()
326327
{
327328
const int GRAPH_ID = 100; // PLAYER.MAP, index 1.
329+
328330
var fpg = new FPG(this.GetAssetPath(SharedConstants.FILENAME_FPG_TEST));
329331

330332
fpg.Remove(GRAPH_ID);
@@ -392,6 +394,7 @@ public void RemoveMapByIndex()
392394
{
393395
const int GRAPH_ID = 100; // PLAYER.MAP, index 1.
394396
const int INDEX = 1;
397+
395398
var fpg = new FPG(this.GetAssetPath(SharedConstants.FILENAME_FPG_TEST));
396399

397400
fpg.RemoveAt(INDEX);
@@ -403,6 +406,7 @@ public void RemoveMapByIndex()
403406
public void FailRemoveMapByIndex()
404407
{
405408
var fpg = new FPG(this.GetAssetPath(SharedConstants.FILENAME_FPG_TEST));
409+
406410
Assert.ThrowsException<IndexOutOfRangeException>(() => fpg.RemoveAt(-1));
407411
Assert.ThrowsException<IndexOutOfRangeException>(() => fpg.RemoveAt(fpg.Count + 1));
408412
}
@@ -412,6 +416,7 @@ public void FailRemoveMapByIndexWhenFPGIsEmpty()
412416
{
413417
var pal = new PAL(this.GetAssetPath(SharedConstants.FILENAME_PAL_SPACE));
414418
var fpg = new FPG(pal);
419+
415420
Assert.ThrowsException<InvalidOperationException>(() => fpg.Remove(0));
416421
}
417422

DIV2.Format.Exporter.Tests/Tests/MAPTests.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ public void AreEqual()
160160
{
161161
var a = new MAP(this._palette, TEST_WIDTH, TEST_HEIGHT);
162162
var b = new MAP(this._palette, TEST_WIDTH, TEST_HEIGHT);
163+
163164
Assert.AreEqual(a, b);
164165
}
165166

@@ -168,6 +169,7 @@ public void AreNotEqual()
168169
{
169170
var a = new MAP(this._palette, TEST_WIDTH, TEST_HEIGHT);
170171
var b = new MAP(this._palette, TEST_WIDTH, TEST_HEIGHT, MAP.MIN_GRAPH_ID, TEST_DESCRIPTION);
172+
171173
Assert.AreNotEqual(a, b);
172174
}
173175

@@ -245,9 +247,10 @@ public void FailReadByCoordinates()
245247
[TestMethod]
246248
public void WriteByCoordinates()
247249
{
248-
this.CreateTestMap(out byte[] bitmap);
249250
var map = new MAP(this._palette, TEST_WIDTH, TEST_HEIGHT);
250251

252+
this.CreateTestMap(out byte[] bitmap);
253+
251254
for (int y = 0; y < TEST_HEIGHT; y++)
252255
for (int x = 0; x < TEST_WIDTH; x++)
253256
map[x, y] = bitmap[this.GetIndex(x, y)];
@@ -371,6 +374,7 @@ public void Save()
371374
{
372375
string assetPath = this.GetOutputPath("TEST.MAP");
373376
this.CreateTestMap(out _).Save(assetPath);
377+
374378
Assert.IsTrue(MAP.ValidateFormat(assetPath));
375379
}
376380

0 commit comments

Comments
 (0)