Exemple #1
0
        /// <summary>
        /// Gets the data.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <returns>Web transation datas.</returns>
        public override object GetData(ITabContext context)
        {
            HttpContextBase     httpContext         = new HttpContextWrapper(HttpContext.Current);
            TransactionInstance transactionInstance = TransactionInstance.GetInstance(httpContext);

            return(transactionInstance.Description);
        }
Exemple #2
0
        public void Invoke()
        {
            TransactionInstance instance = TransactionInstance.GetInstance(HttpContext.Current);

            var interfaceProxy = TransactionProxy <IInterfaceProxyTest> .Create(HttpContext.Current, new InterfaceProxyTest());

            string result = interfaceProxy.GetName();

            Assert.AreEqual(result, string.Empty);
            Assert.AreEqual(instance.Description.Details.Count(), 1);

            interfaceProxy = TransactionProxy <IInterfaceProxyTest> .Create(new HttpContextWrapper(HttpContext.Current), new InterfaceProxyTest());

            result = interfaceProxy.GetName();
            Assert.AreEqual(result, string.Empty);
            Assert.AreEqual(instance.Description.Details.First().Details.Count(), 1);

            var marshalProxy = TransactionProxy <MarshalProxyTest> .Create(HttpContext.Current, new MarshalProxyTest());

            result = marshalProxy.GetName();
            Assert.AreEqual(result, string.Empty);
            Assert.AreEqual(instance.Description.Details.First().Details.Count(), 2);

            marshalProxy = TransactionProxy <MarshalProxyTest> .Create(new HttpContextWrapper(HttpContext.Current), new MarshalProxyTest());

            result = marshalProxy.GetName();
            Assert.AreEqual(result, string.Empty);
            Assert.AreEqual(instance.Description.Details.First().Details.Count(), 3);
        }
Exemple #3
0
        public void GetInstance()
        {
            TransactionInstance instanceOne = TransactionInstance.GetInstance(HttpContext.Current);
            TransactionInstance instanceTwo = TransactionInstance.GetInstance(new HttpContextWrapper(HttpContext.Current));

            Assert.AreEqual(instanceOne, instanceTwo);
        }
Exemple #4
0
        /// <summary>
        /// Initializes the context.
        /// </summary>
        protected void InitializeContext()
        {
            var request      = new HttpRequest(string.Empty, "http://localhost/", string.Empty);
            var stringWriter = new StringWriter();
            var response     = new HttpResponse(stringWriter);

            HttpContext.Current = new HttpContext(request, response);
            TransactionInstance instance = TransactionInstance.GetInstance(HttpContext.Current);

            instance.StartTransaction(request.Url, string.Empty, string.Empty);
        }
Exemple #5
0
        public void GetData()
        {
            var request      = new HttpRequest(string.Empty, "http://localhost/", string.Empty);
            var stringWriter = new StringWriter();
            var response     = new HttpResponse(stringWriter);

            HttpContext.Current = new HttpContext(request, response);
            TransactionInstance    instance    = TransactionInstance.GetInstance(HttpContext.Current);
            TransactionDescription description = instance.StartTransaction(request.Url, string.Empty, string.Empty);
            var transactionTab = new TransactionTab();
            var result         = transactionTab.GetData(null) as TransactionDescription;

            Assert.AreEqual(result, description);
        }
Exemple #6
0
        /// <inheritdoc/>
        public IMethodReturn Invoke(IMethodInvocation input, GetNextHandlerDelegate getNext)
        {
            TransactionInstance instance = TransactionInstance.GetInstance(HttpContext.Current);
            TransactionDetail   detail   = instance.StartDetail(input.MethodBase);

            try
            {
                var result = getNext()(input, getNext);
                return(result);
            }
            finally
            {
                instance.StopDetail(detail);
            }
        }