public void 指定した文字列が表示対象か否かの判断() { var dat = new Dat(new[]{CtrlType.TextBox}); dat.Add(true, "AAA"); dat.Add(true, "表示"); dat.Add(true, "123"); dat.Add(true, "アイウ"); const bool isDisplay = true; var logLimit = new LogLimit(dat, isDisplay); //表示する var expected = true; Check(logLimit, "AAA", expected); Check(logLimit, "表示A", expected); Check(logLimit, "表A123", expected); Check(logLimit, "123", expected); Check(logLimit, "12アイウ", expected); //表示しない expected = false; Check(logLimit, "AA", expected); Check(logLimit, "表a示A", expected); Check(logLimit, "表A23", expected); Check(logLimit, "", expected); Check(logLimit, "12アイ", expected); Check(logLimit, null, expected); }
//テスト用 public Logger() { _logLimit = null; _logFile = null; _logView = null; _isJp = true; _nameTag = ""; _useDetailsLog = false; _useLimitString = false; _logger = null; }
//コンストラクタ //kernelの中でCreateLogger()を定義して使用する public Logger(Kernel kernel, LogLimit logLimit, LogFile logFile, LogView logView, bool isJp, String nameTag, bool useDetailsLog, bool useLimitString, ILogger logger) { _kernel = kernel; _logLimit = logLimit; _logFile = logFile; _logView = logView; _isJp = isJp; _nameTag = nameTag; _useDetailsLog = useDetailsLog; _useLimitString = useLimitString; _logger = logger; }
private static void Check(LogLimit logLimit, String str, bool expected) { var actual = logLimit.IsDisplay(str); Assert.That(actual, Is.EqualTo(expected)); }
//Logger�̐��� //���O��ListOption������������Ă���K�v������ public Logger CreateLogger(String nameTag, bool useDetailsLog, ILogger logger) { if (ListOption == null){ Util.RuntimeException("CreateLogger() ListOption==null || LogFile==null"); } var conf = CreateConf("Log"); if (conf == null){ //CreateLogger��g�p����ۂɁAOptionLog�������ł��Ȃ��̂́A�v��̖�肪���� Util.RuntimeException("CreateLogger() conf==null"); return null; } var dat = (Dat) conf.Get("limitString"); var isDisplay = ((int) conf.Get("isDisplay")) == 0; var logLimit = new LogLimit(dat, isDisplay); var useLimitString = (bool) conf.Get("useLimitString"); return new Logger(this,logLimit, LogFile, LogView, _isJp, nameTag, useDetailsLog, useLimitString, logger); }