Clarify script mutation limits
This commit is contained in:
+48
@@ -164,6 +164,54 @@ namespace ZB.MOM.WW.GRAccess.Cli.Tests.Commands
|
||||
source.ShouldContain("return AtomicObjectEdit(FindSingleObject(galaxy, Kind(args), Arg(args, \"name\")), obj => ObjectScriptSettingsSet");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DispatcherScriptDeleteMutation_RequiresConfirmation()
|
||||
{
|
||||
var source = DispatcherSource();
|
||||
var branch = source.Substring(
|
||||
source.IndexOf("case \"scripts-delete\":", StringComparison.Ordinal),
|
||||
source.IndexOf("case \"scripts-set\":", StringComparison.Ordinal) - source.IndexOf("case \"scripts-delete\":", StringComparison.Ordinal));
|
||||
|
||||
branch.ShouldContain("RequireConfirm(args, Arg(args, \"name\"));");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DispatcherScriptSettings_GuardsPackageOnlyNoOpsBeforeSetValue()
|
||||
{
|
||||
var source = DispatcherSource();
|
||||
|
||||
source.ShouldContain("EnsureMutableViaSetValue(attr, scriptName + \".TriggerPeriod\");");
|
||||
source.ShouldContain("EnsureMutableViaSetValue(attr, scriptName + \".TriggerType\");");
|
||||
source.ShouldContain("EnsureMutableViaSetValue(attr, scriptName + \".Expression\");");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DispatcherElapsedMilliseconds_UseDocumentedHundredNanosecondUnits()
|
||||
{
|
||||
var source = DispatcherSource();
|
||||
|
||||
source.ShouldContain("var elapsedMs = Int64ToElapsedTime(Convert.ToInt64(milliseconds * 10000d));");
|
||||
source.ShouldContain("mxValue.PutElapsedTime(ref elapsedMs);");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ScriptCommandDescriptions_CallOutPackageOnlyLimit()
|
||||
{
|
||||
var set = (CommandAttribute)Attribute.GetCustomAttribute(
|
||||
typeof(ObjectScriptsSetCommand),
|
||||
typeof(CommandAttribute));
|
||||
var settings = (CommandAttribute)Attribute.GetCustomAttribute(
|
||||
typeof(ObjectScriptsSettingsSetCommand),
|
||||
typeof(CommandAttribute));
|
||||
|
||||
set.ShouldNotBeNull();
|
||||
settings.ShouldNotBeNull();
|
||||
set.Description.ShouldNotBeNull();
|
||||
settings.Description.ShouldNotBeNull();
|
||||
set.Description!.ShouldContain("package-only");
|
||||
settings.Description!.ShouldContain("mutable");
|
||||
}
|
||||
|
||||
private static string DispatcherSource()
|
||||
{
|
||||
var directory = new DirectoryInfo(Directory.GetCurrentDirectory());
|
||||
|
||||
Reference in New Issue
Block a user