コード例 #1
0
        public virtual void Intercept(IInvocation invocation)
        {
            Method method          = new Method(invocation.Method);
            bool   snapShotEnabled = method.HasAttribute(typeof(WorkSnapshotAttribute));

            LastServiceCallStatus lastServiceCallStatus = serviceExecution.Invoking(service, invocation.Method);

            if (lastServiceCallStatus.WasExecuted)
            {
                invocation.ReturnValue = lastServiceCallStatus.ReturnValue;
            }
            else
            {
                if (snapShotEnabled)
                {
                    serviceExecution.TakeSnapshot();
                }
                ReflectedObject reflectedServiceObject = new ReflectedObject(service);
                sessionReport.Begin(invocation.Method.Name);
                try
                {
                    invocation.ReturnValue = reflectedServiceObject.Invoke(invocation.Method, invocation.Arguments);
                    serviceExecution.Invoked(invocation.ReturnValue);
                }
                catch (Exception e)
                {
                    sessionReport.Act();
                    serviceExecution.Error();
                    throw new WhiteException(string.Format("Error Invoking {0}.{1}", reflectedServiceObject.Class.Name, invocation.Method.Name), e.InnerException);
                }
            }
        }
コード例 #2
0
        public virtual void Intercept(IInvocation invocation)
        {
            var  workSnapshotAttributes = invocation.Method.GetCustomAttributes(typeof(WorkSnapshotAttribute), true);
            bool snapShotEnabled        = workSnapshotAttributes.Any();

            LastServiceCallStatus lastServiceCallStatus = serviceExecution.Invoking(service, invocation.Method);

            if (lastServiceCallStatus.WasExecuted)
            {
                invocation.ReturnValue = lastServiceCallStatus.ReturnValue;
            }
            else
            {
                if (snapShotEnabled)
                {
                    serviceExecution.TakeSnapshot();
                }
                sessionReport.Begin(invocation.Method.Name);
                try
                {
                    invocation.ReturnValue = invocation.Method.Invoke(service, invocation.Arguments);
                    serviceExecution.Invoked(invocation.ReturnValue);
                }
                catch (Exception e)
                {
                    sessionReport.Act();
                    serviceExecution.Error();
                    throw new WhiteException(string.Format("Error Invoking {0}.{1}", service.GetType().Name, invocation.Method.Name), e.InnerException);
                }
            }
        }
コード例 #3
0
 public virtual void Intercept(IInvocation invocation)
 {
     if (uiItem == null)
     {
         uiItem = window.Get(searchCriteria);
         if (uiItem == null)
         {
             throw new UIItemSearchException("Could not find UIItem with, " + searchCriteria);
         }
     }
     try
     {
         invocation.ReturnValue = invocation.Method.Invoke(uiItem, invocation.Arguments);
     }
     catch (Exception e)
     {
         sessionReport.Act();
         throw new WhiteException(string.Format("Error Invoking {0}.{1}", uiItem.GetType().Name, invocation.Method.Name), e.InnerException);
     }
 }
コード例 #4
0
 public virtual void Intercept(IInvocation invocation)
 {
     if (reflectedUIItem == null)
     {
         IUIItem uiItem = window.Get(searchCriteria);
         if (uiItem == null)
         {
             throw new UIItemSearchException("Could not find UIItem with, " + searchCriteria);
         }
         reflectedUIItem = new ReflectedObject(uiItem);
     }
     try
     {
         invocation.ReturnValue = reflectedUIItem.Invoke(invocation.Method, invocation.Arguments);
     }
     catch (Exception e)
     {
         sessionReport.Act();
         throw new WhiteException(string.Format("Error Invoking {0}.{1}", reflectedUIItem.Class.Name, invocation.Method.Name), e.InnerException);
     }
 }
コード例 #5
0
 public virtual void Intercept(IInvocation invocation)
 {
     if (uiItem == null)
     {
         uiItem = window.Get(searchCriteria);
         if (uiItem == null)
         {
             throw new UIItemSearchException("Could not find UIItem with, " + searchCriteria);
         }
     }
     try
     {
         var invoker = DelegateInvoker.CreateInvoker(uiItem, invocation.Method);
         invocation.ReturnValue = invoker.Call(invocation.Arguments);
     }
     catch (Exception)
     {
         sessionReport.Act();
         throw;
     }
 }
コード例 #6
0
 public virtual void Closing(AppScreen appScreen)
 {
     sessionReport.Act();
     screenCache.Remove(new ScreenRepositoryCacheKey(appScreen.WindowTitle, appScreen.GetType()));
 }