Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

59 lines (53 sloc) 0.914 kB
using NUnit.Framework;
namespace Logos.Utility.Tests
{
[TestFixture]
public class ScopeTests
{
[Test]
public void Empty()
{
// should compile and run without errors
using (Scope.Empty)
{
}
}
[Test]
public void Create()
{
int i = 0;
using (Scope.Create(() => i++))
{
Assert.That(i, Is.EqualTo(0));
}
Assert.That(i, Is.EqualTo(1));
}
[Test]
public void Cancel()
{
int i = 0;
using (Scope scope = Scope.Create(() => i++))
{
Assert.That(i, Is.EqualTo(0));
scope.Cancel();
}
Assert.That(i, Is.EqualTo(0));
}
[Test]
public void Transfer()
{
int i = 0;
using (Scope scope = Scope.Create(() => i++))
{
Assert.That(i, Is.EqualTo(0));
using (Scope transferred = scope.Transfer())
{
Assert.That(i, Is.EqualTo(0));
}
Assert.That(i, Is.EqualTo(1));
}
Assert.That(i, Is.EqualTo(1));
}
}
}
Jump to Line
Something went wrong with that request. Please try again.