Skip to content

Commit

Permalink
add sample test, move Asserts to namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
van800 committed Mar 12, 2020
1 parent cbb1a63 commit 6515c3f
Show file tree
Hide file tree
Showing 13 changed files with 157 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Features/ProjectileCollision/ProjectileCollision.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Godot;

using SkyOfSteel.Misc;


public interface IProjectile
Expand Down
1 change: 1 addition & 0 deletions Items/Items.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Optional;
using System;
using System.Collections.Generic;
using SkyOfSteel.Misc;
using static Godot.Mathf;


Expand Down
2 changes: 1 addition & 1 deletion Items/Logic/Hitscan/Hitscan.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Godot;
using static Godot.Mathf;
using System.Collections.Generic;

using SkyOfSteel.Misc;


public class Hitscan : Spatial
Expand Down
2 changes: 1 addition & 1 deletion Items/Logic/OpenEnd.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Godot;

using SkyOfSteel.Misc;


public class OpenEnd : StaticBody
Expand Down
22 changes: 12 additions & 10 deletions Misc/Assert.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
using System;



public static class Assert
namespace SkyOfSteel.Misc
{
public class AssertException : Exception
{}
public static class Assert
{
public class AssertException : Exception
{}


//Because C# is a silly language where Debug.Assert doesn't quit or throw an exception on failure
public static void ActualAssert(bool Condition)
{
if(!Condition)
throw new AssertException();
//Because C# is a silly language where Debug.Assert doesn't quit or throw an exception on failure
public static void ActualAssert(bool Condition)
{
if(!Condition)
throw new AssertException();
}
}

}
1 change: 1 addition & 0 deletions Player/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Optional;
using System;
using System.Collections.Generic;
using SkyOfSteel.Misc;
using static SteelMath;
using static Godot.Mathf;

Expand Down
2 changes: 1 addition & 1 deletion SkyOfSteel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="**/*.cs" />
<Compile Include="**/*.cs" Exclude="Tests/**" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
Expand Down
8 changes: 8 additions & 0 deletions SkyOfSteel.sln
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkyOfSteel", "SkyOfSteel.csproj", "{D7E2C73A-8536-40EE-AC39-87B5F5970880}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{80CA55CE-C913-4673-BA38-3EF475083450}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -15,5 +17,11 @@ Global
{D7E2C73A-8536-40EE-AC39-87B5F5970880}.Release|Any CPU.Build.0 = Release|Any CPU
{D7E2C73A-8536-40EE-AC39-87B5F5970880}.Tools|Any CPU.ActiveCfg = Tools|Any CPU
{D7E2C73A-8536-40EE-AC39-87B5F5970880}.Tools|Any CPU.Build.0 = Tools|Any CPU
{80CA55CE-C913-4673-BA38-3EF475083450}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{80CA55CE-C913-4673-BA38-3EF475083450}.Debug|Any CPU.Build.0 = Debug|Any CPU
{80CA55CE-C913-4673-BA38-3EF475083450}.Release|Any CPU.ActiveCfg = Release|Any CPU
{80CA55CE-C913-4673-BA38-3EF475083450}.Release|Any CPU.Build.0 = Release|Any CPU
{80CA55CE-C913-4673-BA38-3EF475083450}.Tools|Any CPU.ActiveCfg = Debug|Any CPU
{80CA55CE-C913-4673-BA38-3EF475083450}.Tools|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
EndGlobal
35 changes: 35 additions & 0 deletions Tests/Properties/AssemblyInfo.cs
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("Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Tests")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[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("80CA55CE-C913-4673-BA38-3EF475083450")]

// 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")]
76 changes: 76 additions & 0 deletions Tests/Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit.3.12.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" />
<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>{80CA55CE-C913-4673-BA38-3EF475083450}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Tests</RootNamespace>
<AssemblyName>Tests</AssemblyName>
<TargetFrameworkVersion>v4.7.2</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="GodotSharp, Version=1.0.7333.6225, Culture=neutral, PublicKeyToken=null">
<HintPath>..\.mono\assemblies\Debug\GodotSharp.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb">
<HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="TestsExample.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SkyOfSteel.csproj">
<Project>{d7e2c73a-8536-40ee-ac39-87b5f5970880}</Project>
<Name>SkyOfSteel</Name>
</ProjectReference>
</ItemGroup>
<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. Enable 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('..\packages\NUnit.3.12.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.12.0\build\NUnit.props'))" />
</Target>
<!-- 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>
15 changes: 15 additions & 0 deletions Tests/TestsExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using NUnit.Framework;

namespace Tests
{
[TestFixture]
public class TestsExample
{
[Test]
public void Test()
{

Assert.AreEqual(true, true, "");
}
}
}
4 changes: 4 additions & 0 deletions Tests/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="3.12.0" targetFramework="net471" />
</packages>
1 change: 1 addition & 0 deletions World/World.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System;
using System.Linq;
using System.Collections.Generic;
using SkyOfSteel.Misc;
using static Godot.Mathf;
using static SteelMath;

Expand Down

0 comments on commit 6515c3f

Please sign in to comment.