Overview
Correct a latent bug in HeadlessAudioPlayer where StartPlayback records the string "Play" and StopPlayback records the string "Stop". These stale strings date from an earlier interface naming pass. Any test asserting call.Method == "StartPlayback" or call.Method == "StopPlayback" will currently fail.
The fix is a two-line string literal change plus a unit test to prevent regression.
Plan issue
Plan status
Not started
Definition of terms
| Term |
Meaning |
| Recorded call |
A tuple (string Method, string AudioAssetId, object? Arg) appended to HeadlessAudioPlayer.RecordedCalls each time a playback method is invoked. |
Architectural considerations and constraints
- Only string literals change. The tuple structure
(string Method, string AudioAssetId, object? Arg) is preserved unchanged.
SetVolume records "SetVolume" — correct, no change required.
- The fix is entirely inside
HeadlessAudioPlayer.cs; no other files need changing beyond the new test file.
Implementation guide
Plan requirements
Phase 1 — Fix string literals and add regression test
Not started
Objective
Change lines 19 and 23 of HeadlessAudioPlayer.cs. Add a unit test in HeadlessAudioPlayerTests.cs (creating the file if absent) that asserts both method name values.
Technical details
| Method |
Current recorded string |
Correct recorded string |
StartPlayback |
"Play" |
"StartPlayback" |
StopPlayback |
"Stop" |
"StopPlayback" |
SetVolume |
"SetVolume" |
No change required |
File: src/GameEngineAdapter.Headless/HeadlessAudioPlayer.cs, lines 19 and 23.
Phase requirements
Examples
Before:
// src/GameEngineAdapter.Headless/HeadlessAudioPlayer.cs
public void StartPlayback(string audioAssetId, bool loopPlayback = false) =>
_recordedCalls.Add(("Play", audioAssetId, loopPlayback));
public void StopPlayback(string audioAssetId) =>
_recordedCalls.Add(("Stop", audioAssetId, null));
After:
// src/GameEngineAdapter.Headless/HeadlessAudioPlayer.cs
public void StartPlayback(string audioAssetId, bool loopPlayback = false) =>
_recordedCalls.Add(("StartPlayback", audioAssetId, loopPlayback));
public void StopPlayback(string audioAssetId) =>
_recordedCalls.Add(("StopPlayback", audioAssetId, null));
New test:
// src/GameEngineAdapter.UnitTests/HeadlessAudioPlayerTests.cs
public sealed class HeadlessAudioPlayerTests
{
[Fact]
public void StartPlayback_RecordsCorrectMethodName()
{
var player = new HeadlessAudioPlayer();
player.StartPlayback("sfx", false);
Assert.Equal("StartPlayback", player.RecordedCalls[0].Method);
}
[Fact]
public void StopPlayback_RecordsCorrectMethodName()
{
var player = new HeadlessAudioPlayer();
player.StopPlayback("sfx");
Assert.Equal("StopPlayback", player.RecordedCalls[0].Method);
}
}
See also
Overview
Correct a latent bug in
HeadlessAudioPlayerwhereStartPlaybackrecords the string"Play"andStopPlaybackrecords the string"Stop". These stale strings date from an earlier interface naming pass. Any test assertingcall.Method == "StartPlayback"orcall.Method == "StopPlayback"will currently fail.The fix is a two-line string literal change plus a unit test to prevent regression.
Plan issue
Plan status
Not started
Definition of terms
(string Method, string AudioAssetId, object? Arg)appended toHeadlessAudioPlayer.RecordedCallseach time a playback method is invoked.Architectural considerations and constraints
(string Method, string AudioAssetId, object? Arg)is preserved unchanged.SetVolumerecords"SetVolume"— correct, no change required.HeadlessAudioPlayer.cs; no other files need changing beyond the new test file.Implementation guide
Plan requirements
(Not started) Recorded method name for
StartPlaybackis"StartPlayback"HeadlessAudioPlayerStartPlayback("sfx", false)is calledRecordedCalls[0].Method == "StartPlayback"(Not started) Recorded method name for
StopPlaybackis"StopPlayback"HeadlessAudioPlayerStopPlayback("sfx")is calledMethod == "StopPlayback"Phase 1 — Fix string literals and add regression test
Not started
Objective
Change lines 19 and 23 of
HeadlessAudioPlayer.cs. Add a unit test inHeadlessAudioPlayerTests.cs(creating the file if absent) that asserts both method name values.Technical details
StartPlayback"Play""StartPlayback"StopPlayback"Stop""StopPlayback"SetVolume"SetVolume"File:
src/GameEngineAdapter.Headless/HeadlessAudioPlayer.cs, lines 19 and 23.Phase requirements
(Not started) Build succeeds after string literal change
dotnet buildis run(Not started) New unit test passes
HeadlessAudioPlayerExamples
Before:
After:
New test:
See also
docs/plans/phase-2-consistency-fixes.mdPhase 2) #13