public void TfsHelperTest()
        {
            var dictTfs = DummyTfsVariable();
            var tfs     = new TfsVariable(dictTfs);

            TFSHelper.Initialize(tfs);
            var usrGroups = TFSHelper.GroupUserJoined();

            Assert.IsTrue(usrGroups.Count > 0);
        }
Beispiel #2
0
        /// <summary>
        /// This is where shell script trigger. A cocoon ;)
        /// </summary>
        /// <param name="dllName"></param>
        /// <param name="className"></param>
        /// <param name="methodName"></param>
        /// <param name="tfsVarRaw"></param>
        /// <param name="usrVarRaw"></param>
        /// <returns></returns>
        public ShellStatu Initializer(string dllName, string className, string methodName, Dictionary <string, string> tfsVarRaw, Dictionary <string, string> usrVarRaw)
        {
            Stopwatch watchGeneral = Stopwatch.StartNew();
            string    taskLongName = string.Empty;

            try
            {
                taskLongName = Path.GetFileNameWithoutExtension(dllName) + " -> " + className;
                var tfsVar = new TfsVariable(tfsVarRaw);
                var usrVar = new UserVariable <Tsetting>(this.GetType().Name, usrVarRaw);
                Logger.Set(usrVar.WorkingPath);

                var bsSetting = usrVar.Config;
                if (bsSetting == null)
                {
                    return(new ShellStatu(false, string.Format("{0}.{1} tasks setting could not deserialized.", className, methodName)));
                }

                TFSHelper.Initialize(tfsVar);

                Stopwatch watchTask = Stopwatch.StartNew();
                var       tmpResult = Job(tfsVar, usrVar);
                watchTask.Stop();

                if (intrDetailContainer.Any() && !tmpResult.Detail.Any())
                {
                    tmpResult.Detail = intrDetailContainer;
                }

                var rtnData = tmpResult == null ? new ShellStatu() : tmpResult.ToShellStatu(taskLongName);
                watchGeneral.Stop();
                rtnData.Msgs.Add(string.Format("*** FINISH > [{0}] task runned/total (ms) : {1}/{2}",
                                               className, watchTask.Elapsed.TotalMilliseconds, watchGeneral.Elapsed.TotalMilliseconds));

                rtnData.Msgs.Add("---------------------------------------");

                return(rtnData);
            }
            catch (Exception ex)
            {
                Logger.Write(ex);
                return(new ShellStatu(false, string.Format("!!! BaseTask.Initializer failed. TaskName = [{0}]. ExDetail = [{1}].", taskLongName, ex)));
            }
        }