Example #1
0
        public SampleBuyScenarioScope()
        {
            var st = new StackTrace();
            var sf = st.GetFrame(1);

            this._scenarioName = sf.GetMethod().ReflectedType.Name;
            this._watch.Start();

            ConsoleExtensions.WriteColoredLine(ConsoleColor.DarkCyan, $"{new string('>', (TabCount++) * 2)} [Begin Buy Scenario] {this._scenarioName}");
        }
        public void Dispose()
        {
            if (_disposed)
            {
                return;
            }

            _watch.Stop();
            ConsoleExtensions.WriteColoredLine(ConsoleColor.White, $"[End Scenario] {_scenarioName} : {_watch.Elapsed}");
            _disposed = true;
        }
Example #3
0
        public void Dispose()
        {
            if (this._disposed)
            {
                return;
            }

            this._watch.Stop();
            ConsoleExtensions.WriteColoredLine(ConsoleColor.DarkCyan, $"{new string('<', (--TabCount) * 2)} [End Buy Scenario] {this._scenarioName} : {this._watch.Elapsed}");
            this._disposed = true;
        }
        public void Dispose()
        {
            if (_disposed)
            {
                return;
            }

            _watch.Stop();
            ConsoleExtensions.WriteColoredLine(ConsoleColor.DarkGray, $"{new string('<', (--TabCount) * 2)} [End Method] {_methodName} : {_watch.Elapsed}");
            _disposed = true;
        }
 public static void RunPurgeCategoriesMinion()
 {
     using (new SampleMethodScope())
     {
         var result = Proxy.GetValue(new MinionRunner().Context.MinionsContainer().RunMinion(
                                         "Sitecore.Commerce.Plugin.Catalog.PurgeCategoriesMinion, Sitecore.Commerce.Plugin.Catalog",
                                         EnvironmentConstants.AdventureWorksMinions,
                                         null));
         if (result.ResponseCode.EqualsIgnoreCase("Error"))
         {
             ConsoleExtensions.WriteColoredLine(ConsoleColor.Red, $"{result.Messages.FirstOrDefault(m => m.Code.Equals("Error", StringComparison.Ordinal))?.Text}");
         }
     }
 }
        public SampleMethodScope()
        {
            var st = new StackTrace();
            var sf = st.GetFrame(1);

            if (sf.GetMethod().Name.Equals("MoveNext"))
            {
                // The method is an async task
                sf = st.GetFrame(3);
            }

            _methodName = sf.GetMethod().Name;
            _watch.Start();

            ConsoleExtensions.WriteColoredLine(ConsoleColor.DarkGray, $"{new string('>', (TabCount++) * 2)} [Begin Method] {_methodName}");
        }
 public SampleScenarioScope(string scenarioName)
 {
     _scenarioName = scenarioName;
     _watch.Start();
     ConsoleExtensions.WriteColoredLine(ConsoleColor.White, $"[Begin Scenario] {_scenarioName}");
 }