public static void OnEvent(this IHasContext obj, IEvent @event)
        {
            if (@event.EventSource == null &&
                obj is IEventSource)
            {
                @event.EventSource = (IEventSource)obj;
            }

            obj.Context.RegisterEvent(@event);
        }
Exemplo n.º 2
0
        protected ContextualCondition(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            bool isNull = info.GetBoolean("_isNull");

            if (!isNull)
            {
                Type        type = (Type)info.GetValue("_type", typeof(Type));
                IHasContext iCtx = this;
                iCtx.Context = info.GetValue("_context", type);
            }
        }
Exemplo n.º 3
0
        void UpdateContext(IHasContext hc)
        {
            switch (hc.ReportPageType) {
                    case WizardPageType.BaseSettingsPage:{
                        context.PageOneContext = hc.Context;
                        break;
                    }

                    case WizardPageType.PushModelPage: {
                        context.PushModelContext = hc.Context;
                        break;
                    }
            }
        }
Exemplo n.º 4
0
        void UpdateContext(IHasContext hc)
        {
            switch (hc.ReportPageType)
            {
            case WizardPageType.BaseSettingsPage: {
                context.PageOneContext = hc.Context;
                break;
            }

            case WizardPageType.PushModelPage: {
                context.PushModelContext = hc.Context;
                break;
            }
            }
        }
        /// <summary>
        /// Gets a value from the capabilities dictionary under the ProviderConfiguration of this RhinoTestCase.
        /// </summary>
        /// <typeparam name="T">The capability type to return.</typeparam>
        /// <param name="onContext">Context dictionary from which to get the capability.</param>
        /// <param name="capability">The capability to get.</param>
        /// <param name="defaultValue">The default value to get if the capability was not found.</param>
        /// <returns>Capability value.</returns>
        public static T GetConnectorCapability <T>(this IHasContext onContext, string capability, T defaultValue = default)
        {
            try
            {
                // setup
                var options = onContext.GetCapability($"{Connector.JiraXRay}:options", new Dictionary <string, object>());

                // setup conditions
                var isKey   = options.ContainsKey(capability);
                var isValue = isKey && !string.IsNullOrEmpty($"{options[capability]}");

                // get
                return(isValue ? (T)options[capability] : defaultValue);
            }
            catch (Exception e) when(e != null)
            {
                return(defaultValue);
            }
        }
 public static void OnInformation(this IHasContext obj, string message, InformationLevel level)
 {
     obj.OnEvent(new InformationEvent(message, level));
 }
 public static void ProcessContext <TContext>(this IHasContext <TContext> t)
     where TContext : class
 {
     //...
 }
 public static void UseLogger <TLogger>(this IHasContext obj, TLogger logger) where TLogger : LoggerBase
 {
     obj.Context.AttachRouter(logger);
 }
 public static void OnCounter(this IHasContext obj, string key, object value)
 {
     obj.OnEvent(new CounterEvent(key, value));
 }
 public static void OnCounter(this IHasContext obj, string key)
 {
     obj.OnCounter(key, null);
 }
 public static void OnDebug(this IHasContext obj, string message)
 {
     obj.OnInformation(message, InformationLevel.Debug);
 }
 public static void OnVerbose(this IHasContext obj, string message)
 {
     obj.OnInformation(message, InformationLevel.Verbose);
 }
 public static void OnWarning(this IHasContext obj, Exception warning, int errorCode)
 {
     obj.OnError(warning, errorCode, ErrorLevel.Warning);
 }
 public static void OnWarning(this IHasContext obj, Exception warning)
 {
     obj.OnWarning(warning, -1);
 }
        public static void OnError(this IHasContext obj, Exception error, int errorCode, ErrorLevel level)
        {
            var errorEvent = new ErrorEvent(error, errorCode, level);

            obj.OnEvent(errorEvent);
        }
 public static void OnError(this IHasContext obj, Exception error, ErrorLevel level)
 {
     obj.OnError(error, -1, level);
 }
 public static void OnError(this IHasContext obj, Exception error, int errorCode)
 {
     obj.OnError(error, errorCode, ErrorLevel.Error);
 }
 public static void OnError(this IHasContext obj, Exception error)
 {
     obj.OnError(error, -1);
 }