Skip to content

Commit 999b821

Browse files
PandaMagnusKeboo
andauthored
Apply suggestions from code review
Co-authored-by: Kevin B <[email protected]>
1 parent 45280cc commit 999b821

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

IntelliTect.TestTools.TestFramework.Tests/TestCaseTests/MultipleDependencyTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ public async Task ReturnMultipleObjectsExecutesSubsequentTestBlocks()
7373

7474
// Assert
7575
Assert.False(tc.Passed);
76-
Assert.NotNull(result.InnerException);
77-
Assert.True(result.InnerException.GetType() == typeof(DivideByZeroException));
76+
Assert.IsType<DivideByZeroException>(result.InnerException);
7877
}
7978
}
8079
}

IntelliTect.TestTools.TestFramework.Tests/TestDataTests.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ public void BlockDataT1T2ThrowsExceptionOnDuplicateTypes()
1212
{
1313
var _ = new BlockData<int, int>(1, 2);
1414
});
15-
Assert.NotNull(exception.InnerException);
16-
Assert.Equal(typeof(InvalidOperationException), exception.InnerException.GetType());
15+
Assert.IsType<InvalidOperationException>(exception.InnerException);
1716
Assert.Equal("Duplicate type found: Int32 appears multiple times. BlockData must use different types to avoid unexpected behavior by the TestCase DI Container.",
1817
exception.InnerException.Message);
1918
}
@@ -25,10 +24,9 @@ public void BlockDataT1T2T3ThrowsExceptionOnDuplicateTypes()
2524
{
2625
var _ = new BlockData<int, bool, int>(1, true, 2);
2726
});
28-
Assert.NotNull(exception.InnerException);
29-
Assert.Equal(typeof(InvalidOperationException), exception.InnerException.GetType());
27+
var invalidOp = Assert.IsType<InvalidOperationException>(exception.InnerException);
3028
Assert.Equal("Duplicate type found: Int32 appears multiple times. BlockData must use different types to avoid unexpected behavior by the TestCase DI Container.",
31-
exception.InnerException.Message);
29+
invalidOp.Message);
3230
}
3331

3432
[Fact]

IntelliTect.TestTools.TestFramework/BlockData.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ static BlockData()
1515
ValidateData.ValidateUniqueTypes(typeof(T1), typeof(T2));
1616
}
1717

18-
public List<KeyValuePair<Type, object?>> Data { get; } =
18+
public T1 Data1 => data1;
19+
public T2 Data2 => data2;
20+
21+
22+
IBlockData.List<KeyValuePair<Type, object?>> Data { get; } =
1923
[
2024
new KeyValuePair<Type, object?>(typeof(T1), data1),
2125
new KeyValuePair<Type, object?>(typeof(T2), data2)

IntelliTect.TestTools.TestFramework/TestCase.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,9 @@ private async Task<bool> TryRunBlock(Block block, object blockInstance, List<obj
406406
else
407407
{
408408
Log?.TestBlockOutput(output);
409-
BlockOutput.Remove(output.GetType());
410-
BlockOutput.Add(output.GetType(), output);
409+
Type outputType = output.GetType();
410+
BlockOutput.Remove(outputType);
411+
BlockOutput.Add(outputType, output);
411412
}
412413
}
413414
result = true;

0 commit comments

Comments
 (0)