Skip to content

Commit

Permalink
Add Header test
Browse files Browse the repository at this point in the history
  • Loading branch information
cooolbros committed Jan 3, 2024
1 parent 586afe5 commit 95fb94d
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/HUDMergerTests/Extensions/KeyValuesExtensionsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using VDF.Models;

namespace HUDMerger.Extensions.Tests;

[TestClass()]
public class KeyValuesExtensionsTests
{
[TestMethod()]
public void HeaderTest()
{
// Header
Assert.AreEqual([], new KeyValues([new KeyValue { Key = "Resource/HudLayout.res", Value = new KeyValues(), Conditional = null }]).Header());

// Ignore conditional
Assert.AreEqual([], new KeyValues([new KeyValue { Key = "Resource/HudLayout.res", Value = new KeyValues(), Conditional = "[$WIN32]" }]).Header());

// Replace string
Assert.AreEqual([], new KeyValues([new KeyValue { Key = "Resource/HudLayout.res", Value = "", Conditional = null }]).Header());

// Return KeyValues
Assert.AreEqual([], new KeyValues().Header());

// Append Header
KeyValues keyValues = [];
Assert.AreEqual([], keyValues.Header("Resource/HudLayout.res"));
Assert.IsTrue(keyValues.Any((kv) => kv.Key == "Resource/HudLayout.res" && kv.Value is KeyValues));

// hudanimations_manifest (https://github.com/cooolbros/hud-merger/issues/3)
Assert.AreEqual([], new KeyValues().Header("hudanimations_manifest"));
}
}

0 comments on commit 95fb94d

Please sign in to comment.