Skip to content

Instantly share code, notes, and snippets.

@hotgazpacho
Created September 14, 2010 17:14
Show Gist options
  • Select an option

  • Save hotgazpacho/579389 to your computer and use it in GitHub Desktop.

Select an option

Save hotgazpacho/579389 to your computer and use it in GitHub Desktop.
using NUnit.Framework;
public abstract class CollectionViewBaseTests
{
// abstract factory method
public abstract CollectionViewBase GetView();
[Test]
public void HasDisposableEditorManager()
{
using (var view = GetView())
{
Assert.IsInstanceOf<DisposableEditorManager>(view.EditorManager);
}
}
[Test]
public void Dispose_DisposesOfEditorManager()
{
var view = GetView();
bool disposed = false;
view.EditorManager.Disposed += (o, args) => disposed = true;
view.Dispose();
Assert.True(disposed);
}
}
using NUnit.Framework;
[TestFixture]
public class FooCollectionViewerTest : CollectionViewBaseTests
{
// overriden factory method
public override CollectionViewBase GetView()
{
return new FooCollectionViewer();
}
// FooCollectionViewer specific tests follow
}
using NUnit.Framework;
[TestFixture]
public class ZiffCollectionViewerTest : CollectionViewBaseTests
{
// overriden factory method
public override CollectionViewBase GetView()
{
return new ZiffCollectionViewer();
}
// ZiffCollectionViewer specific tests follow
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment