public void AndTrueTrue( ) { And <object> and = new And <object>(True <object> .Instance, True <object> .Instance); IViolation <object> violation = and.Check(null); Assert.AreEqual(NonViolation <object> .Instance, violation); }
public void AndFalseFalse( ) { And <object> and = new And <object>(False <object> .Instance, False <object> .Instance); IViolation <object> violation = and.Check(null); Assert.AreNotEqual(NonViolation <object> .Instance, violation); }
/// <summary> /// ステータスをチェック:ステータスが存在しない場合は falseを返す /// </summary> /// <param name="stsmgr"></param> /// <returns></returns> public bool CheckStatus(IStatusManager stsmgr) { if (_op == null && Status != null) { _op = new And(); var coa = Status.Split('&', StringSplitOptions.RemoveEmptyEntries); foreach (var a in coa) { var idx = a.IndexOf("!="); if (idx >= 0) { var eq = new NotEqual { StatusName = StrUtil.Left(a, idx).Trim(), StatusValue = StrUtil.Mid(a, idx + 2), }; _op.Commands.Add(eq); continue; } idx = a.IndexOf("="); if (idx >= 0) { var eq = new Equal { StatusName = StrUtil.Left(a, idx).Trim(), StatusValue = StrUtil.Mid(a, idx + 1).Trim(), }; _op.Commands.Add(eq); continue; } else { if (a.Trim().StartsWith('!')) { _op.Commands.Add(new Equal { StatusName = a.Trim().Substring(1), StatusValue = "False", }); } else { _op.Commands.Add(new NotEqual { StatusName = a.Trim(), StatusValue = "False", }); } } } } return(_op?.Check(stsmgr) ?? false); }