diff --git a/Source/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj b/Source/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj
index c682242..352a0e6 100644
--- a/Source/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj
+++ b/Source/NSubstitute.Acceptance.Specs/NSubstitute.Acceptance.Specs.csproj
@@ -71,7 +71,6 @@
-
diff --git a/Source/NSubstitute.Acceptance.Specs/SubstituteTests.cs b/Source/NSubstitute.Acceptance.Specs/SubstituteTests.cs
deleted file mode 100644
index 70533b3..0000000
--- a/Source/NSubstitute.Acceptance.Specs/SubstituteTests.cs
+++ /dev/null
@@ -1,168 +0,0 @@
-using System;
-using NSubstitute.Exceptions;
-using NUnit.Framework;
-
-namespace NSubstitute.Acceptance.Specs
-{
- [TestFixture]
- public class SubstituteTests
- {
- [TestFixture]
- public class ForTests
- {
- [TestFixture]
- public class ThatCallsBaseByDefaultTests
- {
- [Test]
- public void Given_SubstituteForInterface_When_MethodIsCalled_Then_ShouldThrowException()
- {
- var testAbstractClass = Substitute.For(ThatCallsBase.ByDefault);
- Assert.Throws(testAbstractClass.TestMethod);
- }
-
- [Test]
- public void Given_SubstituteForAbstractClass_When_AbstractMethodIsCalled_Then_ShouldThrowException()
- {
- var testAbstractClass = Substitute.For(ThatCallsBase.ByDefault);
- Assert.Throws(testAbstractClass.AbstractMethod);
- }
-
- [Test]
- public void Given_SubstituteForAction_When_ActionIsCalled_Then_ShouldThrowException()
- {
- var action = Substitute.For(ThatCallsBase.ByDefault);
- Assert.Throws(() => action());
- }
-
- [Test]
- public void Given_SubstituteForFunc_When_FuncIsCalled_Then_ShouldThrowException()
- {
- var func = Substitute.For>(ThatCallsBase.ByDefault);
- Assert.Throws(() => func());
- }
-
- [Test]
- public void Given_SubstituteForEventHandler_When_EventHandlerIsCalled_Then_ShouldThrowException()
- {
- var eventHandler = Substitute.For(ThatCallsBase.ByDefault);
- Assert.Throws(() => eventHandler.Invoke(null, null));
- }
-
- [Test]
- public void Given_SubstituteForAbstractClass_When_MethodWithImplementationIsCalled_Then_ShouldCallBaseImplementation()
- {
- var testAbstractClass = Substitute.For(ThatCallsBase.ByDefault);
- Assert.That(testAbstractClass.MethodWithImplementation(1), Is.EqualTo(1));
- }
-
- [Test]
- public void Given_SubstituteForClass_When_VirtualMethodIsCalled_Then_ShouldCallBaseImplementation()
- {
- var testClass = Substitute.For(ThatCallsBase.ByDefault);
- testClass.VirtualMethod();
- Assert.That(testClass.CalledTimes, Is.EqualTo(1));
- }
-
- [Test]
- public void Given_SubstituteForClass_When_AbstractMethodIsCalled_Then_ShouldCallBaseImplementation()
- {
- var testClass = Substitute.For(ThatCallsBase.ByDefault);
- testClass.AbstractMethod();
- Assert.That(testClass.CalledTimes, Is.EqualTo(1));
- }
-
- [Test]
- public void Given_SubstituteForClass_When_NotVirtualMethodIsCalled_Then_ShouldCallBaseImplementation()
- {
- var testClass = Substitute.For(ThatCallsBase.ByDefault);
- testClass.NotVirtualMethodReturnsSameInt(1);
- Assert.That(testClass.CalledTimes, Is.EqualTo(1));
- }
-
- [Test]
- public void Given_SubstituteForClass_When_VirtualMethodIsCalledTwice_Then_ShouldCallBaseImplementationTwice()
- {
- var testClass = Substitute.For(ThatCallsBase.ByDefault);
- testClass.VirtualMethod();
- testClass.VirtualMethod();
- Assert.That(testClass.CalledTimes, Is.EqualTo(2));
- }
-
- [Test]
- public void Given_SubstituteForClass_When_VirtualMethodsReturnValueIsOverwritten_Then_ShouldNotCallBaseImplementation()
- {
- var testClass = Substitute.For(ThatCallsBase.ByDefault);
- testClass.VirtualMethodReturnsSameInt(Arg.Any()).Returns(1);
- Assert.That(testClass.CalledTimes, Is.EqualTo(0));
- }
-
- [Test]
- public void Given_SubstituteForClass_And_ReturnValueIsOverwritten_When_VirtualMethodIsCalled_Then_ShouldReturnOverwrittenValue()
- {
- var testClass = Substitute.For(ThatCallsBase.ByDefault);
- testClass.VirtualMethodReturnsSameInt(Arg.Any()).Returns(2);
- Assert.That(testClass.VirtualMethodReturnsSameInt(1), Is.EqualTo(2));
- }
-
- [Test]
- public void Given_SubstituteForClass_And_VirtualMethodReturnValueForSpecifiedArg_When_VirtualMethodIsCalledWithSpecifiedArg_Then_ShouldNotCallBaseImplementation()
- {
- var testClass = Substitute.For(ThatCallsBase.ByDefault);
- testClass.VirtualMethodReturnsSameInt(Arg.Is(1)).Returns(2);
- Assert.That(testClass.VirtualMethodReturnsSameInt(1), Is.EqualTo(2));
- Assert.That(testClass.CalledTimes, Is.EqualTo(0));
- }
-
- [Test]
- public void Given_SubstituteForClass_And_VirtualMethodReturnValueForSpecifiedArg_When_VirtualMethodIsCalledWithoutSpecifiedArg_Then_ShouldCallBaseImplementation()
- {
- var testClass = Substitute.For(ThatCallsBase.ByDefault);
- testClass.VirtualMethodReturnsSameInt(Arg.Is(1)).Returns(2);
- Assert.That(testClass.VirtualMethodReturnsSameInt(3), Is.EqualTo(3));
- Assert.That(testClass.CalledTimes, Is.EqualTo(1));
- }
-
- public interface ITestInterface
- {
- void TestMethod();
- }
-
- public abstract class TestAbstractClass
- {
- public abstract void AbstractMethod();
- public int MethodWithImplementation(int i)
- {
- return i;
- }
- }
-
- public class TestClass : TestAbstractClass
- {
- public int CalledTimes { get; set; }
-
- public virtual int VirtualMethodReturnsSameInt(int i)
- {
- CalledTimes++;
- return i;
- }
-
- public virtual void VirtualMethod()
- {
- CalledTimes++;
- }
-
- public int NotVirtualMethodReturnsSameInt(int i)
- {
- CalledTimes++;
- return i;
- }
-
- public override void AbstractMethod()
- {
- CalledTimes++;
- }
- }
- }
- }
- }
-}
diff --git a/Source/NSubstitute.Specs/CallFactorySpecs.cs b/Source/NSubstitute.Specs/CallFactorySpecs.cs
index 0551bee..635c96c 100644
--- a/Source/NSubstitute.Specs/CallFactorySpecs.cs
+++ b/Source/NSubstitute.Specs/CallFactorySpecs.cs
@@ -26,7 +26,7 @@ namespace NSubstitute.Specs
public override void Because()
{
- _result = sut.Create(_method, _args, _target);
+ _result = sut.Create(_method, _args, _target, () => null);
}
[Test]
diff --git a/Source/NSubstitute.Specs/ConfigureCallSpecs.cs b/Source/NSubstitute.Specs/ConfigureCallSpecs.cs
index e9228c5..d9cc9ca 100644
--- a/Source/NSubstitute.Specs/ConfigureCallSpecs.cs
+++ b/Source/NSubstitute.Specs/ConfigureCallSpecs.cs
@@ -11,7 +11,6 @@ namespace NSubstitute.Specs
public abstract class Concern : ConcernFor
{
protected ICallActions _callActions;
- protected ICallBaseSpecifications _callBaseSpecifications;
protected ICallResults _configuredResults;
protected IGetCallSpec _getCallSpec;
protected IReturn _compatibleReturnValue;
@@ -21,7 +20,6 @@ namespace NSubstitute.Specs
_configuredResults = mock();
_callActions = mock();
_getCallSpec = mock();
- _callBaseSpecifications = mock();
_compatibleReturnValue = mock();
_compatibleReturnValue.stub(x => x.CanBeAssignedTo(It.IsAny())).Return(true);
@@ -29,7 +27,7 @@ namespace NSubstitute.Specs
public override ConfigureCall CreateSubjectUnderTest()
{
- return new ConfigureCall(_configuredResults, _callActions, _getCallSpec, _callBaseSpecifications);
+ return new ConfigureCall(_configuredResults, _callActions, _getCallSpec);
}
}
diff --git a/Source/NSubstitute/Core/CallFactory.cs b/Source/NSubstitute/Core/CallFactory.cs
index e2ec9e8..aebaa03 100644
--- a/Source/NSubstitute/Core/CallFactory.cs
+++ b/Source/NSubstitute/Core/CallFactory.cs
@@ -16,7 +16,7 @@ namespace NSubstitute.Core
_context = context;
}
- public ICall Create(MethodInfo methodInfo, object[] arguments, object target, Func