Task Manager's Startup tab keeps the Run value and writes a StartupApproved\Run value whose odd first byte means off. The client and the Uploader now show such an entry as off; ticking the box removes the marker so the entry runs again, unticking removes it with the Run value, and re-pointing the command after an update leaves it as it is. Core/IO/StartupApproval holds the rule; the registry hive is injectable for tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
22 lines
947 B
C#
22 lines
947 B
C#
using Titano.Core.IO;
|
|
using Titano.Testing;
|
|
|
|
namespace Titano.Core.Tests.Foundation;
|
|
|
|
/// <summary>The switch Task Manager's Startup tab keeps apart from a sign-in entry's command.</summary>
|
|
public sealed class StartupApprovalTests
|
|
{
|
|
[Test]
|
|
public void AnOddFirstByteMeansTurnedOff()
|
|
{
|
|
// As Task Manager writes them: a state, three zero bytes, then the time it was turned off.
|
|
Assert.True(StartupApproval.IsTurnedOff([0x03, 0, 0, 0, 0x60, 0x1B, 0x3C, 0x92, 0x8A, 0x3F, 0xDB, 0x01]));
|
|
Assert.True(StartupApproval.IsTurnedOff([0x01, 0, 0, 0]));
|
|
Assert.False(StartupApproval.IsTurnedOff([0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]));
|
|
Assert.False(StartupApproval.IsTurnedOff([0x06, 0, 0, 0]));
|
|
// Never touched in Task Manager, or a value of another type: the entry is on.
|
|
Assert.False(StartupApproval.IsTurnedOff(null));
|
|
Assert.False(StartupApproval.IsTurnedOff([]));
|
|
}
|
|
}
|