-
Notifications
You must be signed in to change notification settings - Fork 476
Expand file tree
/
Copy pathCoreInterceptor.cs
More file actions
41 lines (37 loc) · 1.26 KB
/
CoreInterceptor.cs
File metadata and controls
41 lines (37 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using Castle.Core.Logging;
using Castle.DynamicProxy;
using TestStack.White.Bricks;
using TestStack.White.Configuration;
using TestStack.White.UIItems;
using TestStack.White.UIItems.Actions;
namespace TestStack.White.Interceptors
{
public class CoreInterceptor : IInterceptor
{
private readonly CoreInterceptContext coreInterceptContext;
private readonly ILogger logger = CoreAppXmlConfiguration.Instance.LoggerFactory.Create(typeof(CoreInterceptor));
public CoreInterceptor(IUIItem uiItem, IActionListener actionListener)
{
coreInterceptContext = new CoreInterceptContext(uiItem, actionListener);
}
public virtual void Intercept(IInvocation invocation)
{
coreInterceptContext.VerifyUIItem();
try
{
CoreAppXmlConfiguration.Instance.Interceptors.Process(invocation, coreInterceptContext);
}
catch (Exception e)
{
logger.Error(e.Message);
logger.Error(DynamicProxyInterceptors.ToString(invocation));
throw;
}
}
public virtual CoreInterceptContext Context
{
get { return coreInterceptContext; }
}
}
}