Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WI #1150 Finalize Skeleton file Sax Parser implementation.
This finalization includes unit tests that validate an Xml Skeleton file against its Schema.
- Loading branch information
Showing
17 changed files
with
397 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
[assembly: AssemblyTitle("TypeCobol.TemplateCore.Test")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("TypeCobol.TemplateCore.Test")] | ||
[assembly: AssemblyCopyright("Copyright © 2018")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
[assembly: ComVisible(false)] | ||
|
||
[assembly: Guid("e9386ee6-7b3b-4823-beef-1b6521ce5319")] | ||
|
||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using TypeCobol.TemplateCore.SaxParser; | ||
|
||
namespace TypeCobol.TemplateCore.Test | ||
{ | ||
[TestClass] | ||
public class TemplateCoreTests | ||
{ | ||
/// <summary> | ||
/// Test to only validates the XML Skeleton file against the Schema. | ||
/// </summary> | ||
[TestMethod] | ||
public void SkeletonFileXmlSchemaValidationTest() | ||
{ | ||
string currentDir = System.IO.Directory.GetCurrentDirectory(); | ||
string xmlFile = System.IO.Path.Combine(System.IO.Path.Combine(currentDir, "Xml"), "Skeletons.xml"); | ||
string xsdFile = System.IO.Path.Combine(System.IO.Path.Combine(currentDir, "Xml"), "Skeleton.xsd"); | ||
|
||
SkeletonSaxParser parser = new SkeletonSaxParser(xmlFile, xsdFile); | ||
bool bValidate = parser.Validate(); | ||
Assert.IsTrue(bValidate, bValidate ? "" : parser.ValidationMessage.ToString()); | ||
} | ||
|
||
/// <summary> | ||
/// Test to both parse and validate on the fly the XML Skeleton file against the Schema. | ||
/// </summary> | ||
[TestMethod] | ||
public void SkeletonFileXmlSaxParsingWithValidationTest() | ||
{ | ||
string currentDir = System.IO.Directory.GetCurrentDirectory(); | ||
string xmlFile = System.IO.Path.Combine(System.IO.Path.Combine(currentDir, "Xml"), "Skeletons.xml"); | ||
string xsdFile = System.IO.Path.Combine(System.IO.Path.Combine(currentDir, "Xml"), "Skeleton.xsd"); | ||
|
||
SkeletonSaxParser parser = new SkeletonSaxParser(xmlFile, xsdFile); | ||
try | ||
{ | ||
parser.Parse(); | ||
bool bValidate = parser.ValidationErrorCount == 0 && parser.ValidationWarningCount == 0; | ||
Assert.IsTrue(bValidate, bValidate ? "" : parser.ValidationMessage.ToString()); | ||
} | ||
catch(SaxParser.SaxParser.ParsingException e) | ||
{ | ||
throw e; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Test to only parse the XML Skeleton file without validation. | ||
/// </summary> | ||
[TestMethod] | ||
public void SkeletonFileXmlSaxParsingWithoutValidationTest() | ||
{ | ||
string currentDir = System.IO.Directory.GetCurrentDirectory(); | ||
string xmlFile = System.IO.Path.Combine(System.IO.Path.Combine(currentDir, "Xml"), "Skeletons.xml"); | ||
|
||
SkeletonSaxParser parser = new SkeletonSaxParser(xmlFile); | ||
try | ||
{ | ||
parser.Parse(); | ||
} | ||
catch (SaxParser.SaxParser.ParsingException e) | ||
{ | ||
throw e; | ||
} | ||
} | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
TypeCobol.TemplateCore.Test/TypeCobol.TemplateCore.Test.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="..\TypeCobol.TemplateTranspiler\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\TypeCobol.TemplateTranspiler\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{E9386EE6-7B3B-4823-BEEF-1B6521CE5319}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>TypeCobol.TemplateCore.Test</RootNamespace> | ||
<AssemblyName>TypeCobol.TemplateCore.Test</AssemblyName> | ||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion> | ||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> | ||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath> | ||
<IsCodedUITest>False</IsCodedUITest> | ||
<TestProjectType>UnitTest</TestProjectType> | ||
<NuGetPackageImportStamp> | ||
</NuGetPackageImportStamp> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<HintPath>..\TypeCobol.TemplateTranspiler\packages\MSTest.TestFramework.1.2.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<HintPath>..\TypeCobol.TemplateTranspiler\packages\MSTest.TestFramework.1.2.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="TemplateCoreTests.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\TypeCobol.TemplateCore\TypeCobol.TemplateCore.csproj"> | ||
<Project>{fb927d1e-c8d1-48c6-bf13-25942be5041b}</Project> | ||
<Name>TypeCobol.TemplateCore</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" /> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
<PropertyGroup> | ||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||
</PropertyGroup> | ||
<Error Condition="!Exists('..\TypeCobol.TemplateTranspiler\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\TypeCobol.TemplateTranspiler\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.props'))" /> | ||
<Error Condition="!Exists('..\TypeCobol.TemplateTranspiler\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\TypeCobol.TemplateTranspiler\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.targets'))" /> | ||
</Target> | ||
<Import Project="..\TypeCobol.TemplateTranspiler\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\TypeCobol.TemplateTranspiler\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.targets')" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="MSTest.TestAdapter" version="1.2.1" targetFramework="net461" /> | ||
<package id="MSTest.TestFramework" version="1.2.1" targetFramework="net461" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.