From 1105bb351b786c49baece88168ed7acb4d8aedfe Mon Sep 17 00:00:00 2001 From: Marko Lahma Date: Fri, 6 Dec 2013 13:05:53 +0200 Subject: [PATCH] clean up usage of obsolete library members, set warnings as error to all projects, fix accordingly --- .../Objects/Factory/Xml/ParserContext.cs | 268 +++++++++--------- src/Spring/Spring.Web/Spring.Web.2010.csproj | 6 +- .../Spring.Web/Util/SecurityCritical.cs | 2 + .../Spring.Aop.Tests.2010.csproj | 7 +- .../Support/AbstractMessageSourceTests.cs | 24 +- .../Support/ApplicationObjectSupportTests.cs | 4 +- .../DefaultMessageSourceResolvableTests.cs | 2 +- .../Support/DelegatingMessageSourceTests.cs | 5 +- .../Support/MessageSourceAccessorTests.cs | 4 +- .../Support/ResourceSetMessageSourceTests.cs | 4 +- .../Formatters/FilteringFormatterTests.cs | 2 +- .../Support/EventManipulationUtilsTests.cs | 4 +- .../Config/AbstractFactoryObjectTests.cs | 4 +- .../Config/CustomConverterConfigurerTests.cs | 3 +- ...ObjectFactoryCreatingFactoryObjectTests.cs | 8 +- .../ObjectReferenceFactoryObjectTests.cs | 2 +- .../Config/PropertyOverrideConfigurerTests.cs | 10 +- .../Config/PropertyPathFactoryObjectTests.cs | 2 +- .../PropertyPlaceholderConfigurerTests.cs | 20 +- .../Config/SharedStateAwareProcessorTests.cs | 10 +- .../Config/TypeAliasConfigurerTests.cs | 3 +- .../VariablePlaceholderConfigurerTests.cs | 2 +- .../DefaultListableObjectFactoryTests.cs | 10 +- .../ObjectDefinitionStoreExceptionTests.cs | 2 +- .../Support/DelegatingMethodReplacerTests.cs | 11 +- .../Support/LookupMethodReplacerTests.cs | 10 +- .../ObjectDefinitionReaderUtilsTests.cs | 11 +- .../Proxy/AbstractProxyTypeBuilderTests.cs | 2 + .../Reflection/Dynamic/DynamicIndexerTests.cs | 3 + .../Spring.Core.Tests/SecurityTemplate.cs | 31 +- .../Spring.Core.Tests.2010.csproj | 10 +- .../Spring.Core.Tests/TestResourceLoader.cs | 2 +- .../Threading/SyncHolderTest.cs | 2 +- .../ValidationNamespaceParserTests.cs | 4 + .../Spring.Data.Integration.Tests.2010.csproj | 2 +- .../HibernateTransactionManagerTests.cs | 104 +++---- .../ConfigSectionSessionScopeSettingsTests.cs | 6 +- .../Support/SessionScopeSettingsTests.cs | 10 +- .../NHibernate/Support/SessionScopeTests.cs | 32 +-- ...NHibernate32.Integration.Tests.2010.csproj | 2 + ...Spring.Data.NHibernate32.Tests.2010.csproj | 2 + ...NHibernate33.Integration.Tests.2010.csproj | 2 + ...Spring.Data.NHibernate33.Tests.2010.csproj | 2 + .../AdoPlatformTransactionManagerTests.cs | 112 ++++---- .../Common/MultiDelegatingDbProviderTests.cs | 4 +- .../Common/UserCredentialsDbProviderTests.cs | 12 +- ...essaging.Nms.Integration.Tests.2010.csproj | 2 + .../Nms/Config/NmsNamespaceHandlerTests.cs | 6 +- .../CachingConnectionFactoryTests.cs | 2 +- .../MessageTransactionManagerTests.cs | 43 ++- .../SingleConnectionFactoryTests.cs | 26 +- .../Nms/Connections/TestConnection.cs | 2 + .../Nms/Core/MessageTemplateTests.cs | 15 +- .../Nms/Core/SimpleMessageConverterTests.cs | 22 +- .../SimpleMessageListenerContainerTests.cs | 20 +- .../Adapter/MessageListenerAdapterTests.cs | 8 +- .../Spring.Messaging.Nms.Tests.2010.csproj | 2 + ...ing.Quartz21.Integration.Tests.2010.csproj | 2 + ...ring.Scheduling.Quartz21.Tests.2010.csproj | 1 + .../Spring.Services.Tests.2010.csproj | 2 +- ...Spring.Testing.Microsoft.Tests.2010.csproj | 6 +- .../Spring.Testing.NUnit.Tests.2010.csproj | 2 + .../Testing/Ado/SimpleAdoTestUtilsTests.cs | 42 +-- .../EndPausedSessionIsClosedA.aspx.cs | 11 +- .../EndPausedSessionIsClosedB.aspx.cs | 11 +- .../EndPausedTest.aspx.cs | 11 +- .../GetParentObjetFromChild.aspx.cs | 11 +- .../WebConversationStateTest/IoeTests.aspx.cs | 11 +- .../RedirectErrorNoPauseConversation.aspx.cs | 14 +- .../SPCLazyLoadTest_A_Begin.aspx.cs | 11 +- .../SPCLazyLoadTest_A_Status.aspx.cs | 11 +- .../SerializeConversationTest.aspx.cs | 25 +- .../SessionIsClosedA.aspx.cs | 11 +- .../SessionIsClosedB.aspx.cs | 11 +- .../TimeOut_NoTimeOut.aspx.cs | 11 +- .../TimeOut_WithTimeOut.aspx.cs | 11 +- ...onversation.NHibernate32.Tests.2010.csproj | 5 +- ...onversation.NHibernate33.Tests.2010.csproj | 2 + .../Spring.Web.Mvc3.Tests.2010.csproj | 3 +- .../Spring.Web.Mvc4.Tests.2010.csproj | 3 +- .../Spring.Web.Mvc5.Tests.2010.csproj | 3 +- .../Spring.Web.Tests.2010.csproj | 2 +- 82 files changed, 539 insertions(+), 626 deletions(-) diff --git a/src/Spring/Spring.Core/Objects/Factory/Xml/ParserContext.cs b/src/Spring/Spring.Core/Objects/Factory/Xml/ParserContext.cs index 2a082210..ecc2d3c8 100644 --- a/src/Spring/Spring.Core/Objects/Factory/Xml/ParserContext.cs +++ b/src/Spring/Spring.Core/Objects/Factory/Xml/ParserContext.cs @@ -1,52 +1,52 @@ -#region License - -/* - * Copyright 2002-2010 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. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#endregion - +#region License + +/* + * Copyright 2002-2010 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. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#endregion + using System; -using System.Collections; -using Spring.Objects.Factory.Config; -using Spring.Objects.Factory.Support; - -namespace Spring.Objects.Factory.Xml -{ - /// - /// Context that gets passed along an object definition parsing process, encapsulating - /// all relevant configuraiton as well as state. - /// - public class ParserContext - { - private readonly XmlReaderContext readerContext; - - private readonly ObjectDefinitionParserHelper parserHelper; - - private readonly IObjectDefinition containingObjectDefinition; - -// private Stack containingComponents = new Stack(); - - /// - /// Initializes a new instance of the class. - /// - /// The parser helper. - public ParserContext(ObjectDefinitionParserHelper parserHelper) - { - this.readerContext = parserHelper.ReaderContext; - this.parserHelper = parserHelper; +using System.Collections; +using Spring.Objects.Factory.Config; +using Spring.Objects.Factory.Support; + +namespace Spring.Objects.Factory.Xml +{ + /// + /// Context that gets passed along an object definition parsing process, encapsulating + /// all relevant configuraiton as well as state. + /// + public class ParserContext + { + private readonly XmlReaderContext readerContext; + + private readonly ObjectDefinitionParserHelper parserHelper; + + private readonly IObjectDefinition containingObjectDefinition; + +// private Stack containingComponents = new Stack(); + + /// + /// Initializes a new instance of the class. + /// + /// The parser helper. + public ParserContext(ObjectDefinitionParserHelper parserHelper) + { + this.readerContext = parserHelper.ReaderContext; + this.parserHelper = parserHelper; } @@ -62,92 +62,92 @@ namespace Spring.Objects.Factory.Xml this.containingObjectDefinition = containingObjectDefinition; } - /// - /// Initializes a new instance of the class. - /// - /// The reader context. + /// + /// Initializes a new instance of the class. + /// + /// The reader context. + /// The parser helper. + [Obsolete("consider using ParserContext(ObjectDefinitionParserHelper) instead", false)] + public ParserContext(XmlReaderContext readerContext, ObjectDefinitionParserHelper parserHelper) + { + this.readerContext = readerContext; + this.parserHelper = parserHelper; + } + + + /// + /// Initializes a new instance of the class. + /// + /// The reader context. /// The parser helper. - [Obsolete("consider using ParserContext(ObjectDefinitionParserHelper) instead", false)] - public ParserContext(XmlReaderContext readerContext, ObjectDefinitionParserHelper parserHelper) - { - this.readerContext = readerContext; - this.parserHelper = parserHelper; - } - - - /// - /// Initializes a new instance of the class. - /// - /// The reader context. - /// The parser helper. /// The containing object definition. [Obsolete("consider using ParserContext(ObjectDefinitionParserHelper, IObjectDefinition) instead", false)] - public ParserContext(XmlReaderContext readerContext, ObjectDefinitionParserHelper parserHelper, IObjectDefinition containingObjectDefinition) - { - this.readerContext = readerContext; - this.parserHelper = parserHelper; - this.containingObjectDefinition = containingObjectDefinition; - } - - - /// - /// Gets the reader context. - /// - /// The reader context. - public XmlReaderContext ReaderContext - { - get { return readerContext; } - } - - /// - /// Gets the registry. - /// - /// The registry. - public IObjectDefinitionRegistry Registry - { - get { return readerContext.Registry; } - } - - - /// - /// Gets the parser helper. - /// - /// The parser helper. - public ObjectDefinitionParserHelper ParserHelper - { - get { return parserHelper; } - } - - - /// - /// Gets the containing object definition. - /// - /// The containing object definition. - public IObjectDefinition ContainingObjectDefinition - { - get { return containingObjectDefinition; } - } - - /// - /// Gets a value indicating whether this instance is nested. - /// - /// true if this instance is nested; otherwise, false. - public bool IsNested - { - get { return containingObjectDefinition != null; } - } - - /// - /// Gets a value indicating whether this instance is default lazy init. - /// - /// - /// true if this instance is default lazy init; otherwise, false. - /// - public bool IsDefaultLazyInit - { - get { return ObjectDefinitionConstants.TrueValue.Equals(ParserHelper.Defaults.LazyInit); } - } - - - } -} + public ParserContext(XmlReaderContext readerContext, ObjectDefinitionParserHelper parserHelper, IObjectDefinition containingObjectDefinition) + { + this.readerContext = readerContext; + this.parserHelper = parserHelper; + this.containingObjectDefinition = containingObjectDefinition; + } + + + /// + /// Gets the reader context. + /// + /// The reader context. + public XmlReaderContext ReaderContext + { + get { return readerContext; } + } + + /// + /// Gets the registry. + /// + /// The registry. + public IObjectDefinitionRegistry Registry + { + get { return readerContext.Registry; } + } + + + /// + /// Gets the parser helper. + /// + /// The parser helper. + public ObjectDefinitionParserHelper ParserHelper + { + get { return parserHelper; } + } + + + /// + /// Gets the containing object definition. + /// + /// The containing object definition. + public IObjectDefinition ContainingObjectDefinition + { + get { return containingObjectDefinition; } + } + + /// + /// Gets a value indicating whether this instance is nested. + /// + /// true if this instance is nested; otherwise, false. + public bool IsNested + { + get { return containingObjectDefinition != null; } + } + + /// + /// Gets a value indicating whether this instance is default lazy init. + /// + /// + /// true if this instance is default lazy init; otherwise, false. + /// + public bool IsDefaultLazyInit + { + get { return ObjectDefinitionConstants.TrueValue.Equals(ParserHelper.Defaults.LazyInit); } + } + + + } +} diff --git a/src/Spring/Spring.Web/Spring.Web.2010.csproj b/src/Spring/Spring.Web/Spring.Web.2010.csproj index 9b688f84..615da920 100644 --- a/src/Spring/Spring.Web/Spring.Web.2010.csproj +++ b/src/Spring/Spring.Web/Spring.Web.2010.csproj @@ -43,7 +43,8 @@ true 4096 false - 618 + + false false false @@ -65,7 +66,8 @@ false 4096 false - 618 + + true false false diff --git a/src/Spring/Spring.Web/Util/SecurityCritical.cs b/src/Spring/Spring.Web/Util/SecurityCritical.cs index d83fd0d2..5d6157fb 100644 --- a/src/Spring/Spring.Web/Util/SecurityCritical.cs +++ b/src/Spring/Spring.Web/Util/SecurityCritical.cs @@ -32,7 +32,9 @@ namespace Spring.Util { internal delegate void PrivilegedCallback(); +#pragma warning disable 618 [SecurityCritical, SecurityTreatAsSafe] +#pragma warning restore 618 [MethodImpl(MethodImplOptions.NoInlining)] internal static void ExecutePrivileged(IStackWalk permission, PrivilegedCallback callback) { diff --git a/test/Spring/Spring.Aop.Tests/Spring.Aop.Tests.2010.csproj b/test/Spring/Spring.Aop.Tests/Spring.Aop.Tests.2010.csproj index 1aeacff6..b40000a9 100644 --- a/test/Spring/Spring.Aop.Tests/Spring.Aop.Tests.2010.csproj +++ b/test/Spring/Spring.Aop.Tests/Spring.Aop.Tests.2010.csproj @@ -47,12 +47,13 @@ false false false - false + true 3 full prompt false - 0612 + + ..\..\..\build\VS.Net.2010\Spring.Aop.Tests\Release\ @@ -71,7 +72,7 @@ true false false - false + true 4 none prompt diff --git a/test/Spring/Spring.Core.Tests/Context/Support/AbstractMessageSourceTests.cs b/test/Spring/Spring.Core.Tests/Context/Support/AbstractMessageSourceTests.cs index 3358dea1..986e1bf2 100644 --- a/test/Spring/Spring.Core.Tests/Context/Support/AbstractMessageSourceTests.cs +++ b/test/Spring/Spring.Core.Tests/Context/Support/AbstractMessageSourceTests.cs @@ -43,7 +43,7 @@ namespace Spring.Context.Support [ExpectedException(typeof (NoSuchMessageException))] public void GetResolvableNullCodes() { - IMessageSourceResolvable res = (IMessageSourceResolvable) mocks.CreateMock(typeof (IMessageSourceResolvable)); + IMessageSourceResolvable res = mocks.StrictMock(); Expect.Call(res.GetCodes()).Return(null); Expect.Call(res.DefaultMessage).Return(null); mocks.ReplayAll(); @@ -57,11 +57,11 @@ namespace Spring.Context.Support string MSGCODE = "nullCode"; object[] MSGARGS = new object[] { "arg1", "arg2" }; - IMessageSourceResolvable res = (IMessageSourceResolvable)mocks.CreateMock(typeof(IMessageSourceResolvable)); + IMessageSourceResolvable res = mocks.StrictMock(); Expect.Call(res.GetArguments()).Return(MSGARGS); Expect.Call(res.GetCodes()).Return(new string[] {MSGCODE}).Repeat.Once(); - IMessageSource parentSource = (IMessageSource)mocks.CreateMock(typeof(IMessageSource)); + IMessageSource parentSource = mocks.StrictMock(); Expect.Call(parentSource.GetMessage(MSGCODE, null, CultureInfo.CurrentCulture, MSGARGS)).Return( "MockMessageSource"); ParentMessageSource = parentSource; @@ -75,7 +75,7 @@ namespace Spring.Context.Support public void GetMessageParentMessageSource() { object[] args = new object[] {"arguments"}; - IMessageSource parentSource = (IMessageSource)mocks.CreateMock(typeof(IMessageSource)); + IMessageSource parentSource = mocks.StrictMock(); Expect.Call(parentSource.GetMessage("null", null, CultureInfo.CurrentCulture, args)).Return( "my parent message"); ParentMessageSource = parentSource; @@ -87,7 +87,7 @@ namespace Spring.Context.Support [Test] public void GetMessageResolvableDefaultMessage() { - IMessageSourceResolvable res = (IMessageSourceResolvable) mocks.CreateMock(typeof (IMessageSourceResolvable)); + IMessageSourceResolvable res = mocks.StrictMock(); Expect.Call(res.DefaultMessage).Return("MyDefaultMessage").Repeat.AtLeastOnce(); Expect.Call(res.GetCodes()).Return(null); Expect.Call(res.GetArguments()).Return(null); @@ -101,8 +101,8 @@ namespace Spring.Context.Support [Test] public void GetMessageResolvableReturnsFirstCode() { - - IMessageSourceResolvable res = (IMessageSourceResolvable)mocks.CreateMock(typeof(IMessageSourceResolvable)); + + IMessageSourceResolvable res = mocks.StrictMock(); Expect.Call(res.DefaultMessage).Return(null).Repeat.AtLeastOnce(); Expect.Call(res.GetCodes()).Return(new string[] {"null"}); Expect.Call(res.GetArguments()).Return(null).Repeat.AtLeastOnce(); @@ -116,7 +116,7 @@ namespace Spring.Context.Support [ExpectedException(typeof (NoSuchMessageException))] public void GetMessageResolvableNoValidMessage() { - IMessageSourceResolvable res = (IMessageSourceResolvable)mocks.CreateMock(typeof(IMessageSourceResolvable)); + IMessageSourceResolvable res = mocks.StrictMock(); Expect.Call(res.DefaultMessage).Return(null).Repeat.AtLeastOnce(); Expect.Call(res.GetCodes()).Return(null); Expect.Call(res.GetArguments()).Return(null).Repeat.AtLeastOnce(); @@ -127,7 +127,7 @@ namespace Spring.Context.Support [Test] public void GetMessageResolvableValidMessageAndCode() { - IMessageSourceResolvable res = (IMessageSourceResolvable)mocks.CreateMock(typeof(IMessageSourceResolvable)); + IMessageSourceResolvable res = mocks.StrictMock(); Expect.Call(res.GetCodes()).Return(new string[] {"code1"}); Expect.Call(res.GetArguments()).Return(new object[] { "my", "arguments" }).Repeat.AtLeastOnce(); mocks.ReplayAll(); @@ -138,7 +138,7 @@ namespace Spring.Context.Support [Test] public void GetMessageResolvableValidMessageAndCodeNullCulture() { - IMessageSourceResolvable res = (IMessageSourceResolvable)mocks.CreateMock(typeof(IMessageSourceResolvable)); + IMessageSourceResolvable res = mocks.StrictMock(); Expect.Call(res.GetCodes()).Return(new string[] { "code1" }); Expect.Call(res.GetArguments()).Return(new object[] { "my", "arguments" }).Repeat.AtLeastOnce(); mocks.ReplayAll(); @@ -183,7 +183,7 @@ namespace Spring.Context.Support [Test] public void GetMessageWithResolvableArguments() { - IMessageSourceResolvable res = (IMessageSourceResolvable)mocks.CreateMock(typeof(IMessageSourceResolvable)); + IMessageSourceResolvable res = mocks.StrictMock(); Expect.Call(res.GetCodes()).Return(new string[] { "code1" }); Expect.Call(res.GetArguments()).Return(new object[] { "my", "resolvable" }).Repeat.AtLeastOnce(); mocks.ReplayAll(); @@ -194,7 +194,7 @@ namespace Spring.Context.Support [Test] public void GetMessageResolvableValidMessageAndCodNullMessageFormat() { - IMessageSourceResolvable res = (IMessageSourceResolvable)mocks.CreateMock(typeof(IMessageSourceResolvable)); + IMessageSourceResolvable res = mocks.StrictMock(); Expect.Call(res.DefaultMessage).Return("myDefaultMessage").Repeat.AtLeastOnce(); Expect.Call(res.GetCodes()).Return(new string[] { "nullCode" }); Expect.Call(res.GetArguments()).Return(null).Repeat.AtLeastOnce(); diff --git a/test/Spring/Spring.Core.Tests/Context/Support/ApplicationObjectSupportTests.cs b/test/Spring/Spring.Core.Tests/Context/Support/ApplicationObjectSupportTests.cs index 2294ad81..d3f948c4 100644 --- a/test/Spring/Spring.Core.Tests/Context/Support/ApplicationObjectSupportTests.cs +++ b/test/Spring/Spring.Core.Tests/Context/Support/ApplicationObjectSupportTests.cs @@ -85,9 +85,11 @@ namespace Spring.Context.Support get { return new DateTime(); } } +#pragma warning disable 67 public event ApplicationEventHandler ContextEvent; +#pragma warning restore 67 - public long StartupDateMilliseconds + public long StartupDateMilliseconds { get { return 0; } } diff --git a/test/Spring/Spring.Core.Tests/Context/Support/DefaultMessageSourceResolvableTests.cs b/test/Spring/Spring.Core.Tests/Context/Support/DefaultMessageSourceResolvableTests.cs index dc4baafc..1ce6af14 100644 --- a/test/Spring/Spring.Core.Tests/Context/Support/DefaultMessageSourceResolvableTests.cs +++ b/test/Spring/Spring.Core.Tests/Context/Support/DefaultMessageSourceResolvableTests.cs @@ -87,7 +87,7 @@ namespace Spring.Context.Support [Test] public void DefaultResolvableFromExistingResolvable() { - IMessageSourceResolvable res = (IMessageSourceResolvable)mocks.CreateMock(typeof(IMessageSourceResolvable)); + IMessageSourceResolvable res = mocks.StrictMock(); Expect.Call(res.DefaultMessage).Return("defaultMessageFromMock").Repeat.AtLeastOnce(); Expect.Call(res.GetCodes()).Return(new string[] { "code1FromMock" }); Expect.Call(res.GetArguments()).Return(new object[] { "ArgumentFromMock" }).Repeat.AtLeastOnce(); diff --git a/test/Spring/Spring.Core.Tests/Context/Support/DelegatingMessageSourceTests.cs b/test/Spring/Spring.Core.Tests/Context/Support/DelegatingMessageSourceTests.cs index 8b54e947..38517ca5 100644 --- a/test/Spring/Spring.Core.Tests/Context/Support/DelegatingMessageSourceTests.cs +++ b/test/Spring/Spring.Core.Tests/Context/Support/DelegatingMessageSourceTests.cs @@ -56,7 +56,7 @@ namespace Spring.Context.Support public void SetUp() { mocks = new MockRepository(); - _messageSource = (IMessageSource)mocks.CreateMock(typeof(IMessageSource)); + _messageSource = mocks.StrictMock(); } [Test] @@ -181,8 +181,7 @@ namespace Spring.Context.Support { const string expectedName = "Rick Evans"; - IMessageSourceResolvable resolvable = - (IMessageSourceResolvable) mocks.CreateMock(typeof (IMessageSourceResolvable)); + IMessageSourceResolvable resolvable = mocks.StrictMock(); Expect.Call(resolvable.DefaultMessage).Return(expectedName); Expect.Call(resolvable.DefaultMessage).Return(expectedName); diff --git a/test/Spring/Spring.Core.Tests/Context/Support/MessageSourceAccessorTests.cs b/test/Spring/Spring.Core.Tests/Context/Support/MessageSourceAccessorTests.cs index 9b451ac6..7f9d69ff 100644 --- a/test/Spring/Spring.Core.Tests/Context/Support/MessageSourceAccessorTests.cs +++ b/test/Spring/Spring.Core.Tests/Context/Support/MessageSourceAccessorTests.cs @@ -55,8 +55,8 @@ namespace Spring.Context.Support public void SetUp() { mocks = new MockRepository(); - mockMsgSource = (IMessageSource) mocks.CreateMock(typeof(IMessageSource)); - mockMsgSourceResolvable = (IMessageSourceResolvable) mocks.CreateMock(typeof(IMessageSourceResolvable)); + mockMsgSource = mocks.StrictMock(); + mockMsgSourceResolvable = mocks.StrictMock(); } [TearDown] diff --git a/test/Spring/Spring.Core.Tests/Context/Support/ResourceSetMessageSourceTests.cs b/test/Spring/Spring.Core.Tests/Context/Support/ResourceSetMessageSourceTests.cs index 4fa9ea12..e9f1c5fe 100644 --- a/test/Spring/Spring.Core.Tests/Context/Support/ResourceSetMessageSourceTests.cs +++ b/test/Spring/Spring.Core.Tests/Context/Support/ResourceSetMessageSourceTests.cs @@ -293,7 +293,7 @@ namespace Spring.Context.Support public void GetResource() { //Add another resource manager to the list - Assembly ass = Assembly.LoadWithPartialName("Spring.Core.Tests"); + Assembly ass = Assembly.Load("Spring.Core.Tests"); string baseName = "Spring" + "." + "Resources.Images"; resourceManagerList.Add(new ResourceManager(baseName, ass)); @@ -408,7 +408,7 @@ namespace Spring.Context.Support public void TwoResourceManagers() { //Add another resource manager to the list - Assembly ass = Assembly.LoadWithPartialName("Spring.Core.Tests"); + Assembly ass = Assembly.Load("Spring.Core.Tests"); string baseName = "Spring" + "." + "Resources.SampleResources"; resourceManagerList.Add(new ResourceManager(baseName, ass)); diff --git a/test/Spring/Spring.Core.Tests/Globalization/Formatters/FilteringFormatterTests.cs b/test/Spring/Spring.Core.Tests/Globalization/Formatters/FilteringFormatterTests.cs index 8a9721be..af89390b 100644 --- a/test/Spring/Spring.Core.Tests/Globalization/Formatters/FilteringFormatterTests.cs +++ b/test/Spring/Spring.Core.Tests/Globalization/Formatters/FilteringFormatterTests.cs @@ -67,7 +67,7 @@ namespace Spring.Globalization.Formatters public void FiltersOnParseAndFormat() { MockRepository mocks = new MockRepository(); - IFormatter underlyingFormatter = (IFormatter) mocks.CreateMock(typeof (IFormatter)); + IFormatter underlyingFormatter = mocks.StrictMock(); TestFilteringFormatter formatter = (TestFilteringFormatter) mocks.PartialMock(typeof (TestFilteringFormatter), underlyingFormatter); string inputText = "inputText"; diff --git a/test/Spring/Spring.Core.Tests/Objects/Events/Support/EventManipulationUtilsTests.cs b/test/Spring/Spring.Core.Tests/Objects/Events/Support/EventManipulationUtilsTests.cs index e7762c3c..027f5bd4 100644 --- a/test/Spring/Spring.Core.Tests/Objects/Events/Support/EventManipulationUtilsTests.cs +++ b/test/Spring/Spring.Core.Tests/Objects/Events/Support/EventManipulationUtilsTests.cs @@ -92,10 +92,12 @@ namespace Spring.Objects.Events.Support.Tests internal class SimpleEventPublisher { +#pragma warning disable 67 public event Delegate1 MyFirstEvent; public event Delegate2 MySecondEvent; public event Delegate3 MyThirdEvent; - } +#pragma warning restore 67 + } internal class SimpleEventSubscriber { diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/AbstractFactoryObjectTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/AbstractFactoryObjectTests.cs index 2638a1bc..5185be19 100644 --- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/AbstractFactoryObjectTests.cs +++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/AbstractFactoryObjectTests.cs @@ -46,7 +46,7 @@ namespace Spring.Objects.Factory.Config [Test] public void DisposeCallbackIsNotInvokedOnDisposeIfInPrototypeMode() { - IDisposable disposable = (IDisposable) mocks.CreateMock(typeof (IDisposable)); + IDisposable disposable = mocks.StrictMock(); DummyFactoryObject factory = new DummyFactoryObject(disposable); mocks.ReplayAll(); factory.IsSingleton = false; @@ -59,7 +59,7 @@ namespace Spring.Objects.Factory.Config [Test] public void DisposeCallbackIsInvokedOnDispose() { - IDisposable disposable = (IDisposable)mocks.CreateMock(typeof(IDisposable)); + IDisposable disposable = mocks.StrictMock(); disposable.Dispose(); LastCall.On(disposable).Repeat.Once(); DummyFactoryObject factory = new DummyFactoryObject(disposable); diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/CustomConverterConfigurerTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/CustomConverterConfigurerTests.cs index 3cff1792..cb1b1d31 100644 --- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/CustomConverterConfigurerTests.cs +++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/CustomConverterConfigurerTests.cs @@ -45,8 +45,7 @@ namespace Spring.Objects.Factory.Config public void SetUp() { mocks = new MockRepository(); - factory = (IConfigurableListableObjectFactory) - mocks.CreateMock(typeof(IConfigurableListableObjectFactory)); + factory = mocks.StrictMock(); } diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/ObjectFactoryCreatingFactoryObjectTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/ObjectFactoryCreatingFactoryObjectTests.cs index 0e2b9aac..ab5f0985 100644 --- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/ObjectFactoryCreatingFactoryObjectTests.cs +++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/ObjectFactoryCreatingFactoryObjectTests.cs @@ -48,11 +48,11 @@ namespace Spring.Objects.Factory.Config public void SunnyDay() { TestObject dude = new TestObject("Rick Evans", 30); - IObjectFactory objectFactory = (IObjectFactory) mocks.CreateMock(typeof (IObjectFactory)); + IObjectFactory objectFactory = mocks.StrictMock(); const string lookupObjectName = "rick"; Expect.Call(objectFactory.GetObject(lookupObjectName)).Return(dude).Repeat.Twice(); ObjectFactoryCreatingFactoryObject factory = new ObjectFactoryCreatingFactoryObject(); - factory.ObjectFactory = (IObjectFactory) objectFactory; + factory.ObjectFactory = objectFactory; factory.TargetObjectName = lookupObjectName; factory.AfterPropertiesSet(); @@ -75,11 +75,11 @@ namespace Spring.Objects.Factory.Config public void PrototypeModeWithSingletonTarget() { TestObject dude = new TestObject("Rick Evans", 30); - IObjectFactory objectFactory = (IObjectFactory)mocks.CreateMock(typeof(IObjectFactory)); + IObjectFactory objectFactory = mocks.StrictMock(); const string lookupObjectName = "rick"; Expect.Call(objectFactory.GetObject(lookupObjectName)).Return(dude).Repeat.Twice(); ObjectFactoryCreatingFactoryObject factory = new ObjectFactoryCreatingFactoryObject(); - factory.ObjectFactory = (IObjectFactory) objectFactory; + factory.ObjectFactory = objectFactory; factory.TargetObjectName = lookupObjectName; factory.IsSingleton = false; factory.AfterPropertiesSet(); diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/ObjectReferenceFactoryObjectTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/ObjectReferenceFactoryObjectTests.cs index 126c1bee..81de0ebe 100644 --- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/ObjectReferenceFactoryObjectTests.cs +++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/ObjectReferenceFactoryObjectTests.cs @@ -42,7 +42,7 @@ namespace Spring.Objects.Factory.Config public void SetUp() { mocks = new MockRepository(); - factory = (IObjectFactory) mocks.CreateMock(typeof(IObjectFactory)); + factory = mocks.StrictMock(); } [Test] diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyOverrideConfigurerTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyOverrideConfigurerTests.cs index ff56d87b..d496f3f8 100644 --- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyOverrideConfigurerTests.cs +++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyOverrideConfigurerTests.cs @@ -144,9 +144,8 @@ namespace Spring.Objects.Factory.Config [Test] public void MalformedOverrideKey() { - IConfigurableListableObjectFactory objectFactory = - (IConfigurableListableObjectFactory) mocks.CreateMock(typeof (IConfigurableListableObjectFactory)); - IConfigurableListableObjectFactory fac = (IConfigurableListableObjectFactory) objectFactory; + IConfigurableListableObjectFactory objectFactory = mocks.StrictMock(); + IConfigurableListableObjectFactory fac = objectFactory; PropertyOverrideConfigurer cfg = new PropertyOverrideConfigurer(); NameValueCollection defaultProperties = new NameValueCollection(); @@ -169,10 +168,9 @@ namespace Spring.Objects.Factory.Config { const string valueTo_NOT_BeOveridden = "Jenny Lewis"; TestObject foo = new TestObject(valueTo_NOT_BeOveridden, 30); - IConfigurableListableObjectFactory objectFactory = - (IConfigurableListableObjectFactory)mocks.CreateMock(typeof(IConfigurableListableObjectFactory)); + IConfigurableListableObjectFactory objectFactory = mocks.StrictMock(); Expect.Call(objectFactory.GetObjectDefinition("rubbish")).Return(null); - IConfigurableListableObjectFactory fac = (IConfigurableListableObjectFactory) objectFactory; + IConfigurableListableObjectFactory fac = objectFactory; PropertyOverrideConfigurer cfg = new PropertyOverrideConfigurer(); NameValueCollection defaultProperties = new NameValueCollection(); diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyPathFactoryObjectTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyPathFactoryObjectTests.cs index d6d04c87..b9a25d69 100644 --- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyPathFactoryObjectTests.cs +++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyPathFactoryObjectTests.cs @@ -43,7 +43,7 @@ namespace Spring.Objects.Factory.Config public void SetUp() { mocks = new MockRepository(); - mockFactory = (IObjectFactory) mocks.CreateMock(typeof (IObjectFactory)); + mockFactory = mocks.StrictMock(); } [Test] diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyPlaceholderConfigurerTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyPlaceholderConfigurerTests.cs index 61549b9f..aeabe979 100644 --- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyPlaceholderConfigurerTests.cs +++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyPlaceholderConfigurerTests.cs @@ -59,7 +59,7 @@ namespace Spring.Objects.Factory.Config public void MismatchBetweenNumberOfConfigNamesAndNumberOfLocations() { PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer(); - cfg.Locations = new IResource[] { (IResource) mocks.CreateMock(typeof(IResource)) }; // will never get to the point where we check the validity + cfg.Locations = new IResource[] { mocks.StrictMock() }; // will never get to the point where we check the validity cfg.ConfigSections = new string[] { "", "" }; cfg.PostProcessObjectFactory((IConfigurableListableObjectFactory) mocks.DynamicMock(typeof(IConfigurableListableObjectFactory))); } @@ -69,7 +69,7 @@ namespace Spring.Objects.Factory.Config public void OneConfigNameIsOKForLotsOfLocations() { PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer(); - IResource mock = (IResource) mocks.CreateMock(typeof(IResource)); + IResource mock = mocks.StrictMock(); Expect.Call(mock.Exists).Return(true); Expect.Call(mock.InputStream).Throw(new FileNotFoundException()); mocks.ReplayAll(); @@ -85,7 +85,7 @@ namespace Spring.Objects.Factory.Config { PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer(); cfg.IgnoreResourceNotFound = false; - IResource mock = (IResource) mocks.CreateMock(typeof(IResource)); + IResource mock = mocks.StrictMock(); Expect.Call(mock.Exists).Return(false); mocks.ReplayAll(); @@ -99,7 +99,7 @@ namespace Spring.Objects.Factory.Config { PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer(); cfg.IgnoreResourceNotFound = true; - IResource mockResource = (IResource) mocks.CreateMock(typeof(IResource)); + IResource mockResource = mocks.StrictMock(); Expect.Call(mockResource.Exists).Return(false); cfg.Location = mockResource; cfg.ConfigSections = new string[] { "" }; @@ -147,7 +147,7 @@ namespace Spring.Objects.Factory.Config pvs.Add(theProperty, placeholder); RootObjectDefinition def = new RootObjectDefinition(typeof(TestObject), pvs); - IConfigurableListableObjectFactory mock = (IConfigurableListableObjectFactory) mocks.CreateMock(typeof(IConfigurableListableObjectFactory)); + IConfigurableListableObjectFactory mock = mocks.StrictMock(); Expect.Call(mock.GetObjectDefinitionNames(false)).Return(new string [] {defName}); Expect.Call(mock.GetObjectDefinition(defName, false)).Return(def); Expect.Call(delegate { mock.AddEmbeddedValueResolver(null); }).IgnoreArguments(); @@ -177,7 +177,7 @@ namespace Spring.Objects.Factory.Config pvs.Add(theProperty, placeholder); RootObjectDefinition def = new RootObjectDefinition(typeof(TestObject), pvs); - IConfigurableListableObjectFactory mock = (IConfigurableListableObjectFactory)mocks.CreateMock(typeof(IConfigurableListableObjectFactory)); + IConfigurableListableObjectFactory mock = mocks.StrictMock(); Expect.Call(mock.GetObjectDefinitionNames(true)).Return(new string[] { defName }); Expect.Call(mock.GetObjectDefinition(defName, true)).Return(def); Expect.Call(delegate { mock.AddEmbeddedValueResolver(null); }).IgnoreArguments(); @@ -421,7 +421,7 @@ namespace Spring.Objects.Factory.Config const string expectedName = "ba${foo}r"; properties.Add("foo", expectedName); - IConfigurableListableObjectFactory mock = (IConfigurableListableObjectFactory) mocks.CreateMock(typeof (IConfigurableListableObjectFactory)); + IConfigurableListableObjectFactory mock = mocks.StrictMock(); Expect.Call(mock.GetObjectDefinitionNames(false)).Return(new string[] {"foo"}); Expect.Call(mock.GetObjectDefinition(null, false)).IgnoreArguments().Return(def); mocks.ReplayAll(); @@ -452,7 +452,7 @@ namespace Spring.Objects.Factory.Config const string expectedName = "Rick"; properties.Add("hope.floats", expectedName); - IConfigurableListableObjectFactory mock = (IConfigurableListableObjectFactory) mocks.CreateMock(typeof (IConfigurableListableObjectFactory)); + IConfigurableListableObjectFactory mock = mocks.StrictMock(); Expect.Call(mock.GetObjectDefinitionNames(false)).Return(new string[] {"foo"}); Expect.Call(mock.GetObjectDefinition(null, false)).IgnoreArguments().Return(def); Expect.Call(delegate { mock.AddEmbeddedValueResolver(null); }).IgnoreArguments(); @@ -482,7 +482,7 @@ namespace Spring.Objects.Factory.Config const string expectedName = "Rick"; properties.Add("hope.floats", expectedName); - IConfigurableListableObjectFactory mock = (IConfigurableListableObjectFactory) mocks.CreateMock(typeof (IConfigurableListableObjectFactory)); + IConfigurableListableObjectFactory mock = mocks.StrictMock(); Expect.Call(mock.GetObjectDefinitionNames(false)).Return(new string[] {"foo"}); Expect.Call(mock.GetObjectDefinition(null, false)).IgnoreArguments().Return(def); Expect.Call(delegate { mock.AddEmbeddedValueResolver(null); }).IgnoreArguments(); @@ -580,7 +580,7 @@ namespace Spring.Objects.Factory.Config pvs.Add("name", placeholder); RootObjectDefinition def = new RootObjectDefinition(typeof(TestObject), pvs); - IConfigurableListableObjectFactory mock = (IConfigurableListableObjectFactory) mocks.CreateMock(typeof(IConfigurableListableObjectFactory)); + IConfigurableListableObjectFactory mock = mocks.StrictMock(); Expect.Call(mock.GetObjectDefinitionNames(false)).Return(new string [] {defName}); Expect.Call(mock.GetObjectDefinition(defName, false)).Return(def); Expect.Call(delegate { mock.AddEmbeddedValueResolver(null); }).IgnoreArguments(); diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/SharedStateAwareProcessorTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/SharedStateAwareProcessorTests.cs index 7807dd56..c113e93e 100644 --- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/SharedStateAwareProcessorTests.cs +++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/SharedStateAwareProcessorTests.cs @@ -114,7 +114,7 @@ namespace Spring.Objects.Factory.Config DefaultListableObjectFactory of = new DefaultListableObjectFactory(); MockRepository mocks = new MockRepository(); - ISharedStateFactory ssf1 = (ISharedStateFactory)mocks.CreateMock( typeof( ISharedStateFactory ) ); + ISharedStateFactory ssf1 = mocks.StrictMock(); ISharedStateAware ssa = (ISharedStateAware)mocks.DynamicMock( typeof( ISharedStateAware ) ); SharedStateAwareProcessor ssap = new SharedStateAwareProcessor(); @@ -140,10 +140,10 @@ namespace Spring.Objects.Factory.Config DefaultListableObjectFactory of = new DefaultListableObjectFactory(); MockRepository mocks = new MockRepository(); - ISharedStateFactory ssf1 = (ISharedStateFactory)mocks.CreateMock( typeof( ISharedStateFactory ) ); - ISharedStateFactory ssf2 = (ISharedStateFactory)mocks.CreateMock( typeof( ISharedStateFactory ) ); - ISharedStateFactory ssf3 = (ISharedStateFactory)mocks.CreateMock( typeof( ISharedStateFactory ) ); - ISharedStateFactory ssf4 = (ISharedStateFactory)mocks.CreateMock( typeof( ISharedStateFactory ) ); + ISharedStateFactory ssf1 = mocks.StrictMock(); + ISharedStateFactory ssf2 = mocks.StrictMock(); + ISharedStateFactory ssf3 = mocks.StrictMock(); + ISharedStateFactory ssf4 = mocks.StrictMock(); IDictionary ssf3ProvidedState = new Hashtable(); SharedStateAwareProcessor ssap = new SharedStateAwareProcessor(); diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/TypeAliasConfigurerTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/TypeAliasConfigurerTests.cs index 26eb0ae0..f7c89d91 100644 --- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/TypeAliasConfigurerTests.cs +++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/TypeAliasConfigurerTests.cs @@ -44,8 +44,7 @@ namespace Spring.Objects.Factory.Config public void SetUp() { mocks = new MockRepository(); - factory = (IConfigurableListableObjectFactory) - mocks.CreateMock(typeof (IConfigurableListableObjectFactory)); + factory = mocks.StrictMock(); } [Test] diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/VariablePlaceholderConfigurerTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/VariablePlaceholderConfigurerTests.cs index d56fec8d..b9d2baca 100644 --- a/test/Spring/Spring.Core.Tests/Objects/Factory/Config/VariablePlaceholderConfigurerTests.cs +++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Config/VariablePlaceholderConfigurerTests.cs @@ -301,7 +301,7 @@ namespace Spring.Objects.Factory.Config pvs.Add(theProperty, placeholder); RootObjectDefinition def = new RootObjectDefinition(typeof(TestObject), pvs); - IConfigurableListableObjectFactory mock = (IConfigurableListableObjectFactory)mocks.CreateMock(typeof(IConfigurableListableObjectFactory)); + IConfigurableListableObjectFactory mock = mocks.StrictMock(); Expect.Call(mock.GetObjectDefinitionNames(true)).Return(new string[] { defName }); Expect.Call(mock.GetObjectDefinition(defName, true)).Return(def); mocks.ReplayAll(); diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/DefaultListableObjectFactoryTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/DefaultListableObjectFactoryTests.cs index b99c2f59..7f5677e5 100644 --- a/test/Spring/Spring.Core.Tests/Objects/Factory/DefaultListableObjectFactoryTests.cs +++ b/test/Spring/Spring.Core.Tests/Objects/Factory/DefaultListableObjectFactoryTests.cs @@ -293,8 +293,8 @@ namespace Spring.Objects.Factory [Test] public void GetObjectPostProcessorCount() { - IObjectPostProcessor proc1 = (IObjectPostProcessor) mocks.CreateMock(typeof (IObjectPostProcessor)); - IObjectPostProcessor proc2 = (IObjectPostProcessor)mocks.CreateMock(typeof(IObjectPostProcessor)); + IObjectPostProcessor proc1 = mocks.StrictMock(); + IObjectPostProcessor proc2 = mocks.StrictMock(); DefaultListableObjectFactory lof = new DefaultListableObjectFactory(); @@ -316,8 +316,8 @@ namespace Spring.Objects.Factory public void GetObjectPostProcessorCountDoesntRespectHierarchy() { - IObjectPostProcessor proc1 = (IObjectPostProcessor)mocks.CreateMock(typeof(IObjectPostProcessor)); - IObjectPostProcessor proc2 = (IObjectPostProcessor)mocks.CreateMock(typeof(IObjectPostProcessor)); + IObjectPostProcessor proc1 = mocks.StrictMock(); + IObjectPostProcessor proc2 = mocks.StrictMock(); DefaultListableObjectFactory child = new DefaultListableObjectFactory(); DefaultListableObjectFactory parent = new DefaultListableObjectFactory(child); @@ -1664,7 +1664,7 @@ namespace Spring.Objects.Factory [Test] public void IgnoreObjectPostProcessorDuplicates() { - IObjectPostProcessor proc1 = (IObjectPostProcessor)mocks.CreateMock(typeof(IObjectPostProcessor)); + IObjectPostProcessor proc1 = mocks.StrictMock(); DefaultListableObjectFactory lof = new DefaultListableObjectFactory(); diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/ObjectDefinitionStoreExceptionTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/ObjectDefinitionStoreExceptionTests.cs index b11104ac..ad06f0ca 100644 --- a/test/Spring/Spring.Core.Tests/Objects/Factory/ObjectDefinitionStoreExceptionTests.cs +++ b/test/Spring/Spring.Core.Tests/Objects/Factory/ObjectDefinitionStoreExceptionTests.cs @@ -48,7 +48,7 @@ namespace Spring.Objects.Factory { string expectedName = "bing"; string expectedResourceDescription = "mock.resource"; - IResource resource = (IResource) mocks.CreateMock(typeof (IResource)); + IResource resource = mocks.StrictMock(); Expect.Call(resource.Description).Return(expectedResourceDescription); mocks.ReplayAll(); ObjectDefinitionStoreException inex diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Support/DelegatingMethodReplacerTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Support/DelegatingMethodReplacerTests.cs index bbdc6968..6c42ae37 100644 --- a/test/Spring/Spring.Core.Tests/Objects/Factory/Support/DelegatingMethodReplacerTests.cs +++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Support/DelegatingMethodReplacerTests.cs @@ -48,7 +48,7 @@ namespace Spring.Objects.Factory.Support [ExpectedException(typeof (ArgumentNullException))] public void InstantiationWithNullDefinition() { - IObjectFactory factory = (IObjectFactory) mocks.CreateMock(typeof (IObjectFactory)); + IObjectFactory factory = mocks.StrictMock(); new DelegatingMethodReplacer(null, factory); } @@ -56,17 +56,16 @@ namespace Spring.Objects.Factory.Support [ExpectedException(typeof (ArgumentNullException))] public void InstantiationWithNullFactory() { - IConfigurableObjectDefinition mock = (IConfigurableObjectDefinition) - mocks.CreateMock(typeof(IConfigurableObjectDefinition)); + IConfigurableObjectDefinition mock = mocks.StrictMock(); new DelegatingMethodReplacer(mock, null); } [Test] public void SunnyDayPath() { - IObjectFactory mockFactory = (IObjectFactory) mocks.CreateMock(typeof(IObjectFactory)); - IConfigurableObjectDefinition mockDefinition = (IConfigurableObjectDefinition) mocks.CreateMock(typeof(IConfigurableObjectDefinition)); - IMethodReplacer mockReplacer = (IMethodReplacer) mocks.CreateMock(typeof(IMethodReplacer)); + IObjectFactory mockFactory = mocks.StrictMock(); + IConfigurableObjectDefinition mockDefinition = mocks.StrictMock(); + IMethodReplacer mockReplacer = mocks.StrictMock(); const string ReplacerObjectName = "replacer"; diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Support/LookupMethodReplacerTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Support/LookupMethodReplacerTests.cs index 78d7a3ea..ddcbdc71 100644 --- a/test/Spring/Spring.Core.Tests/Objects/Factory/Support/LookupMethodReplacerTests.cs +++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Support/LookupMethodReplacerTests.cs @@ -48,7 +48,7 @@ namespace Spring.Objects.Factory.Support [ExpectedException(typeof (ArgumentNullException))] public void InstantiationWithNullDefinition() { - IObjectFactory objectFactory = (IObjectFactory) mocks.CreateMock(typeof (IObjectFactory)); + IObjectFactory objectFactory = mocks.StrictMock(); new LookupMethodReplacer(null, objectFactory); } @@ -56,17 +56,15 @@ namespace Spring.Objects.Factory.Support [ExpectedException(typeof (ArgumentNullException))] public void InstantiationWithNullFactory() { - IConfigurableObjectDefinition configurableObjectDefinition = - (IConfigurableObjectDefinition) mocks.CreateMock(typeof (IConfigurableObjectDefinition)); + var configurableObjectDefinition = mocks.StrictMock(); new LookupMethodReplacer(configurableObjectDefinition, null); } [Test] public void SunnyDayPath() { - IObjectFactory objectFactory = (IObjectFactory)mocks.CreateMock(typeof(IObjectFactory)); - IConfigurableObjectDefinition configurableObjectDefinition = - (IConfigurableObjectDefinition)mocks.CreateMock(typeof(IConfigurableObjectDefinition)); + var objectFactory = mocks.StrictMock(); + var configurableObjectDefinition = mocks.StrictMock(); object expectedLookup = new object(); const string LookupObjectName = "foo"; diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Support/ObjectDefinitionReaderUtilsTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Support/ObjectDefinitionReaderUtilsTests.cs index e9e893ed..dd43aa20 100644 --- a/test/Spring/Spring.Core.Tests/Objects/Factory/Support/ObjectDefinitionReaderUtilsTests.cs +++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Support/ObjectDefinitionReaderUtilsTests.cs @@ -44,11 +44,8 @@ namespace Spring.Objects.Factory.Support public void SetUp() { mocks = new MockRepository(); - registry = (IObjectDefinitionRegistry) - mocks.CreateMock(typeof(IObjectDefinitionRegistry)); - - definition = (IObjectDefinition) - mocks.CreateMock(typeof (IObjectDefinition)); + registry = mocks.StrictMock(); + definition = mocks.StrictMock(); } [Test] @@ -138,9 +135,7 @@ namespace Spring.Objects.Factory.Support [ExpectedException(typeof (ArgumentNullException))] public void GenerateObjectNameWithNullRegistry() { - ObjectDefinitionReaderUtils.GenerateObjectName( - (IConfigurableObjectDefinition) mocks.CreateMock(typeof(IConfigurableObjectDefinition)), - null); + ObjectDefinitionReaderUtils.GenerateObjectName(mocks.StrictMock(), null); } } } \ No newline at end of file diff --git a/test/Spring/Spring.Core.Tests/Proxy/AbstractProxyTypeBuilderTests.cs b/test/Spring/Spring.Core.Tests/Proxy/AbstractProxyTypeBuilderTests.cs index 73ae4aab..e83b94e7 100644 --- a/test/Spring/Spring.Core.Tests/Proxy/AbstractProxyTypeBuilderTests.cs +++ b/test/Spring/Spring.Core.Tests/Proxy/AbstractProxyTypeBuilderTests.cs @@ -860,7 +860,9 @@ namespace Spring.Proxy // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=94803 [Marker] +#pragma warning disable 618 [WebPermission(SecurityAction.Deny)] +#pragma warning restore 618 public class ClassWithSecurityAttribute : IMarkerInterface { } diff --git a/test/Spring/Spring.Core.Tests/Reflection/Dynamic/DynamicIndexerTests.cs b/test/Spring/Spring.Core.Tests/Reflection/Dynamic/DynamicIndexerTests.cs index e247e2e2..78d89225 100644 --- a/test/Spring/Spring.Core.Tests/Reflection/Dynamic/DynamicIndexerTests.cs +++ b/test/Spring/Spring.Core.Tests/Reflection/Dynamic/DynamicIndexerTests.cs @@ -29,6 +29,8 @@ using Spring.Context.Support; #endregion +#pragma warning disable 618 + namespace Spring.Reflection.Dynamic { /// @@ -152,3 +154,4 @@ namespace Spring.Reflection.Dynamic } } +#pragma warning restore 618 diff --git a/test/Spring/Spring.Core.Tests/SecurityTemplate.cs b/test/Spring/Spring.Core.Tests/SecurityTemplate.cs index 28417310..806c1a44 100644 --- a/test/Spring/Spring.Core.Tests/SecurityTemplate.cs +++ b/test/Spring/Spring.Core.Tests/SecurityTemplate.cs @@ -1,19 +1,19 @@ #region License -/* - * Copyright 2002-2010 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. - * See the License for the specific language governing permissions and - * limitations under the License. +/* + * Copyright 2002-2010 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. + * See the License for the specific language governing permissions and + * limitations under the License. */ #endregion @@ -33,6 +33,8 @@ using System.Threading; using System.Web; using System.Web.Configuration; +#pragma warning disable 618 + namespace Spring { /// @@ -517,3 +519,4 @@ namespace Spring // } } } +#pragma warning restore 618 diff --git a/test/Spring/Spring.Core.Tests/Spring.Core.Tests.2010.csproj b/test/Spring/Spring.Core.Tests/Spring.Core.Tests.2010.csproj index 0445cd97..5b109d44 100644 --- a/test/Spring/Spring.Core.Tests/Spring.Core.Tests.2010.csproj +++ b/test/Spring/Spring.Core.Tests/Spring.Core.Tests.2010.csproj @@ -43,11 +43,12 @@ true 4096 false - 67, 618 + + false false false - false + true 4 full prompt @@ -67,11 +68,12 @@ false 4096 false - 618 + + true false false - false + true 4 none prompt diff --git a/test/Spring/Spring.Core.Tests/TestResourceLoader.cs b/test/Spring/Spring.Core.Tests/TestResourceLoader.cs index 93ccb3c9..8a45dd7a 100644 --- a/test/Spring/Spring.Core.Tests/TestResourceLoader.cs +++ b/test/Spring/Spring.Core.Tests/TestResourceLoader.cs @@ -88,7 +88,7 @@ namespace Spring public static Uri GetUri(object context, string ext) { string resname = context.GetType().AssemblyQualifiedName + "#" + ext; - Uri uri = new Uri("testres://inline/" + resname, false); + Uri uri = new Uri("testres://inline/" + resname); return uri; } diff --git a/test/Spring/Spring.Core.Tests/Threading/SyncHolderTest.cs b/test/Spring/Spring.Core.Tests/Threading/SyncHolderTest.cs index eb1a82d4..b126e388 100644 --- a/test/Spring/Spring.Core.Tests/Threading/SyncHolderTest.cs +++ b/test/Spring/Spring.Core.Tests/Threading/SyncHolderTest.cs @@ -14,7 +14,7 @@ namespace Spring.Threading public void SetUp () { mocks = new MockRepository(); - sync = (ISync) mocks.CreateMock(typeof(ISync)); + sync = mocks.StrictMock(); } [TearDown] diff --git a/test/Spring/Spring.Core.Tests/Validation/ValidationNamespaceParserTests.cs b/test/Spring/Spring.Core.Tests/Validation/ValidationNamespaceParserTests.cs index 44e6b242..a32227a3 100644 --- a/test/Spring/Spring.Core.Tests/Validation/ValidationNamespaceParserTests.cs +++ b/test/Spring/Spring.Core.Tests/Validation/ValidationNamespaceParserTests.cs @@ -55,7 +55,9 @@ namespace Spring.Validation XmlReaderContext readerContext = new XmlReaderContext(null, new XmlObjectDefinitionReader(registry)); ObjectDefinitionParserHelper helper = new ObjectDefinitionParserHelper(readerContext); helper.InitDefaults(doc.DocumentElement); +#pragma warning disable 618 ParserContext parserContext = new ParserContext(helper.ReaderContext, helper); +#pragma warning restore 618 ValidationNamespaceParser parser = new ValidationNamespaceParser(); foreach (XmlElement element in doc.DocumentElement.ChildNodes) @@ -162,7 +164,9 @@ namespace Spring.Validation XmlReaderContext readerContext = new XmlReaderContext(null, new XmlObjectDefinitionReader(registry)); ObjectDefinitionParserHelper helper = new ObjectDefinitionParserHelper(readerContext); helper.InitDefaults(doc.DocumentElement); +#pragma warning disable 618 ParserContext parserContext = new ParserContext(helper.ReaderContext, helper); +#pragma warning restore 618 ValidationNamespaceParser parser = new ValidationNamespaceParser(); foreach (XmlElement element in doc.DocumentElement.ChildNodes) diff --git a/test/Spring/Spring.Data.Integration.Tests/Spring.Data.Integration.Tests.2010.csproj b/test/Spring/Spring.Data.Integration.Tests/Spring.Data.Integration.Tests.2010.csproj index 19e012c5..8204a68d 100644 --- a/test/Spring/Spring.Data.Integration.Tests/Spring.Data.Integration.Tests.2010.csproj +++ b/test/Spring/Spring.Data.Integration.Tests/Spring.Data.Integration.Tests.2010.csproj @@ -70,7 +70,7 @@ true false false - false + true 4 none prompt diff --git a/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/HibernateTransactionManagerTests.cs b/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/HibernateTransactionManagerTests.cs index 16172e6f..9c6d7752 100644 --- a/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/HibernateTransactionManagerTests.cs +++ b/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/HibernateTransactionManagerTests.cs @@ -79,12 +79,12 @@ namespace Spring.Data.NHibernate [Test] public void TransactionCommit() { - IDbProvider provider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); - ISessionFactory sessionFactory = (ISessionFactory)mocks.CreateMock(typeof(ISessionFactory)); - ISession session = (ISession)mocks.CreateMock(typeof(ISession)); - ITransaction transaction = (ITransaction) mocks.CreateMock(typeof (ITransaction)); - IQuery query = (IQuery) mocks.CreateMock(typeof (IQuery)); + IDbProvider provider = mocks.StrictMock(); + IDbConnection connection = mocks.StrictMock(); + ISessionFactory sessionFactory = mocks.StrictMock(); + ISession session = mocks.StrictMock(); + ITransaction transaction = mocks.StrictMock(); + IQuery query = mocks.StrictMock(); IList list = new ArrayList(); list.Add("test"); @@ -143,12 +143,12 @@ namespace Spring.Data.NHibernate public void TransactionRollback() { - IDbProvider provider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); - ISessionFactory sessionFactory = (ISessionFactory)mocks.CreateMock(typeof(ISessionFactory)); - ISession session = (ISession)mocks.CreateMock(typeof(ISession)); - ITransaction transaction = (ITransaction)mocks.CreateMock(typeof(ITransaction)); - IDbTransaction adoTransaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + IDbProvider provider = mocks.StrictMock(); + IDbConnection connection = mocks.StrictMock(); + ISessionFactory sessionFactory = mocks.StrictMock(); + ISession session = mocks.StrictMock(); + ITransaction transaction = mocks.StrictMock(); + IDbTransaction adoTransaction = mocks.StrictMock(); using (mocks.Ordered()) { @@ -194,11 +194,11 @@ namespace Spring.Data.NHibernate [Test] public void TransactionRollbackOnly() { - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); - ISessionFactory sessionFactory = (ISessionFactory)mocks.CreateMock(typeof(ISessionFactory)); - ISession session = (ISession)mocks.CreateMock(typeof(ISession)); - ITransaction transaction = (ITransaction)mocks.CreateMock(typeof(ITransaction)); - IDbTransaction adoTransaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + IDbConnection connection = mocks.StrictMock(); + ISessionFactory sessionFactory = mocks.StrictMock(); + ISession session = mocks.StrictMock(); + ITransaction transaction = mocks.StrictMock(); + IDbTransaction adoTransaction = mocks.StrictMock(); using (mocks.Ordered()) { @@ -239,10 +239,10 @@ namespace Spring.Data.NHibernate [Test] public void ParticipatingTransactionWithCommit() { - IDbConnection connection = (IDbConnection) mocks.CreateMock(typeof (IDbConnection)); - ISessionFactory sessionFactory = (ISessionFactory) mocks.CreateMock(typeof (ISessionFactory)); - ISession session = (ISession) mocks.CreateMock(typeof (ISession)); - ITransaction transaction = (ITransaction) mocks.CreateMock(typeof (ITransaction)); + IDbConnection connection = mocks.StrictMock(); + ISessionFactory sessionFactory = mocks.StrictMock(); + ISession session = mocks.StrictMock(); + ITransaction transaction = mocks.StrictMock(); using (mocks.Ordered()) { @@ -277,11 +277,11 @@ namespace Spring.Data.NHibernate [Test] public void ParticipatingTransactionWithRollback() { - IDbConnection connection = (IDbConnection) mocks.CreateMock(typeof (IDbConnection)); - ISessionFactory sessionFactory = (ISessionFactory) mocks.CreateMock(typeof (ISessionFactory)); - ISession session = (ISession) mocks.CreateMock(typeof (ISession)); - ITransaction transaction = (ITransaction) mocks.CreateMock(typeof (ITransaction)); - IDbTransaction adoTransaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + IDbConnection connection = mocks.StrictMock(); + ISessionFactory sessionFactory = mocks.StrictMock(); + ISession session = mocks.StrictMock(); + ITransaction transaction = mocks.StrictMock(); + IDbTransaction adoTransaction = mocks.StrictMock(); using (mocks.Ordered()) { @@ -322,11 +322,11 @@ namespace Spring.Data.NHibernate [Test] public void ParticipatingTransactionWithRollbackOnly() { - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); - ISessionFactory sessionFactory = (ISessionFactory)mocks.CreateMock(typeof(ISessionFactory)); - ISession session = (ISession)mocks.CreateMock(typeof(ISession)); - ITransaction transaction = (ITransaction)mocks.CreateMock(typeof(ITransaction)); - IDbTransaction adoTransaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + IDbConnection connection = mocks.StrictMock(); + ISessionFactory sessionFactory = mocks.StrictMock(); + ISession session = mocks.StrictMock(); + ITransaction transaction = mocks.StrictMock(); + IDbTransaction adoTransaction = mocks.StrictMock(); using (mocks.Ordered()) { @@ -368,11 +368,11 @@ namespace Spring.Data.NHibernate [Test] public void ParticipatingTransactionWithWithRequiresNew() { - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); - ISessionFactory sessionFactory = (ISessionFactory)mocks.CreateMock(typeof(ISessionFactory)); - ISession session1 = (ISession)mocks.CreateMock(typeof(ISession)); - ISession session2 = (ISession)mocks.CreateMock(typeof(ISession)); - ITransaction transaction = (ITransaction)mocks.CreateMock(typeof(ITransaction)); + IDbConnection connection = mocks.StrictMock(); + ISessionFactory sessionFactory = mocks.StrictMock(); + ISession session1 = mocks.StrictMock(); + ISession session2 = mocks.StrictMock(); + ITransaction transaction = mocks.StrictMock(); //using (mocks.Ordered()) //{ @@ -418,10 +418,10 @@ namespace Spring.Data.NHibernate [Test] public void ParticipatingTransactionWithWithNotSupported() { - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); - ISessionFactory sessionFactory = (ISessionFactory)mocks.CreateMock(typeof(ISessionFactory)); - ISession session = (ISession)mocks.CreateMock(typeof(ISession)); - ITransaction transaction = (ITransaction)mocks.CreateMock(typeof(ITransaction)); + IDbConnection connection = mocks.StrictMock(); + ISessionFactory sessionFactory = mocks.StrictMock(); + ISession session = mocks.StrictMock(); + ITransaction transaction = mocks.StrictMock(); //using (mocks.Ordered()) //{ @@ -461,8 +461,8 @@ namespace Spring.Data.NHibernate [Test] public void TransactionWithPropagationSupports() { - ISessionFactory sessionFactory = (ISessionFactory)mocks.CreateMock(typeof(ISessionFactory)); - ISession session = (ISession)mocks.CreateMock(typeof(ISession)); + ISessionFactory sessionFactory = mocks.StrictMock(); + ISession session = mocks.StrictMock(); Expect.Call(sessionFactory.OpenSession()).Return(session); Expect.Call(session.FlushMode).Return(FlushMode.Never); @@ -500,11 +500,11 @@ namespace Spring.Data.NHibernate [Test] public void TransactionWithPropagationSupportsAndInnerTransaction() { - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); - ISessionFactory sessionFactory = (ISessionFactory)mocks.CreateMock(typeof(ISessionFactory)); - ISession session1 = (ISession)mocks.CreateMock(typeof(ISession)); - ISession session2 = (ISession)mocks.CreateMock(typeof(ISession)); - ITransaction transaction = (ITransaction)mocks.CreateMock(typeof(ITransaction)); + IDbConnection connection = mocks.StrictMock(); + ISessionFactory sessionFactory = mocks.StrictMock(); + ISession session1 = mocks.StrictMock(); + ISession session2 = mocks.StrictMock(); + ITransaction transaction = mocks.StrictMock(); Expect.Call(sessionFactory.OpenSession()).Return(session1); Expect.Call(session1.Connection).Return(connection); @@ -586,11 +586,11 @@ namespace Spring.Data.NHibernate #region Mock Setup IDbProvider provider = new TestDbProvider(); - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); - ISessionFactory sessionFactory = (ISessionFactory)mocks.CreateMock(typeof(ISessionFactory)); - ISession session = (ISession)mocks.CreateMock(typeof(ISession)); - ITransaction transaction = (ITransaction)mocks.CreateMock(typeof(ITransaction)); - IDbTransaction adoTransaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + IDbConnection connection = mocks.StrictMock(); + ISessionFactory sessionFactory = mocks.StrictMock(); + ISession session = mocks.StrictMock(); + ITransaction transaction = mocks.StrictMock(); + IDbTransaction adoTransaction = mocks.StrictMock(); Exception rootCause = null; using (mocks.Ordered()) diff --git a/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/Support/ConfigSectionSessionScopeSettingsTests.cs b/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/Support/ConfigSectionSessionScopeSettingsTests.cs index b5aaa808..423f5c03 100644 --- a/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/Support/ConfigSectionSessionScopeSettingsTests.cs +++ b/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/Support/ConfigSectionSessionScopeSettingsTests.cs @@ -46,7 +46,7 @@ namespace Spring.Data.NHibernate.Support // setup expected values MockRepository mocks = new MockRepository(); - ISessionFactory expectedSessionFactory = (ISessionFactory)mocks.CreateMock(typeof(ISessionFactory)); + ISessionFactory expectedSessionFactory = mocks.StrictMock(); IInterceptor expectedEntityInterceptor = null; bool expectedSingleSession = SessionScopeSettings.SINGLESESSION_DEFAULT; FlushMode expectedDefaultFlushMode = SessionScopeSettings.FLUSHMODE_DEFAULT; @@ -73,8 +73,8 @@ namespace Spring.Data.NHibernate.Support string ENTITYINTERCEPTOR_OBJECTNAME = "EntityInterceptor"; MockRepository mocks = new MockRepository(); - ISessionFactory expectedSessionFactory = (ISessionFactory) mocks.CreateMock(typeof(ISessionFactory)); - IInterceptor expectedEntityInterceptor = (IInterceptor) mocks.CreateMock(typeof(IInterceptor)); + ISessionFactory expectedSessionFactory = mocks.StrictMock(); + IInterceptor expectedEntityInterceptor = mocks.StrictMock(); bool expectedSingleSession = false; FlushMode expectedDefaultFlushMode = FlushMode.Auto; diff --git a/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/Support/SessionScopeSettingsTests.cs b/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/Support/SessionScopeSettingsTests.cs index 923fa9da..8dbf0c99 100644 --- a/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/Support/SessionScopeSettingsTests.cs +++ b/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/Support/SessionScopeSettingsTests.cs @@ -81,8 +81,8 @@ namespace Spring.Data.NHibernate.Support public void WorksAsExpected() { MockRepository mocks = new MockRepository(); - ISessionFactory sessionFactory = (ISessionFactory) mocks.CreateMock(typeof(ISessionFactory)); - IInterceptor entityInterceptor = (IInterceptor) mocks.CreateMock(typeof(IInterceptor)); + ISessionFactory sessionFactory = mocks.StrictMock(); + IInterceptor entityInterceptor = mocks.StrictMock(); Assert.AreNotEqual( FlushMode.Auto, SessionScopeSettings.FLUSHMODE_DEFAULT ); // ensure noone changed our assumptions SessionScopeSettings sss = new SessionScopeSettings(sessionFactory, entityInterceptor, !SessionScopeSettings.SINGLESESSION_DEFAULT, FlushMode.Auto ); @@ -115,8 +115,8 @@ namespace Spring.Data.NHibernate.Support public void CallingDefaultConstructorCausesLazyResolvingReferences() { MockRepository mocks = new MockRepository(); - ISessionFactory expectedSessionFactory = (ISessionFactory)mocks.CreateMock(typeof(ISessionFactory)); - IInterceptor expectedEntityInterceptor = (IInterceptor)mocks.CreateMock(typeof(IInterceptor)); + ISessionFactory expectedSessionFactory = mocks.StrictMock(); + IInterceptor expectedEntityInterceptor = mocks.StrictMock(); SessionScopeSettings sss = new LazyResolvingSessionScopeSettings(expectedSessionFactory, expectedEntityInterceptor); @@ -145,7 +145,7 @@ namespace Spring.Data.NHibernate.Support public void MissingEntityInterceptorIsOkDuringLazyResolving() { MockRepository mocks = new MockRepository(); - ISessionFactory expectedSessionFactory = (ISessionFactory)mocks.CreateMock(typeof(ISessionFactory)); + ISessionFactory expectedSessionFactory = mocks.StrictMock(); SessionScopeSettings sss = new LazyResolvingSessionScopeSettings(expectedSessionFactory, null); diff --git a/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/Support/SessionScopeTests.cs b/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/Support/SessionScopeTests.cs index 298123c9..c20cdd29 100644 --- a/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/Support/SessionScopeTests.cs +++ b/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/Support/SessionScopeTests.cs @@ -37,7 +37,7 @@ namespace Spring.Data.NHibernate.Support [TestFixture] public class SessionScopeTests { - private MockRepository repository; + private MockRepository mocks; private ISessionFactory expectedSessionFactory; private IInterceptor expectedEntityInterceptor; private bool expectedSingleSession; @@ -46,9 +46,9 @@ namespace Spring.Data.NHibernate.Support [SetUp] public void SetUp() { - repository = new MockRepository(); - expectedSessionFactory = (ISessionFactory)repository.CreateMock(typeof(ISessionFactory)); - expectedEntityInterceptor = (IInterceptor)repository.CreateMock(typeof(IInterceptor)); + mocks = new MockRepository(); + expectedSessionFactory = mocks.StrictMock(); + expectedEntityInterceptor = mocks.StrictMock(); expectedSingleSession = SessionScopeSettings.SINGLESESSION_DEFAULT; expectedDefaultFlushMode = SessionScopeSettings.FLUSHMODE_DEFAULT; } @@ -74,14 +74,14 @@ namespace Spring.Data.NHibernate.Support [Test] public void CanCreateAndCloseSimpleCtor() { - using (repository.Ordered()) + using (mocks.Ordered()) { - ISession session = (ISession) repository.CreateMock(typeof (ISession)); + ISession session = mocks.StrictMock(); Expect.Call(expectedSessionFactory.OpenSession()).Return(session); session.FlushMode = FlushMode.Never; Expect.Call(session.Close()).Return(null); } - repository.ReplayAll(); + mocks.ReplayAll(); using (SessionScope scope = new SessionScope(expectedSessionFactory, true)) { // no op - just create & dispose @@ -99,7 +99,7 @@ namespace Spring.Data.NHibernate.Support Assert.IsNotNull(sessionHolder.Session); scope.Close(); } - repository.VerifyAll(); + mocks.VerifyAll(); } [Test] @@ -208,12 +208,12 @@ namespace Spring.Data.NHibernate.Support [Test] public void SingleSessionAppliesDefaultFlushModeOnOpenSessionAndClosesSession() { - ISession expectedSession = (ISession)repository.CreateMock(typeof(ISession)); + ISession expectedSession = mocks.StrictMock(); Expect.Call(expectedSessionFactory.OpenSession()).Return(expectedSession); expectedSession.FlushMode = FlushMode.Auto; Expect.Call(expectedSession.Close()).Return(null); - repository.ReplayAll(); + mocks.ReplayAll(); SessionScope scope = null; using (scope = new SessionScope(expectedSessionFactory, null, true, FlushMode.Auto, true)) @@ -225,7 +225,7 @@ namespace Spring.Data.NHibernate.Support Assert.IsFalse(scope.IsOpen); Assert.IsFalse(TransactionSynchronizationManager.HasResource(expectedSessionFactory)); - repository.VerifyAll(); + mocks.VerifyAll(); } [Test] @@ -286,13 +286,13 @@ namespace Spring.Data.NHibernate.Support public void ResolvesEntityInterceptorOnEachOpen() { TestSessionScopeSettings sss = - (TestSessionScopeSettings)repository.PartialMock(typeof(TestSessionScopeSettings), expectedSessionFactory); - ISession expectedSession = (ISession)repository.CreateMock(typeof(ISession)); + (TestSessionScopeSettings)mocks.PartialMock(typeof(TestSessionScopeSettings), expectedSessionFactory); + ISession expectedSession = mocks.StrictMock(); sss.DefaultFlushMode = FlushMode.Never; SessionScope sc = new SessionScope(sss, false); - using (repository.Ordered()) + using (mocks.Ordered()) { Expect.Call(sss.DoResolveEntityInterceptor()).Return(expectedEntityInterceptor); Expect.Call(expectedSessionFactory.OpenSession(expectedEntityInterceptor)).Return(expectedSession); @@ -304,7 +304,7 @@ namespace Spring.Data.NHibernate.Support expectedSession.FlushMode = FlushMode.Never; Expect.Call(expectedSession.Close()).Return(null); } - repository.ReplayAll(); + mocks.ReplayAll(); sc.Open(); SessionHolder sessionHolder = (SessionHolder)TransactionSynchronizationManager.GetResource(expectedSessionFactory); @@ -316,7 +316,7 @@ namespace Spring.Data.NHibernate.Support sessionHolder.ContainsSession(null); // force opening session sc.Close(); - repository.VerifyAll(); + mocks.VerifyAll(); } } diff --git a/test/Spring/Spring.Data.NHibernate32.Integration.Tests/Spring.Data.NHibernate32.Integration.Tests.2010.csproj b/test/Spring/Spring.Data.NHibernate32.Integration.Tests/Spring.Data.NHibernate32.Integration.Tests.2010.csproj index 23debc68..c9329df8 100644 --- a/test/Spring/Spring.Data.NHibernate32.Integration.Tests/Spring.Data.NHibernate32.Integration.Tests.2010.csproj +++ b/test/Spring/Spring.Data.NHibernate32.Integration.Tests/Spring.Data.NHibernate32.Integration.Tests.2010.csproj @@ -40,6 +40,7 @@ TRACE;DEBUG prompt 4 + true pdbonly @@ -48,6 +49,7 @@ TRACE prompt 4 + true diff --git a/test/Spring/Spring.Data.NHibernate32.Tests/Spring.Data.NHibernate32.Tests.2010.csproj b/test/Spring/Spring.Data.NHibernate32.Tests/Spring.Data.NHibernate32.Tests.2010.csproj index ac5c3eab..6752b48d 100644 --- a/test/Spring/Spring.Data.NHibernate32.Tests/Spring.Data.NHibernate32.Tests.2010.csproj +++ b/test/Spring/Spring.Data.NHibernate32.Tests/Spring.Data.NHibernate32.Tests.2010.csproj @@ -40,6 +40,7 @@ TRACE;DEBUG;NET_4_0 prompt 4 + true pdbonly @@ -48,6 +49,7 @@ TRACE;NET_4_0 prompt 4 + true diff --git a/test/Spring/Spring.Data.NHibernate33.Integration.Tests/Spring.Data.NHibernate33.Integration.Tests.2010.csproj b/test/Spring/Spring.Data.NHibernate33.Integration.Tests/Spring.Data.NHibernate33.Integration.Tests.2010.csproj index 6cd52f21..3f86fc92 100644 --- a/test/Spring/Spring.Data.NHibernate33.Integration.Tests/Spring.Data.NHibernate33.Integration.Tests.2010.csproj +++ b/test/Spring/Spring.Data.NHibernate33.Integration.Tests/Spring.Data.NHibernate33.Integration.Tests.2010.csproj @@ -40,6 +40,7 @@ TRACE;DEBUG prompt 4 + true pdbonly @@ -48,6 +49,7 @@ TRACE prompt 4 + true diff --git a/test/Spring/Spring.Data.NHibernate33.Tests/Spring.Data.NHibernate33.Tests.2010.csproj b/test/Spring/Spring.Data.NHibernate33.Tests/Spring.Data.NHibernate33.Tests.2010.csproj index 6d92a96e..cb0af482 100644 --- a/test/Spring/Spring.Data.NHibernate33.Tests/Spring.Data.NHibernate33.Tests.2010.csproj +++ b/test/Spring/Spring.Data.NHibernate33.Tests/Spring.Data.NHibernate33.Tests.2010.csproj @@ -40,6 +40,7 @@ TRACE;DEBUG;NET_4_0 prompt 4 + true pdbonly @@ -48,6 +49,7 @@ TRACE;NET_4_0 prompt 4 + true diff --git a/test/Spring/Spring.Data.Tests/Data/AdoPlatformTransactionManagerTests.cs b/test/Spring/Spring.Data.Tests/Data/AdoPlatformTransactionManagerTests.cs index 5dc59bbf..3fd24f13 100644 --- a/test/Spring/Spring.Data.Tests/Data/AdoPlatformTransactionManagerTests.cs +++ b/test/Spring/Spring.Data.Tests/Data/AdoPlatformTransactionManagerTests.cs @@ -67,8 +67,8 @@ namespace Spring.Data { #region Mock setup IDbProvider dbProvider = (IDbProvider) mocks.CreateMock(typeof (IDbProvider)); - IDbConnection connection = (IDbConnection) mocks.CreateMock(typeof (IDbConnection)); - IDbTransaction transaction = (IDbTransaction) mocks.CreateMock(typeof (IDbTransaction)); + IDbConnection connection = mocks.StrictMock(); + IDbTransaction transaction = mocks.StrictMock(); using (mocks.Ordered()) { @@ -108,8 +108,8 @@ namespace Spring.Data #region Mock Setup IDbProvider dbProvider = (IDbProvider) mocks.CreateMock(typeof (IDbProvider)); - IDbConnection connection = (IDbConnection) mocks.CreateMock(typeof (IDbConnection)); - IDbTransaction transaction = (IDbTransaction) mocks.CreateMock(typeof (IDbTransaction)); + IDbConnection connection = mocks.StrictMock(); + IDbTransaction transaction = mocks.StrictMock(); using (mocks.Ordered()) { @@ -158,8 +158,8 @@ namespace Spring.Data public void ParticipatingTransactionWithRollbackOnly() { IDbProvider dbProvider = (IDbProvider) mocks.CreateMock(typeof (IDbProvider)); - IDbConnection connection = (IDbConnection) mocks.CreateMock(typeof (IDbConnection)); - IDbTransaction transaction = (IDbTransaction) mocks.CreateMock(typeof (IDbTransaction)); + IDbConnection connection = mocks.StrictMock(); + IDbTransaction transaction = mocks.StrictMock(); using (mocks.Ordered()) { @@ -232,8 +232,8 @@ namespace Spring.Data { #region Mock Setup IDbProvider dbProvider = (IDbProvider) mocks.CreateMock(typeof (IDbProvider)); - IDbConnection connection = (IDbConnection) mocks.CreateMock(typeof (IDbConnection)); - IDbTransaction transaction = (IDbTransaction) mocks.CreateMock(typeof (IDbTransaction)); + IDbConnection connection = mocks.StrictMock(); + IDbTransaction transaction = mocks.StrictMock(); Expect.Call(dbProvider.CreateConnection()).Return(connection).Repeat.Twice(); connection.Open(); @@ -274,8 +274,8 @@ namespace Spring.Data public void PropagationRequiresNewWithExistingTransactionAndUnrelatedDataSource() { IDbProvider dbProvider = (IDbProvider) mocks.CreateMock(typeof (IDbProvider)); - IDbConnection connection = (IDbConnection) mocks.CreateMock(typeof (IDbConnection)); - IDbTransaction transaction = (IDbTransaction) mocks.CreateMock(typeof (IDbTransaction)); + IDbConnection connection = mocks.StrictMock(); + IDbTransaction transaction = mocks.StrictMock(); Expect.Call(dbProvider.CreateConnection()).Return(connection); connection.Open(); @@ -286,8 +286,8 @@ namespace Spring.Data connection.Dispose(); IDbProvider dbProvider2 = (IDbProvider) mocks.CreateMock(typeof (IDbProvider)); - IDbConnection connection2 = (IDbConnection) mocks.CreateMock(typeof (IDbConnection)); - IDbTransaction transaction2 = (IDbTransaction) mocks.CreateMock(typeof (IDbTransaction)); + IDbConnection connection2 = mocks.StrictMock(); + IDbTransaction transaction2 = mocks.StrictMock(); Expect.Call(dbProvider2.CreateConnection()).Return(connection2); connection2.Open(); @@ -328,9 +328,9 @@ namespace Spring.Data public void PropagationRequiresNewWithExistingTransactionAndUnrelatedFailingDataSource() { #region Mock Setup - IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); - IDbTransaction transaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + IDbProvider dbProvider = mocks.StrictMock(); + IDbConnection connection = mocks.StrictMock(); + IDbTransaction transaction = mocks.StrictMock(); Expect.Call(dbProvider.CreateConnection()).Return(connection); connection.Open(); @@ -340,8 +340,8 @@ namespace Spring.Data LastCall.On(transaction).Repeat.Once(); connection.Dispose(); - IDbProvider dbProvider2 = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); - IDbConnection connection2 = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); + IDbProvider dbProvider2 = mocks.StrictMock(); + IDbConnection connection2 = mocks.StrictMock(); Expect.Call(dbProvider2.CreateConnection()).Return(connection2); connection2.Open(); @@ -386,9 +386,9 @@ namespace Spring.Data public void PropagationNotSupportedWithExistingTransaction() { #region Mock Setup - IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); - IDbTransaction transaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + IDbProvider dbProvider = mocks.StrictMock(); + IDbConnection connection = mocks.StrictMock(); + IDbTransaction transaction = mocks.StrictMock(); using (mocks.Ordered()) { @@ -422,9 +422,9 @@ namespace Spring.Data public void PropagationNeverWithExistingTransaction() { #region Mock Setup - IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); - IDbTransaction transaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + IDbProvider dbProvider = mocks.StrictMock(); + IDbConnection connection = mocks.StrictMock(); + IDbTransaction transaction = mocks.StrictMock(); using (mocks.Ordered()) { @@ -468,16 +468,16 @@ namespace Spring.Data { #region Mock Setup - IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); + IDbProvider dbProvider = mocks.StrictMock(); + IDbConnection connection = mocks.StrictMock(); Expect.Call(dbProvider.CreateConnection()).Return(connection); connection.Open(); LastCall.On(connection).Repeat.Once(); connection.Dispose(); - IDbConnection connection2 = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); - IDbTransaction transaction2 = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + IDbConnection connection2 = mocks.StrictMock(); + IDbTransaction transaction2 = mocks.StrictMock(); Expect.Call(dbProvider.CreateConnection()).Return(connection2); connection2.Open(); @@ -511,9 +511,9 @@ namespace Spring.Data public void TransactionWithIsolation() { #region Mock setup - IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); - IDbTransaction transaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + IDbProvider dbProvider = mocks.StrictMock(); + IDbConnection connection = mocks.StrictMock(); + IDbTransaction transaction = mocks.StrictMock(); using (mocks.Ordered()) { @@ -562,10 +562,10 @@ namespace Spring.Data { #region Mock setup - IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); - IDbTransaction transaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); - IDbCommand command = (IDbCommand) mocks.CreateMock(typeof (IDbCommand)); + IDbProvider dbProvider = mocks.StrictMock(); + IDbConnection connection = mocks.StrictMock(); + IDbTransaction transaction = mocks.StrictMock(); + IDbCommand command = mocks.StrictMock(); using (mocks.Ordered()) { @@ -628,7 +628,7 @@ namespace Spring.Data public void TransactionWithExceptionOnBegin() { #region Mock setup - IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); + IDbProvider dbProvider = mocks.StrictMock(); // CreateConnection is called in AdoPlatformTransactionManager.DoBegin Expect.Call(dbProvider.CreateConnection()).Throw(new TestSqlException("Cannot begin", "314")); @@ -665,9 +665,9 @@ namespace Spring.Data public void TransactionWithExceptionOnCommit() { #region Mock setup - IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); - IDbTransaction transaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + IDbProvider dbProvider = mocks.StrictMock(); + IDbConnection connection = mocks.StrictMock(); + IDbTransaction transaction = mocks.StrictMock(); using (mocks.Ordered()) { @@ -708,9 +708,9 @@ namespace Spring.Data public void TransactionWithExceptionOnCommitAndRollbackOnCommitFailure() { #region Mock Setup - IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); - IDbTransaction transaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + IDbProvider dbProvider = mocks.StrictMock(); + IDbConnection connection = mocks.StrictMock(); + IDbTransaction transaction = mocks.StrictMock(); using (mocks.Ordered()) { @@ -754,9 +754,9 @@ namespace Spring.Data { #region Mock Setup - IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); - IDbTransaction transaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + IDbProvider dbProvider = mocks.StrictMock(); + IDbConnection connection = mocks.StrictMock(); + IDbTransaction transaction = mocks.StrictMock(); using (mocks.Ordered()) { @@ -804,7 +804,7 @@ namespace Spring.Data [Test] public void TransactionWithPropagationSupports() { - IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); + IDbProvider dbProvider = mocks.StrictMock(); mocks.ReplayAll(); @@ -825,7 +825,7 @@ namespace Spring.Data [Test] public void TransactionWithPropagationNotSupported() { - IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); + IDbProvider dbProvider = mocks.StrictMock(); mocks.ReplayAll(); @@ -846,7 +846,7 @@ namespace Spring.Data [Test] public void TransactionWithPropagationNever() { - IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); + IDbProvider dbProvider = mocks.StrictMock(); mocks.ReplayAll(); @@ -868,9 +868,9 @@ namespace Spring.Data public void ExistingTransactionWithPropagationNestedNotSupported() { #region Mock setup - IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); - IDbTransaction transaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + IDbProvider dbProvider = mocks.StrictMock(); + IDbConnection connection = mocks.StrictMock(); + IDbTransaction transaction = mocks.StrictMock(); using (mocks.Ordered()) { @@ -914,9 +914,9 @@ namespace Spring.Data public void TransactionWithPropagationNested() { #region Mock setup - IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); - IDbTransaction transaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + IDbProvider dbProvider = mocks.StrictMock(); + IDbConnection connection = mocks.StrictMock(); + IDbTransaction transaction = mocks.StrictMock(); using (mocks.Ordered()) { @@ -962,9 +962,9 @@ namespace Spring.Data public void TransactionWithPropagationNestedAndRollback() { #region Mock setup - IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); - IDbTransaction transaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + IDbProvider dbProvider = mocks.StrictMock(); + IDbConnection connection = mocks.StrictMock(); + IDbTransaction transaction = mocks.StrictMock(); using (mocks.Ordered()) { diff --git a/test/Spring/Spring.Data.Tests/Data/Common/MultiDelegatingDbProviderTests.cs b/test/Spring/Spring.Data.Tests/Data/Common/MultiDelegatingDbProviderTests.cs index dd228373..53e0827c 100644 --- a/test/Spring/Spring.Data.Tests/Data/Common/MultiDelegatingDbProviderTests.cs +++ b/test/Spring/Spring.Data.Tests/Data/Common/MultiDelegatingDbProviderTests.cs @@ -200,8 +200,8 @@ namespace Spring.Data.Common [Test] public void CreateOperations() { - IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); - IDbConnection mockConnection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); + IDbProvider dbProvider = mocks.StrictMock(); + IDbConnection mockConnection = mocks.StrictMock(); Expect.Call(dbProvider.CreateConnection()).Return(mockConnection).Repeat.Once(); IDbCommand mockCommand = (IDbCommand)mocks.CreateMock(typeof(IDbCommand)); diff --git a/test/Spring/Spring.Data.Tests/Data/Common/UserCredentialsDbProviderTests.cs b/test/Spring/Spring.Data.Tests/Data/Common/UserCredentialsDbProviderTests.cs index 6c0ca2de..1e8c4033 100644 --- a/test/Spring/Spring.Data.Tests/Data/Common/UserCredentialsDbProviderTests.cs +++ b/test/Spring/Spring.Data.Tests/Data/Common/UserCredentialsDbProviderTests.cs @@ -46,8 +46,8 @@ namespace Spring.Data.Common [Test] public void StaticCredentials() { - IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); + IDbProvider dbProvider = mocks.StrictMock(); + IDbConnection connection = mocks.StrictMock(); using (mocks.Ordered()) { Expect.Call(dbProvider.CreateConnection()).Return(connection); @@ -70,8 +70,8 @@ namespace Spring.Data.Common [Test] public void NoCredentials() { - IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); + IDbProvider dbProvider = mocks.StrictMock(); + IDbConnection connection = mocks.StrictMock(); using (mocks.Ordered()) { Expect.Call(dbProvider.CreateConnection()).Return(connection); @@ -89,8 +89,8 @@ namespace Spring.Data.Common [Test] public void ThreadBoundCredentials() { - IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); - IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); + IDbProvider dbProvider = mocks.StrictMock(); + IDbConnection connection = mocks.StrictMock(); using (mocks.Ordered()) { Expect.Call(dbProvider.CreateConnection()).Return(connection); diff --git a/test/Spring/Spring.Messaging.Nms.Integration.Tests/Spring.Messaging.Nms.Integration.Tests.2010.csproj b/test/Spring/Spring.Messaging.Nms.Integration.Tests/Spring.Messaging.Nms.Integration.Tests.2010.csproj index 4c066b90..b506300e 100644 --- a/test/Spring/Spring.Messaging.Nms.Integration.Tests/Spring.Messaging.Nms.Integration.Tests.2010.csproj +++ b/test/Spring/Spring.Messaging.Nms.Integration.Tests/Spring.Messaging.Nms.Integration.Tests.2010.csproj @@ -42,6 +42,7 @@ prompt 4 AllRules.ruleset + true pdbonly @@ -51,6 +52,7 @@ prompt 4 AllRules.ruleset + true diff --git a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Config/NmsNamespaceHandlerTests.cs b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Config/NmsNamespaceHandlerTests.cs index ce0f5043..3d37783c 100644 --- a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Config/NmsNamespaceHandlerTests.cs +++ b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Config/NmsNamespaceHandlerTests.cs @@ -117,7 +117,7 @@ namespace Spring.Messaging.Nms.Config Assert.IsNull(testObject3.Message); - ITextMessage message1 = (ITextMessage) mocks.CreateMock(typeof (ITextMessage)); + ITextMessage message1 = mocks.StrictMock(); Expect.Call(message1.Text).Return("Test1"); mocks.Replay(message1); @@ -127,7 +127,7 @@ namespace Spring.Messaging.Nms.Config mocks.Verify(message1); - ITextMessage message2 = (ITextMessage)mocks.CreateMock(typeof(ITextMessage)); + ITextMessage message2 = mocks.StrictMock(); Expect.Call(message2.Text).Return("Test1"); mocks.Replay(message2); @@ -136,7 +136,7 @@ namespace Spring.Messaging.Nms.Config mocks.Verify(message2); - ITextMessage message3 = (ITextMessage)mocks.CreateMock(typeof(ITextMessage)); + ITextMessage message3 = mocks.StrictMock(); mocks.Replay(message3); //Default naming strategy is to use full type name + # + number diff --git a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/CachingConnectionFactoryTests.cs b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/CachingConnectionFactoryTests.cs index 901310e8..b54f69e4 100644 --- a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/CachingConnectionFactoryTests.cs +++ b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/CachingConnectionFactoryTests.cs @@ -232,7 +232,7 @@ namespace Spring.Messaging.Nms.Connections private IConnectionFactory CreateConnectionFactory() { - IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory)); + IConnectionFactory connectionFactory = mocks.StrictMock(); IConnection connection = new TestConnection(); Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once(); diff --git a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/MessageTransactionManagerTests.cs b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/MessageTransactionManagerTests.cs index 404221f7..ce63cb68 100644 --- a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/MessageTransactionManagerTests.cs +++ b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/MessageTransactionManagerTests.cs @@ -50,9 +50,9 @@ namespace Spring.Messaging.Nms.Connections [Test] public void TransactionCommit() { - IConnectionFactory connectionFactory = (IConnectionFactory) mocks.CreateMock(typeof (IConnectionFactory)); - IConnection connection = (IConnection) mocks.CreateMock(typeof (IConnection)); - ISession session = (ISession) mocks.CreateMock(typeof (ISession)); + IConnectionFactory connectionFactory = mocks.StrictMock(); + IConnection connection = mocks.StrictMock(); + ISession session = mocks.StrictMock(); using (mocks.Ordered()) { @@ -74,9 +74,9 @@ namespace Spring.Messaging.Nms.Connections [Test] public void TransactionRollback() { - IConnectionFactory connectionFactory = (IConnectionFactory) mocks.CreateMock(typeof (IConnectionFactory)); - IConnection connection = (IConnection) mocks.CreateMock(typeof (IConnection)); - ISession session = (ISession) mocks.CreateMock(typeof (ISession)); + IConnectionFactory connectionFactory = mocks.StrictMock(); + IConnection connection = mocks.StrictMock(); + ISession session = mocks.StrictMock(); SetupRollbackExpectations(connection, connectionFactory, session); @@ -91,15 +91,12 @@ namespace Spring.Messaging.Nms.Connections mocks.VerifyAll(); } - /** - * TODO because using anonymous delegates - refactor to support .net 1.1 later. - */ [Test] public void ParticipatingTransactionWithCommit() { - IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory)); - IConnection connection = (IConnection)mocks.CreateMock(typeof(IConnection)); - ISession session = (ISession)mocks.CreateMock(typeof(ISession)); + IConnectionFactory connectionFactory = mocks.StrictMock(); + IConnection connection = mocks.StrictMock(); + ISession session = mocks.StrictMock(); using (mocks.Ordered()) { @@ -130,9 +127,9 @@ namespace Spring.Messaging.Nms.Connections [Test] public void ParticipatingTransactionWithRollback() { - IConnectionFactory connectionFactory = (IConnectionFactory) mocks.CreateMock(typeof (IConnectionFactory)); - IConnection connection = (IConnection) mocks.CreateMock(typeof (IConnection)); - ISession session = (ISession) mocks.CreateMock(typeof (ISession)); + IConnectionFactory connectionFactory = mocks.StrictMock(); + IConnection connection = mocks.StrictMock(); + ISession session = mocks.StrictMock(); using (mocks.Ordered()) { @@ -168,10 +165,10 @@ namespace Spring.Messaging.Nms.Connections [Test] public void SuspendedTransaction() { - IConnectionFactory connectionFactory = (IConnectionFactory) mocks.CreateMock(typeof (IConnectionFactory)); - IConnection connection = (IConnection) mocks.CreateMock(typeof (IConnection)); - ISession session = (ISession) mocks.CreateMock(typeof (ISession)); - ISession session2 = (ISession)mocks.CreateMock(typeof(ISession)); + IConnectionFactory connectionFactory = mocks.StrictMock(); + IConnection connection = mocks.StrictMock(); + ISession session = mocks.StrictMock(); + ISession session2 = mocks.StrictMock(); Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Twice(); Expect.Call(connection.CreateSession(AcknowledgementMode.Transactional)).Return(session).Repeat.Once(); @@ -214,10 +211,10 @@ namespace Spring.Messaging.Nms.Connections [Test] public void TransactionSuspension() { - IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory)); - IConnection connection = (IConnection)mocks.CreateMock(typeof(IConnection)); - ISession session = (ISession)mocks.CreateMock(typeof(ISession)); - ISession session2 = (ISession)mocks.CreateMock(typeof(ISession)); + IConnectionFactory connectionFactory = mocks.StrictMock(); + IConnection connection = mocks.StrictMock(); + ISession session = mocks.StrictMock(); + ISession session2 = mocks.StrictMock(); Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Twice(); diff --git a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/SingleConnectionFactoryTests.cs b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/SingleConnectionFactoryTests.cs index 9d1d26e0..8c135d82 100644 --- a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/SingleConnectionFactoryTests.cs +++ b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/SingleConnectionFactoryTests.cs @@ -50,7 +50,7 @@ namespace Spring.Messaging.Nms.Connections [Test] public void UsingConnection() { - IConnection connection = (IConnection)mocks.CreateMock(typeof(IConnection)); + IConnection connection = mocks.StrictMock(); connection.Start(); LastCall.On(connection).Repeat.Twice(); @@ -82,8 +82,8 @@ namespace Spring.Messaging.Nms.Connections [Test] public void UsingConnectionFactory() { - IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory)); - IConnection connection = (IConnection)mocks.CreateMock(typeof(IConnection)); + IConnectionFactory connectionFactory = (IConnectionFactory)mocks.StrictMock(); + IConnection connection = mocks.StrictMock(); Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once(); connection.Start(); @@ -112,8 +112,8 @@ namespace Spring.Messaging.Nms.Connections [Test] public void UsingConnectionFactoryAndClientId() { - IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory)); - IConnection connection = (IConnection)mocks.CreateMock(typeof(IConnection)); + IConnectionFactory connectionFactory = mocks.StrictMock(); + IConnection connection = mocks.StrictMock(); Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once(); connection.ClientId = "MyId"; @@ -146,8 +146,8 @@ namespace Spring.Messaging.Nms.Connections [Test] public void UsingConnectionFactoryAndExceptionListener() { - IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory)); - IConnection connection = (IConnection)mocks.CreateMock(typeof(IConnection)); + IConnectionFactory connectionFactory = mocks.StrictMock(); + IConnection connection = mocks.StrictMock(); IExceptionListener listener = new ChainedExceptionListener(); @@ -185,7 +185,7 @@ namespace Spring.Messaging.Nms.Connections [Test] public void UsingConnectionFactoryAndReconnectOnException() { - IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory)); + IConnectionFactory connectionFactory = mocks.StrictMock(); TestConnection con = new TestConnection(); Expect.Call(connectionFactory.CreateConnection()).Return(con).Repeat.Twice(); @@ -211,7 +211,7 @@ namespace Spring.Messaging.Nms.Connections [Test] public void UsingConnectionFactoryAndExceptionListenerAndReconnectOnException() { - IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory)); + IConnectionFactory connectionFactory = mocks.StrictMock(); TestConnection con = new TestConnection(); TestExceptionListener listener = new TestExceptionListener(); @@ -240,10 +240,10 @@ namespace Spring.Messaging.Nms.Connections [Test] public void CachingConnectionFactory() { - IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory)); - IConnection connection = (IConnection)mocks.CreateMock(typeof(IConnection)); - ISession txSession = (ISession)mocks.CreateMock(typeof(ISession)); - ISession nonTxSession = (ISession)mocks.CreateMock(typeof(ISession)); + IConnectionFactory connectionFactory = mocks.StrictMock(); + IConnection connection = mocks.StrictMock(); + ISession txSession = mocks.StrictMock(); + ISession nonTxSession = mocks.StrictMock(); Expect.Call(connectionFactory.CreateConnection()).Return(connection).Repeat.Once(); Expect.Call(connection.CreateSession(AcknowledgementMode.Transactional)).Return(txSession).Repeat.Once(); diff --git a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/TestConnection.cs b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/TestConnection.cs index 7ddaa4f2..899f1784 100644 --- a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/TestConnection.cs +++ b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Connections/TestConnection.cs @@ -24,9 +24,11 @@ namespace Spring.Messaging.Nms.Connections get { throw new NotImplementedException(); } } +#pragma warning disable 67 public event ExceptionListener ExceptionListener; public event ConnectionInterruptedListener ConnectionInterruptedListener; public event ConnectionResumedListener ConnectionResumedListener; +#pragma warning restore 67 public ISession CreateSession() { diff --git a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Core/MessageTemplateTests.cs b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Core/MessageTemplateTests.cs index 20fa062d..78c7a2c4 100644 --- a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Core/MessageTemplateTests.cs +++ b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Core/MessageTemplateTests.cs @@ -20,7 +20,6 @@ #region Imports -using System; using System.Collections; using Apache.NMS; using NUnit.Framework; @@ -75,11 +74,11 @@ namespace Spring.Messaging.Nms.Core private void CreateMocks() { - mockConnectionFactory = (IConnectionFactory) mocks.CreateMock(typeof (IConnectionFactory)); - mockConnection = (IConnection) mocks.CreateMock(typeof (IConnection)); - mockSession = (ISession) mocks.CreateMock(typeof (ISession)); + mockConnectionFactory = mocks.StrictMock(); + mockConnection = mocks.StrictMock(); + mockSession = mocks.StrictMock(); - IQueue queue = (IQueue) mocks.CreateMock(typeof (IQueue)); + IQueue queue = mocks.StrictMock(); Expect.Call(mockConnectionFactory.CreateConnection()).Return(mockConnection).Repeat.Once(); if (UseTransactedTemplate) @@ -96,7 +95,7 @@ namespace Spring.Messaging.Nms.Core Expect.Call(mockSession.Transacted).Return(true); mockDestinationResolver = - (IDestinationResolver) mocks.CreateMock(typeof (IDestinationResolver)); + mocks.StrictMock(); mockDestinationResolver.ResolveDestinationName(mockSession, "testDestination", false); LastCall.Return(queue).Repeat.Any(); } @@ -107,7 +106,7 @@ namespace Spring.Messaging.Nms.Core NmsTemplate template = CreateTemplate(); template.ConnectionFactory = mockConnectionFactory; - IMessageProducer mockProducer = (IMessageProducer)mocks.CreateMock(typeof(IMessageProducer)); + IMessageProducer mockProducer = mocks.StrictMock(); Expect.Call(mockSession.CreateProducer(null)).Return(mockProducer); Expect.Call(mockProducer.Priority).Return(MsgPriority.Normal); @@ -137,7 +136,7 @@ namespace Spring.Messaging.Nms.Core template.MessageIdEnabled = false; template.MessageTimestampEnabled = false; - IMessageProducer mockProducer = (IMessageProducer) mocks.CreateMock(typeof (IMessageProducer)); + IMessageProducer mockProducer = mocks.StrictMock(); Expect.Call(mockSession.CreateProducer(null)).Return(mockProducer); mockProducer.DisableMessageID = true; diff --git a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Core/SimpleMessageConverterTests.cs b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Core/SimpleMessageConverterTests.cs index 8dee1e08..4149bc87 100644 --- a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Core/SimpleMessageConverterTests.cs +++ b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Core/SimpleMessageConverterTests.cs @@ -23,13 +23,15 @@ using System; using System.Collections; using System.Text; + using Apache.NMS; -using Apache.NMS.ActiveMQ.OpenWire; using Apache.NMS.Util; + using NUnit.Framework; + using Rhino.Mocks; + using Spring.Messaging.Nms.Support.Converter; -using Spring.Util; #endregion @@ -51,14 +53,14 @@ namespace Spring.Messaging.Nms.Core public void Setup() { mocks = new MockRepository(); - session = (ISession) mocks.CreateMock(typeof (ISession)); + session = mocks.StrictMock(); converter = new SimpleMessageConverter(); } [Test] public void StringConversion() { - ITextMessage message = (ITextMessage) mocks.CreateMock(typeof (ITextMessage)); + ITextMessage message = mocks.StrictMock(); string content = "test"; Expect.Call(session.CreateTextMessage(content)).Return(message).Repeat.Once(); @@ -79,7 +81,7 @@ namespace Spring.Messaging.Nms.Core [Test] public void ByteArrayConversion() { - IBytesMessage message = (IBytesMessage) mocks.CreateMock(typeof (IBytesMessage)); + IBytesMessage message = mocks.StrictMock(); ASCIIEncoding encoding = new ASCIIEncoding(); byte[] content = encoding.GetBytes("test"); @@ -100,7 +102,7 @@ namespace Spring.Messaging.Nms.Core [Test] public void MapConversion() { - IMapMessage message = (IMapMessage) mocks.CreateMock(typeof (IMapMessage)); + IMapMessage message = mocks.StrictMock(); IPrimitiveMap primitiveMap = new PrimitiveMap(); IDictionary content = new Hashtable(); content["key1"] = "value1"; @@ -123,7 +125,7 @@ namespace Spring.Messaging.Nms.Core [Test] public void Serializable() { - IObjectMessage message = (IObjectMessage)mocks.CreateMock(typeof(IObjectMessage)); + IObjectMessage message = mocks.StrictMock(); SerializableWithAttribute content = new SerializableWithAttribute(); @@ -157,7 +159,7 @@ namespace Spring.Messaging.Nms.Core [Test] public void ToMessageSimplyReturnsMessageAsIsIfSuppliedWithMessage() { - IObjectMessage message = (IObjectMessage) mocks.CreateMock(typeof (IObjectMessage)); + IObjectMessage message = mocks.StrictMock(); mocks.ReplayAll(); @@ -170,7 +172,7 @@ namespace Spring.Messaging.Nms.Core [Test] public void FromMessageSimplyReturnsMessageAsIsIfSuppliedWithMessage() { - IMessage message = (IMessage)mocks.CreateMock(typeof(IMessage)); + IMessage message = mocks.StrictMock(); mocks.ReplayAll(); @@ -183,7 +185,7 @@ namespace Spring.Messaging.Nms.Core [Test] public void DictionaryConversionWhereMapHasNonStringTypesForKeys() { - IMapMessage message = (IMapMessage)mocks.CreateMock(typeof(IMapMessage)); + IMapMessage message = mocks.StrictMock(); Expect.Call(session.CreateMapMessage()).Return(message); diff --git a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Core/SimpleMessageListenerContainerTests.cs b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Core/SimpleMessageListenerContainerTests.cs index 19e472ef..8f4a52be 100644 --- a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Core/SimpleMessageListenerContainerTests.cs +++ b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Core/SimpleMessageListenerContainerTests.cs @@ -63,26 +63,26 @@ namespace Spring.Messaging.Nms.Core { SimpleMessageConsumer messageConsumer = new SimpleMessageConsumer(); - ISession session = (ISession) mocks.CreateMock(typeof (ISession)); + ISession session = mocks.StrictMock(); Expect.Call(session.GetQueue(DESTINATION_NAME)).Return(QUEUE_DESTINATION); Expect.Call(session.CreateConsumer(QUEUE_DESTINATION, null)).Return(messageConsumer); // an exception is thrown, so the rollback logic is being applied here... Expect.Call(session.Transacted).Return(false); - IConnection connection = (IConnection)mocks.CreateMock(typeof(IConnection)); + IConnection connection = mocks.StrictMock(); connection.ExceptionListener += container.OnException; Expect.Call(connection.CreateSession(container.SessionAcknowledgeMode)).Return(session); connection.Start(); - IConnectionFactory connectionFactory = (IConnectionFactory) mocks.CreateMock(typeof (IConnectionFactory)); + IConnectionFactory connectionFactory = mocks.StrictMock(); Expect.Call(connectionFactory.CreateConnection()).Return(connection); NMSException theException = new NMSException(EXCEPTION_MESSAGE); - IExceptionListener exceptionListener = (IExceptionListener) mocks.CreateMock(typeof (IExceptionListener)); + IExceptionListener exceptionListener = mocks.StrictMock(); exceptionListener.OnException(theException); - IMessage message = (IMessage) mocks.CreateMock(typeof (IMessage)); + IMessage message = mocks.StrictMock(); mocks.ReplayAll(); @@ -103,26 +103,26 @@ namespace Spring.Messaging.Nms.Core { SimpleMessageConsumer messageConsumer = new SimpleMessageConsumer(); - ISession session = (ISession)mocks.CreateMock(typeof(ISession)); + ISession session = mocks.StrictMock(); Expect.Call(session.GetQueue(DESTINATION_NAME)).Return(QUEUE_DESTINATION); Expect.Call(session.CreateConsumer(QUEUE_DESTINATION, null)).Return(messageConsumer); // an exception is thrown, so the rollback logic is being applied here... Expect.Call(session.Transacted).Return(false); - IConnection connection = (IConnection)mocks.CreateMock(typeof(IConnection)); + IConnection connection = mocks.StrictMock(); connection.ExceptionListener += container.OnException; Expect.Call(connection.CreateSession(container.SessionAcknowledgeMode)).Return(session); connection.Start(); - IConnectionFactory connectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory)); + IConnectionFactory connectionFactory = mocks.StrictMock(); Expect.Call(connectionFactory.CreateConnection()).Return(connection); IllegalStateException theException = new IllegalStateException(EXCEPTION_MESSAGE); - IErrorHandler errorHandler = (IErrorHandler)mocks.CreateMock(typeof(IErrorHandler)); + IErrorHandler errorHandler = mocks.StrictMock(); errorHandler.HandleError(theException); - IMessage message = (IMessage)mocks.CreateMock(typeof(IMessage)); + IMessage message = mocks.StrictMock(); mocks.ReplayAll(); diff --git a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Listener/Adapter/MessageListenerAdapterTests.cs b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Listener/Adapter/MessageListenerAdapterTests.cs index 60345424..a900297b 100644 --- a/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Listener/Adapter/MessageListenerAdapterTests.cs +++ b/test/Spring/Spring.Messaging.Nms.Tests/Messaging/Nms/Listener/Adapter/MessageListenerAdapterTests.cs @@ -52,7 +52,7 @@ namespace Spring.Messaging.Nms.Listener.Adapter public void MessageContentsHandlerForTextMessage() { int numIterations = 10; - ITextMessage message = (ITextMessage)mocks.CreateMock(typeof(ITextMessage)); + ITextMessage message = mocks.StrictMock(); Expect.Call(message.Text).Return(TEXT).Repeat.Times(numIterations); MessageContentsHandler handler = new MessageContentsHandler(); mocks.ReplayAll(); @@ -71,7 +71,7 @@ namespace Spring.Messaging.Nms.Listener.Adapter public void MessageContentsHandlerForBytesMessage() { int numIterations = 10; - IBytesMessage message = (IBytesMessage)mocks.CreateMock(typeof(IBytesMessage)); + IBytesMessage message = mocks.StrictMock(); ASCIIEncoding encoding = new ASCIIEncoding(); byte[] content = encoding.GetBytes("test"); Expect.Call(message.Content).Return(content).Repeat.Times(numIterations); @@ -92,12 +92,12 @@ namespace Spring.Messaging.Nms.Listener.Adapter public void MessageContentsHandlerOverloadCalls() { int numIterations = 10; - IBytesMessage bytesMessage = (IBytesMessage)mocks.CreateMock(typeof(IBytesMessage)); + IBytesMessage bytesMessage = mocks.StrictMock(); ASCIIEncoding encoding = new ASCIIEncoding(); byte[] content = encoding.GetBytes("test"); Expect.Call(bytesMessage.Content).Return(content).Repeat.Times(numIterations / 2); - ITextMessage textMessage = (ITextMessage)mocks.CreateMock(typeof(ITextMessage)); + ITextMessage textMessage = mocks.StrictMock(); Expect.Call(textMessage.Text).Return(TEXT).Repeat.Times(numIterations/2); MessageContentsHandler handler = new MessageContentsHandler(); diff --git a/test/Spring/Spring.Messaging.Nms.Tests/Spring.Messaging.Nms.Tests.2010.csproj b/test/Spring/Spring.Messaging.Nms.Tests/Spring.Messaging.Nms.Tests.2010.csproj index e993e36d..88a681a7 100644 --- a/test/Spring/Spring.Messaging.Nms.Tests/Spring.Messaging.Nms.Tests.2010.csproj +++ b/test/Spring/Spring.Messaging.Nms.Tests/Spring.Messaging.Nms.Tests.2010.csproj @@ -25,6 +25,7 @@ TRACE;DEBUG;NET_4_0 prompt 4 + true pdbonly @@ -33,6 +34,7 @@ TRACE;NET_4_0 prompt 4 + true diff --git a/test/Spring/Spring.Scheduling.Quartz21.Integration.Tests/Spring.Scheduling.Quartz21.Integration.Tests.2010.csproj b/test/Spring/Spring.Scheduling.Quartz21.Integration.Tests/Spring.Scheduling.Quartz21.Integration.Tests.2010.csproj index 8a5daeac..f77d15d1 100644 --- a/test/Spring/Spring.Scheduling.Quartz21.Integration.Tests/Spring.Scheduling.Quartz21.Integration.Tests.2010.csproj +++ b/test/Spring/Spring.Scheduling.Quartz21.Integration.Tests/Spring.Scheduling.Quartz21.Integration.Tests.2010.csproj @@ -40,6 +40,7 @@ TRACE;DEBUG;NET_4_0;NET_3_5,QUARTZ_2_0 prompt 4 + true pdbonly @@ -48,6 +49,7 @@ TRACE;NET_4_0;NET_3_5 prompt 4 + true diff --git a/test/Spring/Spring.Scheduling.Quartz21.Tests/Spring.Scheduling.Quartz21.Tests.2010.csproj b/test/Spring/Spring.Scheduling.Quartz21.Tests/Spring.Scheduling.Quartz21.Tests.2010.csproj index 6864b4eb..96d60475 100644 --- a/test/Spring/Spring.Scheduling.Quartz21.Tests/Spring.Scheduling.Quartz21.Tests.2010.csproj +++ b/test/Spring/Spring.Scheduling.Quartz21.Tests/Spring.Scheduling.Quartz21.Tests.2010.csproj @@ -36,6 +36,7 @@ TRACE;NET_4_0 prompt 4 + true diff --git a/test/Spring/Spring.Services.Tests/Spring.Services.Tests.2010.csproj b/test/Spring/Spring.Services.Tests/Spring.Services.Tests.2010.csproj index 6a64f236..209f9c76 100644 --- a/test/Spring/Spring.Services.Tests/Spring.Services.Tests.2010.csproj +++ b/test/Spring/Spring.Services.Tests/Spring.Services.Tests.2010.csproj @@ -72,7 +72,7 @@ true false false - false + true 4 none prompt diff --git a/test/Spring/Spring.Testing.Microsoft.Tests/Spring.Testing.Microsoft.Tests.2010.csproj b/test/Spring/Spring.Testing.Microsoft.Tests/Spring.Testing.Microsoft.Tests.2010.csproj index bd776108..192d0723 100644 --- a/test/Spring/Spring.Testing.Microsoft.Tests/Spring.Testing.Microsoft.Tests.2010.csproj +++ b/test/Spring/Spring.Testing.Microsoft.Tests/Spring.Testing.Microsoft.Tests.2010.csproj @@ -22,20 +22,22 @@ true full false - bin\Debug\ + ..\..\..\build\VS.Net.2010\Spring.Testing.Microsoft.Tests\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset + true pdbonly true - bin\Release\ + ..\..\..\build\VS.Net.2010\Spring.Testing.Microsoft.Tests\Release\ TRACE prompt 4 AllRules.ruleset + true diff --git a/test/Spring/Spring.Testing.NUnit.Tests/Spring.Testing.NUnit.Tests.2010.csproj b/test/Spring/Spring.Testing.NUnit.Tests/Spring.Testing.NUnit.Tests.2010.csproj index 2ca520c9..462d4a05 100644 --- a/test/Spring/Spring.Testing.NUnit.Tests/Spring.Testing.NUnit.Tests.2010.csproj +++ b/test/Spring/Spring.Testing.NUnit.Tests/Spring.Testing.NUnit.Tests.2010.csproj @@ -27,6 +27,7 @@ TRACE;DEBUG;NET_4_0 prompt 4 + true pdbonly @@ -35,6 +36,7 @@ TRACE;NET_4_0 prompt 4 + true diff --git a/test/Spring/Spring.Testing.NUnit.Tests/Testing/Ado/SimpleAdoTestUtilsTests.cs b/test/Spring/Spring.Testing.NUnit.Tests/Testing/Ado/SimpleAdoTestUtilsTests.cs index c2db612c..2e8d0e23 100644 --- a/test/Spring/Spring.Testing.NUnit.Tests/Testing/Ado/SimpleAdoTestUtilsTests.cs +++ b/test/Spring/Spring.Testing.NUnit.Tests/Testing/Ado/SimpleAdoTestUtilsTests.cs @@ -1,19 +1,19 @@ #region License -/* - * Copyright 2002-2010 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. - * See the License for the specific language governing permissions and - * limitations under the License. +/* + * Copyright 2002-2010 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. + * See the License for the specific language governing permissions and + * limitations under the License. */ #endregion @@ -42,7 +42,7 @@ namespace Spring.Testing.Ado public void SetUp() { mocks = new MockRepository(); - adoTemplate = (IAdoOperations) mocks.CreateMock(typeof (IAdoOperations)); + adoTemplate = mocks.StrictMock(); } [Test] @@ -111,9 +111,9 @@ namespace Spring.Testing.Ado public void ExecuteScriptTransactedSuccess() { IDbProvider dbProvider = (IDbProvider) mocks.DynamicMock(typeof(IDbProvider)); - IDbConnection dbConnection = (IDbConnection) mocks.CreateMock(typeof (IDbConnection)); - IDbTransaction dbTx = (IDbTransaction) mocks.CreateMock(typeof (IDbTransaction)); - IDbCommand dbCommand = (IDbCommand) mocks.CreateMock(typeof (IDbCommand)); + IDbConnection dbConnection = mocks.StrictMock(); + IDbTransaction dbTx = mocks.StrictMock(); + IDbCommand dbCommand = mocks.StrictMock(); DefaultTransactionDefinition txDefinition = new DefaultTransactionDefinition(); Expect.Call(dbProvider.CreateConnection()).Return(dbConnection); @@ -142,9 +142,9 @@ namespace Spring.Testing.Ado [Test] public void ExecuteScriptTransactedRollsbackIfNoCommit() { - IDbProvider dbProvider = (IDbProvider) mocks.CreateMock(typeof(IDbProvider)); - IDbConnection dbConnection = (IDbConnection) mocks.CreateMock(typeof (IDbConnection)); - IDbTransaction dbTx = (IDbTransaction) mocks.CreateMock(typeof (IDbTransaction)); + IDbProvider dbProvider = mocks.StrictMock(); + IDbConnection dbConnection = mocks.StrictMock(); + IDbTransaction dbTx = mocks.StrictMock(); DefaultTransactionDefinition txDefinition = new DefaultTransactionDefinition(); Expect.Call(dbProvider.CreateConnection()).Return(dbConnection); diff --git a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/EndPausedSessionIsClosedA.aspx.cs b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/EndPausedSessionIsClosedA.aspx.cs index 58e9ceed..425f0e47 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/EndPausedSessionIsClosedA.aspx.cs +++ b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/EndPausedSessionIsClosedA.aspx.cs @@ -1,17 +1,8 @@ using System; -using System.Data; -using System.Configuration; -using System.Collections; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.WebControls.WebParts; -using System.Web.UI.HtmlControls; + using Spring.Web.Conversation; using Spring.Entities; using NHibernate; -using Spring.Web.Conversation; public partial class EndPausedSessionIsClosedA : System.Web.UI.Page { diff --git a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/EndPausedSessionIsClosedB.aspx.cs b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/EndPausedSessionIsClosedB.aspx.cs index 707c2193..eecfde21 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/EndPausedSessionIsClosedB.aspx.cs +++ b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/EndPausedSessionIsClosedB.aspx.cs @@ -1,17 +1,8 @@ using System; -using System.Data; -using System.Configuration; -using System.Collections; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.WebControls.WebParts; -using System.Web.UI.HtmlControls; + using Spring.Web.Conversation; using NHibernate; using Spring.Entities; -using Spring.Web.Conversation; public partial class EndPausedSessionIsClosedB : System.Web.UI.Page { diff --git a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/EndPausedTest.aspx.cs b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/EndPausedTest.aspx.cs index 1db9c7a2..498c6d68 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/EndPausedTest.aspx.cs +++ b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/EndPausedTest.aspx.cs @@ -1,14 +1,5 @@ using System; -using System.Data; -using System.Configuration; -using System.Collections; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.WebControls.WebParts; -using System.Web.UI.HtmlControls; -using Spring.Web.Conversation; + using Spring.Web.Conversation; public partial class EndPausedTest : System.Web.UI.Page diff --git a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/GetParentObjetFromChild.aspx.cs b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/GetParentObjetFromChild.aspx.cs index d3a369e5..da294e00 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/GetParentObjetFromChild.aspx.cs +++ b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/GetParentObjetFromChild.aspx.cs @@ -1,14 +1,5 @@ using System; -using System.Data; -using System.Configuration; -using System.Collections; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.WebControls.WebParts; -using System.Web.UI.HtmlControls; -using Spring.Web.Conversation; + using Spring.Web.Conversation; public partial class GetParentObjetFromChild : System.Web.UI.Page diff --git a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/IoeTests.aspx.cs b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/IoeTests.aspx.cs index 7b43b600..2e33a7ba 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/IoeTests.aspx.cs +++ b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/IoeTests.aspx.cs @@ -1,20 +1,11 @@ using System; -using System.Data; -using System.Configuration; -using System.Collections; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.WebControls.WebParts; -using System.Web.UI.HtmlControls; + using Spring.Web.Conversation; using System.Text.RegularExpressions; using NHibernate; using Spring.Data.NHibernate.Support; using Common.Logging; using Spring.Objects.Factory; -using Spring.Web.Conversation; public partial class IoeTests : System.Web.UI.Page { diff --git a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/RedirectErrorNoPauseConversation.aspx.cs b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/RedirectErrorNoPauseConversation.aspx.cs index 45734d8e..773f3c55 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/RedirectErrorNoPauseConversation.aspx.cs +++ b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/RedirectErrorNoPauseConversation.aspx.cs @@ -1,18 +1,8 @@ using System; -using System.Data; -using System.Configuration; -using System.Collections; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.WebControls.WebParts; -using System.Web.UI.HtmlControls; + using Spring.Web.Conversation; -using Spring.Entities; -using System.Threading; + using NHibernate; -using Spring.Web.Conversation; public partial class RedirectErrorNoPauseConversation : System.Web.UI.Page { diff --git a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SPCLazyLoadTest_A_Begin.aspx.cs b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SPCLazyLoadTest_A_Begin.aspx.cs index 34d4a3bc..cf0683f3 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SPCLazyLoadTest_A_Begin.aspx.cs +++ b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SPCLazyLoadTest_A_Begin.aspx.cs @@ -1,17 +1,8 @@ using System; -using System.Data; -using System.Configuration; -using System.Collections; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.WebControls.WebParts; -using System.Web.UI.HtmlControls; + using Spring.Web.Conversation; using NHibernate; using Spring.Entities; -using Spring.Web.Conversation; public partial class SPCLazyLoadTest_A_Begin : System.Web.UI.Page { diff --git a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SPCLazyLoadTest_A_Status.aspx.cs b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SPCLazyLoadTest_A_Status.aspx.cs index cd42af6c..2b5affd2 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SPCLazyLoadTest_A_Status.aspx.cs +++ b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SPCLazyLoadTest_A_Status.aspx.cs @@ -1,18 +1,9 @@ using System; -using System.Data; -using System.Configuration; -using System.Collections; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.WebControls.WebParts; -using System.Web.UI.HtmlControls; + using Spring.Web.Conversation; using Spring.Entities; using Common.Logging; using NHibernate; -using Spring.Web.Conversation; public partial class SPCLazyLoadTest_A_Status : System.Web.UI.Page { diff --git a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SerializeConversationTest.aspx.cs b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SerializeConversationTest.aspx.cs index dbf90110..cdfef3e1 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SerializeConversationTest.aspx.cs +++ b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SerializeConversationTest.aspx.cs @@ -1,29 +1,14 @@ using System; -using System.Data; -using System.Configuration; -using System.Collections; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.WebControls.WebParts; -using System.Web.UI.HtmlControls; -using Spring.Web.Conversation; -using Spring.Data.NHibernate.Support; -using NHibernate; -using Spring.Entities; -using Spring.Spring.Data.Common; -using NUnit.Framework; -using Spring.Bsn; -using NHibernate.Impl; -using System.Reflection; -using NHibernate.Cfg; -using Spring.Context; using System.Collections.Generic; using System.Runtime.Serialization.Formatters.Binary; using System.IO; + using Spring.Web.Conversation; +using NHibernate; +using Spring.Entities; + + /// /// Page for . /// diff --git a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SessionIsClosedA.aspx.cs b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SessionIsClosedA.aspx.cs index 6d15a5b5..b2f6b296 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SessionIsClosedA.aspx.cs +++ b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SessionIsClosedA.aspx.cs @@ -1,17 +1,8 @@ using System; -using System.Data; -using System.Configuration; -using System.Collections; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.WebControls.WebParts; -using System.Web.UI.HtmlControls; + using Spring.Web.Conversation; using Spring.Entities; using NHibernate; -using Spring.Web.Conversation; public partial class SessionIsClosedA : System.Web.UI.Page { diff --git a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SessionIsClosedB.aspx.cs b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SessionIsClosedB.aspx.cs index 3aef8424..af9be8ac 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SessionIsClosedB.aspx.cs +++ b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/SessionIsClosedB.aspx.cs @@ -1,17 +1,8 @@ using System; -using System.Data; -using System.Configuration; -using System.Collections; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.WebControls.WebParts; -using System.Web.UI.HtmlControls; + using Spring.Web.Conversation; using Spring.Entities; using NHibernate; -using Spring.Web.Conversation; public partial class SessionIsClosedB : System.Web.UI.Page { diff --git a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/TimeOut_NoTimeOut.aspx.cs b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/TimeOut_NoTimeOut.aspx.cs index 69254992..f6fb5fe8 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/TimeOut_NoTimeOut.aspx.cs +++ b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/TimeOut_NoTimeOut.aspx.cs @@ -1,14 +1,5 @@ using System; -using System.Data; -using System.Configuration; -using System.Collections; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.WebControls.WebParts; -using System.Web.UI.HtmlControls; -using Spring.Web.Conversation; + using Spring.Web.Conversation; public partial class TimeOut_NoTimeOut : System.Web.UI.Page diff --git a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/TimeOut_WithTimeOut.aspx.cs b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/TimeOut_WithTimeOut.aspx.cs index b619add2..c7e4f716 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/TimeOut_WithTimeOut.aspx.cs +++ b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Data/Spring/Conversation/WebConversationStateTest/TimeOut_WithTimeOut.aspx.cs @@ -1,14 +1,5 @@ using System; -using System.Data; -using System.Configuration; -using System.Collections; -using System.Web; -using System.Web.Security; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.WebControls.WebParts; -using System.Web.UI.HtmlControls; -using Spring.Web.Conversation; + using Spring.Web.Conversation; public partial class TimeOut_WithTimeOut : System.Web.UI.Page diff --git a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Spring.Web.Conversation.NHibernate32.Tests.2010.csproj b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Spring.Web.Conversation.NHibernate32.Tests.2010.csproj index 0f61d1af..833c6320 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Spring.Web.Conversation.NHibernate32.Tests.2010.csproj +++ b/test/Spring/Spring.Web.Conversation.NHibernate32.Tests/Spring.Web.Conversation.NHibernate32.Tests.2010.csproj @@ -40,10 +40,12 @@ TRACE;DEBUG;NET_40 prompt 4 - ..\..\..\build\VS.Net.2010\Spring.Web.Conversation.NHibernate32.Tests\Debug\Spring.Web.Conversation.NHibernate32.Tests.XML + + Program $(MSBuildProjectDirectory)\..\..\dependencies\tools\NUnit-2.6.0.12051\bin\nunit-x86.exe "$(MSBuildProjectDirectory)\$(OutputPath)\$(AssemblyName).dll" + true pdbonly @@ -52,6 +54,7 @@ TRACE;NET_40 prompt 4 + true diff --git a/test/Spring/Spring.Web.Conversation.NHibernate33.Tests/Spring.Web.Conversation.NHibernate33.Tests.2010.csproj b/test/Spring/Spring.Web.Conversation.NHibernate33.Tests/Spring.Web.Conversation.NHibernate33.Tests.2010.csproj index 0dc6abe6..d2e846ed 100644 --- a/test/Spring/Spring.Web.Conversation.NHibernate33.Tests/Spring.Web.Conversation.NHibernate33.Tests.2010.csproj +++ b/test/Spring/Spring.Web.Conversation.NHibernate33.Tests/Spring.Web.Conversation.NHibernate33.Tests.2010.csproj @@ -45,6 +45,7 @@ Program $(MSBuildProjectDirectory)\..\..\dependencies\tools\NUnit-2.6.0.12051\bin\nunit-x86.exe "$(MSBuildProjectDirectory)\$(OutputPath)\$(AssemblyName).dll" + true pdbonly @@ -53,6 +54,7 @@ TRACE;NET_40 prompt 4 + true diff --git a/test/Spring/Spring.Web.Mvc3.Tests/Spring.Web.Mvc3.Tests.2010.csproj b/test/Spring/Spring.Web.Mvc3.Tests/Spring.Web.Mvc3.Tests.2010.csproj index d3929ef0..c2701489 100644 --- a/test/Spring/Spring.Web.Mvc3.Tests/Spring.Web.Mvc3.Tests.2010.csproj +++ b/test/Spring/Spring.Web.Mvc3.Tests/Spring.Web.Mvc3.Tests.2010.csproj @@ -27,10 +27,11 @@ pdbonly true - bin\Release\ + ..\..\..\build\VS.Net.2010\Spring.Web.Mvc3.Tests\Release\ TRACE prompt 4 + true diff --git a/test/Spring/Spring.Web.Mvc4.Tests/Spring.Web.Mvc4.Tests.2010.csproj b/test/Spring/Spring.Web.Mvc4.Tests/Spring.Web.Mvc4.Tests.2010.csproj index fb299ca5..1280c373 100644 --- a/test/Spring/Spring.Web.Mvc4.Tests/Spring.Web.Mvc4.Tests.2010.csproj +++ b/test/Spring/Spring.Web.Mvc4.Tests/Spring.Web.Mvc4.Tests.2010.csproj @@ -27,10 +27,11 @@ pdbonly true - bin\Release\ + ..\..\..\build\VS.Net.2010\Spring.Web.Mvc4.Tests\Release\ TRACE prompt 4 + true diff --git a/test/Spring/Spring.Web.Mvc5.Tests/Spring.Web.Mvc5.Tests.2010.csproj b/test/Spring/Spring.Web.Mvc5.Tests/Spring.Web.Mvc5.Tests.2010.csproj index 981ca2c2..7a05260c 100644 --- a/test/Spring/Spring.Web.Mvc5.Tests/Spring.Web.Mvc5.Tests.2010.csproj +++ b/test/Spring/Spring.Web.Mvc5.Tests/Spring.Web.Mvc5.Tests.2010.csproj @@ -30,10 +30,11 @@ pdbonly true - bin\Release\ + ..\..\..\build\VS.Net.2010\Spring.Web.Mvc5.Tests\Release\ TRACE prompt 4 + true false diff --git a/test/Spring/Spring.Web.Tests/Spring.Web.Tests.2010.csproj b/test/Spring/Spring.Web.Tests/Spring.Web.Tests.2010.csproj index 09224205..40a6c825 100644 --- a/test/Spring/Spring.Web.Tests/Spring.Web.Tests.2010.csproj +++ b/test/Spring/Spring.Web.Tests/Spring.Web.Tests.2010.csproj @@ -86,7 +86,7 @@ true false false - false + true 4 none prompt