Vibe tests

This commit is contained in:
2026-06-18 16:53:37 -04:00
parent 3d4c9c0645
commit 5e1fe81473
3 changed files with 89 additions and 0 deletions
+6
View File
@@ -8,6 +8,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Model", "Model\Model.csproj
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deploy", "Deploy\Deploy.csproj", "{E5E9A799-76C8-43B3-B9C2-3CAEC2B5E1DD}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deploy", "Deploy\Deploy.csproj", "{E5E9A799-76C8-43B3-B9C2-3CAEC2B5E1DD}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{90F32056-6983-4224-8A8C-E797C71633F3}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -30,5 +32,9 @@ Global
{E5E9A799-76C8-43B3-B9C2-3CAEC2B5E1DD}.Debug|Any CPU.Build.0 = Debug|Any CPU {E5E9A799-76C8-43B3-B9C2-3CAEC2B5E1DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E5E9A799-76C8-43B3-B9C2-3CAEC2B5E1DD}.Release|Any CPU.ActiveCfg = Release|Any CPU {E5E9A799-76C8-43B3-B9C2-3CAEC2B5E1DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E5E9A799-76C8-43B3-B9C2-3CAEC2B5E1DD}.Release|Any CPU.Build.0 = Release|Any CPU {E5E9A799-76C8-43B3-B9C2-3CAEC2B5E1DD}.Release|Any CPU.Build.0 = Release|Any CPU
{90F32056-6983-4224-8A8C-E797C71633F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{90F32056-6983-4224-8A8C-E797C71633F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90F32056-6983-4224-8A8C-E797C71633F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{90F32056-6983-4224-8A8C-E797C71633F3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal
+55
View File
@@ -0,0 +1,55 @@
using Chrono.Model;
namespace Tests;
public class CardDataTests
{
[Test]
public void StatEfficiency_CalculatesCorrectly()
{
var card = new CardData { Cost = 2, Attack = 2, Health = 3 };
Assert.That(card.StatEfficiency, Is.EqualTo(2.5f));
}
[Test]
public void StatEfficiency_ReturnsZero_WhenCostIsZero()
{
var card = new CardData { Cost = 0, Attack = 2, Health = 3 };
Assert.That(card.StatEfficiency, Is.EqualTo(0f));
}
[Test]
public void StatEfficiency_ReturnsZero_WhenAttackIsNull()
{
var card = new CardData { Cost = 2, Attack = null, Health = 3 };
Assert.That(card.StatEfficiency, Is.EqualTo(0f));
}
[Test]
public void IsAgent_ReturnsTrue_WhenCategoryIsAgent()
{
var card = new CardData { Category = "Agent" };
Assert.That(card.IsAgent, Is.True);
}
[Test]
public void IsSpell_ReturnsTrue_WhenCategoryIsSpell()
{
var card = new CardData { Category = "Spell" };
Assert.That(card.IsSpell, Is.True);
}
[Test]
public void ImagePath_UsesPlaceholder_WhenImageFileIsNull()
{
var card = new CardData { ImageFile = null };
Assert.That(card.ImagePath, Is.EqualTo("cards/placeholder.png"));
}
[Test]
public void StatEfficiency_RoundsToTwoDecimalPlaces()
{
var card = new CardData { Cost = 3, Attack = 1, Health = 1 }; // (1+1)/3 = 0.666...
Assert.That(card.StatEfficiency, Is.EqualTo(0.67f));
}
}
+28
View File
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.4"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.0"/>
<PackageReference Include="Microsoft.Playwright.NUnit" Version="1.60.0" />
<PackageReference Include="NUnit" Version="4.3.2"/>
<PackageReference Include="NUnit.Analyzers" Version="4.7.0"/>
<PackageReference Include="NUnit3TestAdapter" Version="5.0.0"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup>
<ItemGroup>
<Using Include="NUnit.Framework"/>
</ItemGroup>
</Project>