Enable implicit usings (#224)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
* Copyright <EFBFBD> 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,13 +18,9 @@
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using AopAlliance.Intercept;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Aop.Advice
|
||||
{
|
||||
/// <summary>
|
||||
@@ -88,4 +84,4 @@ namespace Spring.Aop.Advice
|
||||
return returnValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
* Copyright <EFBFBD> 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,8 +18,6 @@
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
using NUnit.Framework;
|
||||
@@ -30,8 +28,6 @@ using Spring.Context.Support;
|
||||
using Spring.Objects;
|
||||
using Spring.Objects.Factory.Xml;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Aop.Config
|
||||
{
|
||||
/// <summary>
|
||||
@@ -46,7 +42,7 @@ namespace Spring.Aop.Config
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
{
|
||||
// IS WELLKNOWN NOW
|
||||
//NamespaceParserRegistry.RegisterParser(typeof(AopNamespaceParser));
|
||||
//ctx = new XmlApplicationContext( "assembly://Spring.Aop.Tests/Spring.Aop.Config/AopNamespaceParserTests.xml");
|
||||
@@ -71,11 +67,11 @@ namespace Spring.Aop.Config
|
||||
Assert.IsTrue(AopUtils.IsAopProxy(testObject), "Object should be an AOP proxy");
|
||||
|
||||
IAdvised advised = testObject as IAdvised;
|
||||
Assert.IsNotNull(advised);
|
||||
Assert.IsNotNull(advised);
|
||||
IList<IAdvisor> advisors = advised.Advisors;
|
||||
Assert.IsTrue(advisors.Count > 0, "Advisors should not be empty");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -99,6 +95,6 @@ namespace Spring.Aop.Config
|
||||
return ctx.GetObject("testObject", typeof (ITestObject)) as ITestObject;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using Spring.Context;
|
||||
@@ -25,8 +23,6 @@ using Spring.Context.Support;
|
||||
using Spring.Objects;
|
||||
using Spring.Objects.Factory.Xml;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Aop.Framework.Adapter
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
* Copyright <EFBFBD> 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,12 +18,8 @@
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Aop.Framework.Adapter
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -21,15 +21,12 @@ using System.Runtime.Serialization.Formatters;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Threading;
|
||||
using System.Reflection;
|
||||
using System.Web;
|
||||
using System.Runtime.Remoting;
|
||||
|
||||
using AopAlliance.Aop;
|
||||
using AopAlliance.Intercept;
|
||||
|
||||
using FakeItEasy;
|
||||
|
||||
using Spring.Aop.Framework.Adapter;
|
||||
using Spring.Aop.Interceptor;
|
||||
using Spring.Aop.Support;
|
||||
using Spring.Expressions;
|
||||
@@ -2484,15 +2481,15 @@ namespace Spring.Aop.Framework.DynamicProxy
|
||||
public void ThrowsAdvisorIsInvoked()
|
||||
{
|
||||
// Reacts to HttpException and RemotingException
|
||||
ThrowsAdviceInterceptorTests.MyThrowsHandler th = new ThrowsAdviceInterceptorTests.MyThrowsHandler();
|
||||
var th = new Spring.Aop.Framework.Adapter.ThrowsAdviceInterceptorTests.MyThrowsHandler();
|
||||
IAdvisor matchesEchoAdvisor = new EchoPointcutAdvisor(th);
|
||||
ThrowsAdviceInterceptorTests.Echo target = new ThrowsAdviceInterceptorTests.Echo();
|
||||
var target = new Spring.Aop.Framework.Adapter.ThrowsAdviceInterceptorTests.Echo();
|
||||
target.A = 16;
|
||||
ProxyFactory pf = new ProxyFactory(target);
|
||||
pf.AddAdvice(new NopInterceptor());
|
||||
pf.AddAdvisor(matchesEchoAdvisor);
|
||||
Assert.AreEqual(matchesEchoAdvisor, pf.Advisors[1], "Advisor was added");
|
||||
ThrowsAdviceInterceptorTests.IEcho proxied = (ThrowsAdviceInterceptorTests.IEcho)CreateProxy(pf);
|
||||
var proxied = (Spring.Aop.Framework.Adapter.ThrowsAdviceInterceptorTests.IEcho)CreateProxy(pf);
|
||||
Assert.AreEqual(0, th.GetCalls());
|
||||
Assert.AreEqual(target.A, proxied.A);
|
||||
Assert.AreEqual(0, th.GetCalls());
|
||||
@@ -2508,13 +2505,13 @@ namespace Spring.Aop.Framework.DynamicProxy
|
||||
Assert.AreEqual(ex, caught);
|
||||
}
|
||||
|
||||
ex = new HttpException();
|
||||
ex = new System.Web.HttpException();
|
||||
try
|
||||
{
|
||||
proxied.EchoException(1, ex);
|
||||
Assert.Fail("Should have thrown HttpException");
|
||||
}
|
||||
catch (HttpException caught)
|
||||
catch (System.Web.HttpException caught)
|
||||
{
|
||||
Assert.AreEqual(ex, caught);
|
||||
}
|
||||
@@ -2540,14 +2537,14 @@ namespace Spring.Aop.Framework.DynamicProxy
|
||||
public void AddThrowsAdviceWithoutAdvisor()
|
||||
{
|
||||
// Reacts to ServletException and RemoteException
|
||||
ThrowsAdviceInterceptorTests.MyThrowsHandler th = new ThrowsAdviceInterceptorTests.MyThrowsHandler();
|
||||
var th = new Spring.Aop.Framework.Adapter.ThrowsAdviceInterceptorTests.MyThrowsHandler();
|
||||
|
||||
ThrowsAdviceInterceptorTests.Echo target = new ThrowsAdviceInterceptorTests.Echo();
|
||||
var target = new Spring.Aop.Framework.Adapter.ThrowsAdviceInterceptorTests.Echo();
|
||||
target.A = 16;
|
||||
ProxyFactory pf = new ProxyFactory(target);
|
||||
pf.AddAdvice(new NopInterceptor());
|
||||
pf.AddAdvice(th);
|
||||
ThrowsAdviceInterceptorTests.IEcho proxied = (ThrowsAdviceInterceptorTests.IEcho)CreateProxy(pf);
|
||||
var proxied = (Spring.Aop.Framework.Adapter.ThrowsAdviceInterceptorTests.IEcho) CreateProxy(pf);
|
||||
Assert.AreEqual(0, th.GetCalls());
|
||||
Assert.AreEqual(target.A, proxied.A);
|
||||
Assert.AreEqual(0, th.GetCalls());
|
||||
@@ -2564,13 +2561,13 @@ namespace Spring.Aop.Framework.DynamicProxy
|
||||
}
|
||||
|
||||
// Subclass of RemoteException
|
||||
ex = new RemotingTimeoutException();
|
||||
ex = new System.Runtime.Remoting.RemotingTimeoutException();
|
||||
try
|
||||
{
|
||||
proxied.EchoException(1, ex);
|
||||
Assert.Fail("Should have thrown RemotingTimeoutException");
|
||||
}
|
||||
catch (RemotingTimeoutException caught)
|
||||
catch (System.Runtime.Remoting.RemotingTimeoutException caught)
|
||||
{
|
||||
Assert.AreEqual(ex, caught);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
* Copyright <EFBFBD> 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,16 +18,12 @@
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Policy;
|
||||
using System.Collections;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
|
||||
using AopAlliance.Aop;
|
||||
using AopAlliance.Intercept;
|
||||
@@ -36,7 +32,6 @@ using FakeItEasy;
|
||||
|
||||
using NUnit.Framework;
|
||||
using Spring.Aop.Advice;
|
||||
using Spring.Aop.Framework.Adapter;
|
||||
using Spring.Aop.Interceptor;
|
||||
using Spring.Aop.Support;
|
||||
using Spring.Aop.Target;
|
||||
@@ -49,8 +44,6 @@ using Spring.Objects.Factory.Xml;
|
||||
using Spring.Proxy;
|
||||
using Spring.Threading;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Aop.Framework
|
||||
{
|
||||
/// <summary>
|
||||
@@ -411,12 +404,11 @@ namespace Spring.Aop.Framework
|
||||
public void CanAddThrowsAdviceWithoutAdvisor()
|
||||
{
|
||||
IObjectFactory f = new XmlObjectFactory(new ReadOnlyXmlTestResource("throwsAdvice.xml", GetType()));
|
||||
ThrowsAdviceInterceptorTests.MyThrowsHandler th =
|
||||
(ThrowsAdviceInterceptorTests.MyThrowsHandler)f.GetObject("throwsAdvice");
|
||||
var th = (Spring.Aop.Framework.Adapter.ThrowsAdviceInterceptorTests.MyThrowsHandler) f.GetObject("throwsAdvice");
|
||||
CountingBeforeAdvice cba = (CountingBeforeAdvice)f.GetObject("countingBeforeAdvice");
|
||||
Assert.AreEqual(0, cba.GetCalls());
|
||||
Assert.AreEqual(0, th.GetCalls());
|
||||
ThrowsAdviceInterceptorTests.IEcho echo = (ThrowsAdviceInterceptorTests.IEcho)f.GetObject("throwsAdvised");
|
||||
var echo = (Spring.Aop.Framework.Adapter.ThrowsAdviceInterceptorTests.IEcho) f.GetObject("throwsAdvised");
|
||||
echo.A = 12;
|
||||
Assert.AreEqual(1, cba.GetCalls());
|
||||
Assert.AreEqual(0, th.GetCalls());
|
||||
@@ -434,13 +426,13 @@ namespace Spring.Aop.Framework
|
||||
Assert.AreEqual(0, th.GetCalls());
|
||||
|
||||
// Handler knows how to handle this exception
|
||||
expected = new HttpException();
|
||||
expected = new System.Web.HttpException();
|
||||
try
|
||||
{
|
||||
echo.EchoException(1, expected);
|
||||
Assert.Fail();
|
||||
}
|
||||
catch (HttpException ex)
|
||||
catch (System.Web.HttpException ex)
|
||||
{
|
||||
Assert.AreEqual(expected, ex);
|
||||
}
|
||||
@@ -448,7 +440,7 @@ namespace Spring.Aop.Framework
|
||||
Assert.AreEqual(1, th.GetCalls("HttpException"));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/// <summary> Checks that globals get invoked,
|
||||
/// and that they can add aspect interfaces unavailable
|
||||
/// to other objects. These interfaces don't need
|
||||
@@ -789,7 +781,7 @@ namespace Spring.Aop.Framework
|
||||
{
|
||||
AppDomainSetup setup = new AppDomainSetup();
|
||||
setup.ApplicationBase = Environment.CurrentDirectory;
|
||||
domain = AppDomain.CreateDomain("Spring", new Evidence(AppDomain.CurrentDomain.Evidence), setup);
|
||||
domain = AppDomain.CreateDomain("Spring", new System.Security.Policy.Evidence(AppDomain.CurrentDomain.Evidence), setup);
|
||||
object command = domain.CreateInstanceAndUnwrap(GetType().Assembly.FullName, typeof(RemotableCommand).FullName);
|
||||
|
||||
ProxyFactoryObject fac = new ProxyFactoryObject();
|
||||
@@ -1090,4 +1082,4 @@ namespace Spring.Aop.Framework
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using Spring.Benchmark.Classes;
|
||||
using Spring.Context;
|
||||
using Spring.Context.Support;
|
||||
|
||||
namespace Spring.Benchmark
|
||||
@@ -71,4 +70,4 @@ namespace Spring.Benchmark
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,24 +18,16 @@
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using Spring.Globalization;
|
||||
using Spring.Objects;
|
||||
using Spring.Util;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Context.Support
|
||||
{
|
||||
/// <summary>
|
||||
@@ -301,7 +293,7 @@ namespace Spring.Context.Support
|
||||
messageSource.ResourceManagers = resourceManagerList;
|
||||
object obj = messageSource.GetResourceObject("bubblechamber", CultureInfo.CurrentCulture);
|
||||
Assert.IsNotNull(obj, "expected to retrieve object form resource set");
|
||||
Bitmap bitMap = null;
|
||||
System.Drawing.Bitmap bitMap = null;
|
||||
|
||||
//.NET 1.0 returns this as a base64 string while .NET 1.1 returns it as a Bitmap
|
||||
//There are some isues with resx compatability between framework versions.
|
||||
@@ -312,13 +304,13 @@ namespace Spring.Context.Support
|
||||
string ImageText = obj as string;
|
||||
Byte[] bitmapData = new Byte[ImageText.Length];
|
||||
bitmapData = Convert.FromBase64String(FixBase64ForImage(ImageText));
|
||||
MemoryStream streamBitmap = new MemoryStream(bitmapData);
|
||||
bitMap = new Bitmap((Bitmap)Image.FromStream(streamBitmap));
|
||||
var streamBitmap = new System.IO.MemoryStream(bitmapData);
|
||||
bitMap = new System.Drawing.Bitmap((System.Drawing.Bitmap) System.Drawing.Image.FromStream(streamBitmap));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
bitMap = obj as Bitmap;
|
||||
bitMap = obj as System.Drawing.Bitmap;
|
||||
}
|
||||
Assert.IsNotNull(bitMap, "expected to retrieve BitMap. Instead Type = " + obj.GetType());
|
||||
Assert.AreEqual(146, bitMap.Size.Width, "Width of image wrong");
|
||||
@@ -330,7 +322,7 @@ namespace Spring.Context.Support
|
||||
|
||||
private string FixBase64ForImage(string Image)
|
||||
{
|
||||
StringBuilder sbText = new StringBuilder(Image, Image.Length);
|
||||
var sbText = new System.Text.StringBuilder(Image, Image.Length);
|
||||
sbText.Replace("\r\n", String.Empty);
|
||||
sbText.Replace(" ", String.Empty);
|
||||
return sbText.ToString();
|
||||
@@ -344,7 +336,7 @@ namespace Spring.Context.Support
|
||||
{
|
||||
//Add another resource manager to the list
|
||||
TestObject to = new TestObject();
|
||||
ComponentResourceManager mgr = new ComponentResourceManager(to.GetType());
|
||||
var mgr = new System.ComponentModel.ComponentResourceManager(to.GetType());
|
||||
resourceManagerList.Add(mgr);
|
||||
messageSource.ResourceManagers = resourceManagerList;
|
||||
|
||||
@@ -426,4 +418,4 @@ namespace Spring.Context.Support
|
||||
new object[] { "Mr.", "Anderson" }), "message not as expected");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -24,7 +24,6 @@ using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
using NUnit.Framework;
|
||||
@@ -234,4 +233,4 @@ namespace Spring.Objects.Factory.Config
|
||||
}, "Cannot read config section 'ELNOMBRE' - section not found.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,14 +18,10 @@
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using NUnit.Framework;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Objects.Factory.Config
|
||||
{
|
||||
/// <summary>
|
||||
@@ -113,4 +109,4 @@ namespace Spring.Objects.Factory.Config
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using Spring.Objects.Factory.Support;
|
||||
|
||||
@@ -56,4 +55,4 @@ namespace Spring.Objects.Factory
|
||||
Assert.AreEqual(new string[] { "objA", "objB", "objC", "obj2A", "obj2C" }, names);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
@@ -34,8 +33,6 @@ using FakeItEasy;
|
||||
using NUnit.Framework;
|
||||
|
||||
using Spring.Core.IO;
|
||||
using Spring.Core.TypeResolution;
|
||||
using Spring.Expressions;
|
||||
using Spring.Objects.Factory.Config;
|
||||
using Spring.Objects.Factory.Support;
|
||||
using Spring.Util;
|
||||
@@ -1830,7 +1827,7 @@ namespace Spring.Objects.Factory.Xml
|
||||
[Test]
|
||||
public void TestExpressionAttribute()
|
||||
{
|
||||
TypeRegistry.RegisterType("WebMethod", typeof(WebMethodAttribute));
|
||||
Spring.Core.TypeResolution.TypeRegistry.RegisterType("WebMethod", typeof(WebMethodAttribute));
|
||||
|
||||
IResource resource = new ReadOnlyXmlTestResource("expressions.xml", GetType());
|
||||
XmlObjectFactory xof = new XmlObjectFactory(resource);
|
||||
@@ -1838,8 +1835,8 @@ namespace Spring.Objects.Factory.Xml
|
||||
ExpressionTestObject eto = (ExpressionTestObject) xof.GetObject("to1");
|
||||
Assert.AreEqual(new DateTime(1974, 8, 24).ToString("m"), eto.SomeString);
|
||||
Assert.AreEqual(new DateTime(2004, 8, 14), eto.SomeDate);
|
||||
Assert.IsInstanceOf(typeof(IExpression), eto.ExpressionOne);
|
||||
Assert.IsInstanceOf(typeof(IExpression), eto.ExpressionTwo);
|
||||
Assert.IsInstanceOf(typeof(Spring.Expressions.IExpression), eto.ExpressionOne);
|
||||
Assert.IsInstanceOf(typeof(Spring.Expressions.IExpression), eto.ExpressionTwo);
|
||||
Assert.AreEqual(DateTime.Today, eto.ExpressionOne.GetValue());
|
||||
Assert.AreEqual(String.Empty, eto.ExpressionTwo.GetValue());
|
||||
Assert.IsInstanceOf(typeof(WebMethodAttribute), eto.SomeDictionary["method1"]);
|
||||
@@ -1851,7 +1848,7 @@ namespace Spring.Objects.Factory.Xml
|
||||
[Test]
|
||||
public void TestExpressionElement()
|
||||
{
|
||||
TypeRegistry.RegisterType("WebMethod", typeof(WebMethodAttribute));
|
||||
Spring.Core.TypeResolution.TypeRegistry.RegisterType("WebMethod", typeof(WebMethodAttribute));
|
||||
|
||||
IResource resource = new ReadOnlyXmlTestResource("expressions.xml", GetType());
|
||||
XmlObjectFactory xof = new XmlObjectFactory(resource);
|
||||
@@ -1859,8 +1856,8 @@ namespace Spring.Objects.Factory.Xml
|
||||
ExpressionTestObject eto = (ExpressionTestObject)xof.GetObject("to2");
|
||||
Assert.AreEqual(new DateTime(1974, 8, 24).ToString("m"), eto.SomeString);
|
||||
Assert.AreEqual(new DateTime(2004, 8, 14), eto.SomeDate);
|
||||
Assert.IsInstanceOf(typeof(IExpression), eto.ExpressionOne);
|
||||
Assert.IsInstanceOf(typeof(IExpression), eto.ExpressionTwo);
|
||||
Assert.IsInstanceOf(typeof(Spring.Expressions.IExpression), eto.ExpressionOne);
|
||||
Assert.IsInstanceOf(typeof(Spring.Expressions.IExpression), eto.ExpressionTwo);
|
||||
Assert.AreEqual(DateTime.Today, eto.ExpressionOne.GetValue());
|
||||
Assert.AreEqual(String.Empty, eto.ExpressionTwo.GetValue());
|
||||
Assert.IsInstanceOf(typeof(WebMethodAttribute), eto.SomeDictionary["method1"]);
|
||||
@@ -2052,4 +2049,4 @@ namespace Spring.Objects.Factory.Xml
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,18 +18,13 @@
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Security;
|
||||
|
||||
using NUnit.Framework;
|
||||
using Spring.Context.Support;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Reflection.Dynamic
|
||||
{
|
||||
/// <summary>
|
||||
@@ -157,7 +152,7 @@ namespace Spring.Reflection.Dynamic
|
||||
});
|
||||
Assert.Fail("private field must not be accessible in medium trust: " + fieldInfo);
|
||||
}
|
||||
catch (SecurityException sex)
|
||||
catch (System.Security.SecurityException sex)
|
||||
{
|
||||
Assert.IsTrue( sex.Message.IndexOf("ReflectionPermission") > -1 );
|
||||
}
|
||||
|
||||
@@ -18,19 +18,14 @@
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using NUnit.Framework;
|
||||
using Spring.Context.Support;
|
||||
using Spring.Util;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Reflection.Dynamic
|
||||
{
|
||||
/// <summary>
|
||||
@@ -94,7 +89,7 @@ namespace Spring.Reflection.Dynamic
|
||||
[Test]
|
||||
public void CanCreateWithRestrictedPermissions()
|
||||
{
|
||||
SecurityTemplate.MediumTrustInvoke(new ThreadStart(CanCreateWithRestrictedPermissionsImpl));
|
||||
SecurityTemplate.MediumTrustInvoke(new System.Threading.ThreadStart(CanCreateWithRestrictedPermissionsImpl));
|
||||
}
|
||||
|
||||
private void CanCreateWithRestrictedPermissionsImpl()
|
||||
@@ -107,7 +102,7 @@ namespace Spring.Reflection.Dynamic
|
||||
[Test]
|
||||
public void CanCreatePrivateMethodButThrowsOnInvoke()
|
||||
{
|
||||
SecurityTemplate.MediumTrustInvoke(new ThreadStart(CanCreatePrivateMethodButThrowsOnInvokeImpl));
|
||||
SecurityTemplate.MediumTrustInvoke(new System.Threading.ThreadStart(CanCreatePrivateMethodButThrowsOnInvokeImpl));
|
||||
}
|
||||
|
||||
private void CanCreatePrivateMethodButThrowsOnInvokeImpl()
|
||||
@@ -200,13 +195,13 @@ namespace Spring.Reflection.Dynamic
|
||||
Assert.IsNull(dm.Invoke(null, null)); // this is ok
|
||||
try
|
||||
{
|
||||
dm.Invoke(null); // this is not ok
|
||||
dm.Invoke(null); // this is not ok
|
||||
Assert.Fail();
|
||||
}
|
||||
catch (ArgumentException) { }
|
||||
try
|
||||
{
|
||||
dm.Invoke(null, null, null); // this is not ok
|
||||
dm.Invoke(null, null, null); // this is not ok
|
||||
Assert.Fail();
|
||||
}
|
||||
catch (ArgumentException) { }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
* Copyright <EFBFBD> 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,22 +18,17 @@
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using Spring.Util;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Reflection.Dynamic
|
||||
{
|
||||
/// <summary>
|
||||
/// Unit tests for the SafeProperty class. SafeProperty must pass the same tests
|
||||
/// Unit tests for the SafeProperty class. SafeProperty must pass the same tests
|
||||
/// as DynamicField plus tests for accessing private members.
|
||||
/// </summary>
|
||||
/// <author>Erich Eichinger</author>
|
||||
@@ -48,7 +43,7 @@ namespace Spring.Reflection.Dynamic
|
||||
#if NETCOREAPP
|
||||
private bool CanGenerateVisualBasic => false;
|
||||
#else
|
||||
private bool CanGenerateVisualBasic => SystemUtils.MonoRuntime;
|
||||
private bool CanGenerateVisualBasic => Spring.Util.SystemUtils.MonoRuntime;
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
@@ -127,11 +122,11 @@ namespace Spring.Reflection.Dynamic
|
||||
Assert.AreEqual(2, second.GetValue(something));
|
||||
//this should not cause MethodAccessException because "second" is created using "CreateSafe"
|
||||
second.SetValue(something, 123);
|
||||
|
||||
|
||||
Assert.AreEqual(123, second.GetValue(something));
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Test]
|
||||
public void TestForRestrictiveGetterWithSafeWrapper()
|
||||
{
|
||||
Something something = new Something();
|
||||
@@ -140,12 +135,12 @@ namespace Spring.Reflection.Dynamic
|
||||
//this should be ok, because both get and set of the "Third" property are public
|
||||
third.SetValue(something, 456);
|
||||
Assert.AreEqual(456, third.GetValue(something));
|
||||
|
||||
|
||||
IDynamicProperty first = Create(typeof(Something).GetProperty("First"));
|
||||
first.SetValue(something, 123);
|
||||
//this should not cause MethodAccessException, "first" is createtd using "CreateSafe"
|
||||
Assert.AreEqual(123, first.GetValue(something));
|
||||
}
|
||||
}
|
||||
|
||||
#region VB TestClass Code
|
||||
|
||||
@@ -279,4 +274,4 @@ namespace Spring.Reflection.Dynamic
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Spring.Util
|
||||
@@ -57,7 +55,7 @@ namespace Spring.Util
|
||||
SampleBaseClass i1 = new SampleDerivedClass("1st config val");
|
||||
SampleBaseClass i2 = new SampleFurtherDerivedClass("2nd config val");
|
||||
|
||||
SecurityTemplate.MediumTrustInvoke(new ThreadStart(new CopyCommand(i2, i1).Execute));
|
||||
SecurityTemplate.MediumTrustInvoke(new System.Threading.ThreadStart(new CopyCommand(i2, i1).Execute));
|
||||
Assert.AreEqual(i1, i2);
|
||||
}
|
||||
|
||||
@@ -65,11 +63,11 @@ namespace Spring.Util
|
||||
public void MediumTrustThrowsSecurityExceptionWhenCopyingBetweenTypesFromDifferentModules()
|
||||
{
|
||||
Exception e1 = new Exception("my name is e1");
|
||||
HttpException e2 = new HttpException("my name is e2");
|
||||
var e2 = new System.Web.HttpException("my name is e2");
|
||||
// I know, I am a bit paranoid about that basic assumption
|
||||
Assert.AreNotEqual( e1.GetType().Assembly, e2.GetType().Assembly );
|
||||
|
||||
SecurityTemplate.MediumTrustInvoke(new ThreadStart(new CopyCommand(e2, e1).Execute));
|
||||
SecurityTemplate.MediumTrustInvoke(new System.Threading.ThreadStart(new CopyCommand(e2, e1).Execute));
|
||||
Assert.AreEqual(e1.Message, e2.Message);
|
||||
}
|
||||
#endif
|
||||
@@ -91,9 +89,9 @@ namespace Spring.Util
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region Test Support Classes
|
||||
|
||||
|
||||
public class SampleBaseClass
|
||||
{
|
||||
private const string MyConstant = "SampleBaseClass.MyConstant";
|
||||
@@ -122,7 +120,7 @@ namespace Spring.Util
|
||||
return false;
|
||||
if (ReferenceEquals(this , obj))
|
||||
return true;
|
||||
|
||||
|
||||
SampleBaseClass sampleBaseClass = (SampleBaseClass) obj;
|
||||
if (!Equals(_someReadOnlyVal, sampleBaseClass._someReadOnlyVal)) return false;
|
||||
if (!Equals(_someProtectedReadOnlyVal, sampleBaseClass._someProtectedReadOnlyVal)) return false;
|
||||
@@ -130,7 +128,7 @@ namespace Spring.Util
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class SampleDerivedClass : SampleBaseClass
|
||||
{
|
||||
private string _someConfigVal = "SampleDerivedClass.SomeConfigVal";
|
||||
@@ -147,22 +145,22 @@ namespace Spring.Util
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!base.Equals(obj))
|
||||
if (!base.Equals(obj))
|
||||
return false;
|
||||
|
||||
|
||||
SampleDerivedClass sampleDerivedClass = (SampleDerivedClass)obj;
|
||||
if (!Equals(_someConfigVal, sampleDerivedClass._someConfigVal))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class SampleFurtherDerivedClass : SampleDerivedClass
|
||||
{
|
||||
public SampleFurtherDerivedClass(string someConfigVal) : base(someConfigVal)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -18,14 +18,11 @@
|
||||
|
||||
#endregion
|
||||
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.Threading;
|
||||
using System.Runtime.CompilerServices;
|
||||
using NUnit.Framework;
|
||||
|
||||
@@ -33,8 +30,6 @@ using Spring.Objects;
|
||||
using Spring.Objects.Factory;
|
||||
using Spring.Objects.Factory.Attributes;
|
||||
|
||||
#endregion
|
||||
|
||||
[assembly: InternalsVisibleTo("ReflectionUtils.IsTypeVisible.AssemblyTestName")]
|
||||
|
||||
namespace Spring.Util
|
||||
@@ -1314,7 +1309,7 @@ namespace Spring.Util
|
||||
{
|
||||
AssemblyName assemblyName = new AssemblyName();
|
||||
assemblyName.Name = "AnAssembly";
|
||||
AssemblyBuilder asmBuilder = Thread.GetDomain().DefineDynamicAssembly(
|
||||
AssemblyBuilder asmBuilder = System.Threading.Thread.GetDomain().DefineDynamicAssembly(
|
||||
assemblyName, AssemblyBuilderAccess.Run);
|
||||
ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule("AModule");
|
||||
TypeBuilder classBuilder = modBuilder.DefineType("AClass", TypeAttributes.Public);
|
||||
@@ -1643,4 +1638,4 @@ namespace Spring.Util
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
using log4net.Config;
|
||||
|
||||
using NHibernate;
|
||||
using NHibernate.Bytecode;
|
||||
using NHibernate.Cfg;
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
/*
|
||||
* Copyright © 2002-2011 the original author or authors.
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -19,10 +19,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
@@ -85,7 +82,7 @@ namespace Spring.Data.Common
|
||||
#else
|
||||
const string providerName = "SqlServer-2.0";
|
||||
#endif
|
||||
|
||||
|
||||
AsyncTestTask t1 = new AsyncTestDbProviderFactory(1000, providerName).Start();
|
||||
AsyncTestTask t2 = new AsyncTestDbProviderFactory(1000, providerName).Start();
|
||||
AsyncTestTask t3 = new AsyncTestDbProviderFactory(1000, providerName).Start();
|
||||
@@ -117,10 +114,10 @@ namespace Spring.Data.Common
|
||||
[Test]
|
||||
public void DefaultInstanceWithSqlServer20()
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", false);
|
||||
//IApplicationContext ctx = DbProviderFactory.ApplicationContext;
|
||||
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US", false);
|
||||
//IApplicationContext ctx = DbProviderFactory.ApplicationContext;
|
||||
//Assert.IsNotNull(ctx);
|
||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("tr-TR", false);
|
||||
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("tr-TR", false);
|
||||
IDbProvider provider = DbProviderFactory.GetDbProvider("SqlServer-2.0");
|
||||
AssertIsSqlServer2005(provider);
|
||||
provider = DbProviderFactory.GetDbProvider("System.Data.SqlClient");
|
||||
@@ -257,7 +254,7 @@ namespace Spring.Data.Common
|
||||
{
|
||||
IDbProvider provider = DbProviderFactory.GetDbProvider(providerName);
|
||||
Assert.AreEqual(productName, provider.DbMetadata.ProductName);
|
||||
|
||||
|
||||
var command = provider.CreateCommand();
|
||||
Assert.IsNotNull(command);
|
||||
|
||||
@@ -286,7 +283,7 @@ namespace Spring.Data.Common
|
||||
Assert.AreEqual("MySQL, MySQL provider 1.0.7.30072", provider.DbMetadata.ProductName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
private void AssertIsSqlServer2005(IDbProvider provider)
|
||||
@@ -314,4 +311,4 @@ namespace Spring.Data.Common
|
||||
Assert.IsFalse(Array.IndexOf(codes.BadSqlGrammarCodes, "1xx56") >= 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Runtime.Remoting;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Spring.Transaction.Interceptor
|
||||
@@ -75,10 +74,10 @@ namespace Spring.Transaction.Interceptor
|
||||
Assert.IsTrue( ta.TransactionIsolationLevel == IsolationLevel.RepeatableRead );
|
||||
Assert.IsTrue( ta.TransactionTimeout == 10 );
|
||||
Assert.IsFalse( ta.ReadOnly );
|
||||
Assert.IsTrue( ta.RollbackOn( new SystemException( ) ) );
|
||||
Assert.IsTrue( ta.RollbackOn(new SystemException( ) ) );
|
||||
// Check for our bizarre customized rollback rules
|
||||
Assert.IsTrue( ta.RollbackOn( new DataException( ) ) );
|
||||
Assert.IsTrue( !ta.RollbackOn( new RemotingException( ) ) );
|
||||
Assert.IsTrue( ta.RollbackOn(new DataException( ) ) );
|
||||
Assert.IsTrue( !ta.RollbackOn(new System.Runtime.Remoting.RemotingException( ) ) );
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -94,8 +93,8 @@ namespace Spring.Transaction.Interceptor
|
||||
Assert.IsTrue( ta.ReadOnly );
|
||||
Assert.IsTrue( ta.RollbackOn( new SystemException( ) ) );
|
||||
// Check for our bizarre customized rollback rules
|
||||
Assert.IsFalse( ta.RollbackOn( new DataException( ) ) );
|
||||
Assert.IsTrue( ta.RollbackOn( new RemotingException( ) ) );
|
||||
Assert.IsFalse( ta.RollbackOn(new DataException( ) ) );
|
||||
Assert.IsTrue( ta.RollbackOn(new System.Runtime.Remoting.RemotingException( ) ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -147,7 +146,7 @@ namespace Spring.Transaction.Interceptor
|
||||
Assert.IsTrue( ta.ReadOnly );
|
||||
Assert.IsTrue(ta.RollbackOn(new ArgumentException()));
|
||||
Assert.IsFalse( ta.RollbackOn(new IllegalTransactionStateException()));
|
||||
|
||||
|
||||
source.ClearRollbackRules();
|
||||
Assert.IsFalse( ta == source );
|
||||
source.AddRollbackRule( new RollbackRuleAttribute("ArgumentException"));
|
||||
@@ -155,4 +154,4 @@ namespace Spring.Transaction.Interceptor
|
||||
Assert.AreEqual( ta, source );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Apache.NMS;
|
||||
using NUnit.Framework;
|
||||
using Spring.Collections;
|
||||
|
||||
namespace Spring.Messaging.Nms.Connections
|
||||
{
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using Apache.NMS;
|
||||
using FakeItEasy;
|
||||
using NUnit.Framework;
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#region Imports
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.ServiceModel;
|
||||
|
||||
using Spring.Context;
|
||||
|
||||
Reference in New Issue
Block a user