-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
197 additions
and
3 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 |
---|---|---|
|
@@ -25,4 +25,10 @@ jobs: | |
run: nuget restore IndustrialPark.sln | ||
|
||
- name: Build solution | ||
run: msbuild IndustrialPark.sln -t:rebuild -property:Configuration=Release -property:platform="Any CPU" | ||
run: msbuild IndustrialPark.sln -t:rebuild -property:Configuration=Release -property:platform="Any CPU" | ||
|
||
- name: Run unit tests | ||
uses: microsoft/[email protected] | ||
with: | ||
testAssembly: '**\bin\Release\**\*Test.dll' | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using System.Drawing; | ||
using Xunit; | ||
using IndustrialPark; | ||
|
||
namespace IndustrialParkTest | ||
{ | ||
public class GameCubeBannerTests | ||
{ | ||
private readonly GameCubeBanner banner; | ||
|
||
public GameCubeBannerTests() | ||
{ | ||
banner = new GameCubeBanner() | ||
{ | ||
Title = "Test Title", | ||
TitleFull = "Test Full Title", | ||
Creator = "Test Creator", | ||
CreatorFull = "Test Full Creator", | ||
Description = "Test Description", | ||
Image = new Bitmap(96, 32) | ||
}; | ||
} | ||
|
||
[Fact] | ||
public void SaveToFile_Output_Banner_Filesize_Is_Correct() | ||
{ | ||
int expectedFilesizeBytes = 0x1960; | ||
banner.SaveToFile("test.bnr"); | ||
Assert.Equal(expectedFilesizeBytes, new System.IO.FileInfo("test.bnr").Length); | ||
System.IO.File.Delete("test.bnr"); | ||
} | ||
|
||
[Fact] | ||
public void SaveToFile_Magic_Bytes_Are_Correct() | ||
{ | ||
string expectedMagic = "BNR1"; | ||
banner.SaveToFile("test.bnr"); | ||
|
||
using (System.IO.BinaryReader reader = new System.IO.BinaryReader( | ||
System.IO.File.Open("test.bnr", System.IO.FileMode.Open))) | ||
{ | ||
string magic = new string(reader.ReadChars(4)); | ||
Assert.Equal(expectedMagic, magic); | ||
} | ||
System.IO.File.Delete("test.bnr"); | ||
} | ||
|
||
[Fact] | ||
public void SaveToFile_Short_Game_Title_Is_Correct() | ||
{ | ||
string expectedTitle = "Test Title"; | ||
|
||
banner.SaveToFile("test.bnr"); | ||
|
||
using (System.IO.BinaryReader reader = new System.IO.BinaryReader( | ||
System.IO.File.Open("test.bnr", System.IO.FileMode.Open))) | ||
{ | ||
// Game title begins at 0x1820 | ||
reader.BaseStream.Seek(0x1820, System.IO.SeekOrigin.Begin); | ||
string title = new string(reader.ReadChars(0x20)).TrimEnd('\0'); | ||
Assert.Equal(expectedTitle, title); | ||
} | ||
System.IO.File.Delete("test.bnr"); | ||
} | ||
} | ||
} |
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="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" | ||
Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{BD22CB98-D975-4E37-8707-9FA07C067806}</ProjectGuid> | ||
<ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>IndustrialParkTest</RootNamespace> | ||
<AssemblyName>IndustrialParkTest</AssemblyName> | ||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<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' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System"/> | ||
<Reference Include="System.Core"/> | ||
<Reference Include="System.Data"/> | ||
<Reference Include="System.Drawing" /> | ||
<Reference Include="System.Xml"/> | ||
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c"> | ||
<HintPath>..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath> | ||
</Reference> | ||
<Reference Include="xunit.assert, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c"> | ||
<HintPath>..\packages\xunit.assert.2.1.0\lib\dotnet\xunit.assert.dll</HintPath> | ||
</Reference> | ||
<Reference Include="xunit.core, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c"> | ||
<HintPath>..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll</HintPath> | ||
</Reference> | ||
<Reference Include="xunit.execution.desktop, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c"> | ||
<HintPath>..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="GameCubeBannerTests.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs"/> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\IndustrialPark\IndustrialPark.csproj"> | ||
<Project>{62f1a222-225b-463f-85a7-70f56c34c324}</Project> | ||
<Name>IndustrialPark</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</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,35 @@ | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("IndustrialParkTest")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("IndustrialParkTest")] | ||
[assembly: AssemblyCopyright("Copyright © 2024")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("BD22CB98-D975-4E37-8707-9FA07C067806")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [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,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="xunit" version="2.1.0" targetFramework="net45" /> | ||
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" /> | ||
<package id="xunit.assert" version="2.1.0" targetFramework="net45" /> | ||
<package id="xunit.core" version="2.1.0" targetFramework="net45" /> | ||
<package id="xunit.extensibility.core" version="2.1.0" targetFramework="net45" /> | ||
<package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net45" /> | ||
</packages> |