From 9b12bd7e41bee1a28df05479b056b07f368cf4ea Mon Sep 17 00:00:00 2001 From: Jan Date: Wed, 30 Oct 2019 15:23:31 +0100 Subject: [PATCH] ZoneCodeGenerator: Fix wrong exception being thrown in tests: Use TestFailedException instead of LoadingException --- .../Parsing/CommandFile/Tests/TestAsset.cs | 8 ++++---- .../Parsing/CommandFile/Tests/TestUse.cs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ZoneCodeGenerator/Parsing/CommandFile/Tests/TestAsset.cs b/src/ZoneCodeGenerator/Parsing/CommandFile/Tests/TestAsset.cs index bb6880dc..f35d67a4 100644 --- a/src/ZoneCodeGenerator/Parsing/CommandFile/Tests/TestAsset.cs +++ b/src/ZoneCodeGenerator/Parsing/CommandFile/Tests/TestAsset.cs @@ -33,18 +33,18 @@ namespace ZoneCodeGenerator.Parsing.CommandFile.Tests var assetType = state.Repository.GetDataTypeByName(assetTypeName); if (assetType == null) { - throw new LoadingException($"Could not find type '{assetTypeName}' to mark it as an asset."); + throw new TestFailedException($"Could not find type '{assetTypeName}' to mark it as an asset."); } if (!(assetType is DataTypeWithMembers assetTypeWithMembers)) { - throw new LoadingException($"Type of asset '{assetTypeName}' needs to be struct or union."); + throw new TestFailedException($"Type of asset '{assetTypeName}' needs to be struct or union."); } var assetInfo = state.Repository.GetInformationFor(assetTypeWithMembers); if (assetInfo == null) { - throw new LoadingException($"Could not find information for type '{assetTypeName}' to mark it as an asset."); + throw new TestFailedException($"Could not find information for type '{assetTypeName}' to mark it as an asset."); } var enumEntryName = NextMatch(AssetEnumEntryToken); @@ -52,7 +52,7 @@ namespace ZoneCodeGenerator.Parsing.CommandFile.Tests .SelectMany(_enum => _enum.Members) .FirstOrDefault(member => member.Name.Equals(enumEntryName, StringComparison.CurrentCultureIgnoreCase)); - assetInfo.AssetEnumEntry = enumEntry ?? throw new LoadingException( + assetInfo.AssetEnumEntry = enumEntry ?? throw new TestFailedException( $"Could not find enum entry '{enumEntryName}' as an asset type index for asset type '{assetTypeName}'."); } } diff --git a/src/ZoneCodeGenerator/Parsing/CommandFile/Tests/TestUse.cs b/src/ZoneCodeGenerator/Parsing/CommandFile/Tests/TestUse.cs index 8fab3a67..8752f894 100644 --- a/src/ZoneCodeGenerator/Parsing/CommandFile/Tests/TestUse.cs +++ b/src/ZoneCodeGenerator/Parsing/CommandFile/Tests/TestUse.cs @@ -27,12 +27,12 @@ namespace ZoneCodeGenerator.Parsing.CommandFile.Tests if (dataTypeToUse == null) { - throw new LoadingException($"Could not find data type '{typeName}'"); + throw new TestFailedException($"Could not find data type '{typeName}'"); } if (!(dataTypeToUse is DataTypeWithMembers dataTypeWithMembersToUse)) { - throw new LoadingException($"To use data type '{typeName}' it must either be a struct or a union."); + throw new TestFailedException($"To use data type '{typeName}' it must either be a struct or a union."); } state.DataTypeInUse = dataTypeWithMembersToUse;