Changed failing DotNetMock tests to use Rhino, one test needs checkup to get it out from ignore

This commit is contained in:
lahma
2009-07-23 21:49:09 +00:00
parent b61a475ff2
commit bb05bc85e6
9 changed files with 329 additions and 259 deletions

View File

@@ -1,26 +1,26 @@
using System.Threading;
using DotNetMock.Dynamic;
using NUnit.Framework;
using Rhino.Mocks;
namespace Spring.Threading
{
[TestFixture]
public class SyncHolderTest
{
DynamicMock mock;
private MockRepository mocks;
ISync sync;
[SetUp]
public void SetUp ()
{
mock = new DynamicMock(typeof(ISync));
sync = (ISync) mock.Object;
mocks = new MockRepository();
sync = (ISync) mocks.CreateMock(typeof(ISync));
}
[TearDown]
public void TearDown ()
{
mock.Verify();
mocks.VerifyAll();
}
class MySemaphore : Semaphore
@@ -32,6 +32,9 @@ namespace Spring.Threading
[Test]
public void CanBeUsedWithTheUsingCSharpIdiomToAttemptOnAnISync ()
{
// no expectations
mocks.ReplayAll();
MySemaphore sync = new MySemaphore(1);
using (new SyncHolder(sync, 100))
{
@@ -57,8 +60,10 @@ namespace Spring.Threading
[ExpectedException(typeof(ThreadStateException))]
public void CanBeUsedWithTheUsingCSharpIdiomToAcquireAnIsync()
{
mock.Expect("Acquire");
mock.Expect("Release");
sync.Acquire();
sync.Release();
mocks.ReplayAll();
using (new SyncHolder(sync))
{
throw new ThreadStateException();