From 0d9fa37b4fa42d9a7e229a7065e9904c3c5b34f2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 5 Apr 2026 08:38:25 +0000 Subject: [PATCH 1/2] Initial plan From a4d06f636823ec01521a97e97939468fb59d85a3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 5 Apr 2026 08:55:26 +0000 Subject: [PATCH 2/2] Add UnitTestDeterministicId test class to WebHtml folder Agent-Logs-Url: https://github.com/webexpress-framework/WebExpress.WebUI/sessions/ce78eb3a-54b0-4482-a0e9-b1bc2923930f Co-authored-by: ReneSchwarzer <31061438+ReneSchwarzer@users.noreply.github.com> --- .../WebHtml/UnitTestDeterministicId.cs | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/WebExpress.WebUI.Test/WebHtml/UnitTestDeterministicId.cs diff --git a/src/WebExpress.WebUI.Test/WebHtml/UnitTestDeterministicId.cs b/src/WebExpress.WebUI.Test/WebHtml/UnitTestDeterministicId.cs new file mode 100644 index 0000000..64d8e1d --- /dev/null +++ b/src/WebExpress.WebUI.Test/WebHtml/UnitTestDeterministicId.cs @@ -0,0 +1,80 @@ +using WebExpress.WebCore.WebHtml; + +namespace WebExpress.WebUI.Test.WebHtml +{ + /// + /// Unit tests for the DeterministicId class. + /// + [Collection("NonParallelTests")] + public class UnitTestDeterministicId + { + /// + /// Tests that two calls to Create from the same callsite produce different identifiers. + /// + [Fact] + public void CreateSameCallsite() + { + // act + var id1 = CallCreate(); + var id2 = CallCreate(); + + // validation + Assert.NotEqual(id1, id2); + } + + /// + /// Tests that Create with different context values produces different identifiers. + /// + [Fact] + public void CreateIndexes() + { + // act + var id1 = CallCreate(0); + var id2 = CallCreate(1); + + // validation + Assert.NotEqual(id1, id2); + } + + /// + /// Tests that calls from different call sites produce different identifiers. + /// + [Fact] + public void CreateDifferentCallsites() + { + // arrange + var callsiteA = new Func(() => DeterministicId.Create()); + var callsiteB = new Func(() => DeterministicId.Create()); + + // act + var id1 = callsiteA(); + var id2 = callsiteB(); + + // validation + Assert.NotEqual(id1, id2); + } + + /// + /// Generates a deterministic identifier. + /// + /// A string that represents the generated deterministic identifier. + private string CallCreate() + { + return DeterministicId.Create(); + } + + /// + /// Generates a deterministic identifier based on the specified context. + /// + /// + /// The context used to influence the generated identifier. + /// + /// + /// A string that represents the generated deterministic identifier. + /// + private string CallCreate(object context) + { + return DeterministicId.Create(context); + } + } +}