using System; using NUnit.Framework; namespace Chernobyl.Creation { [TestFixture, Description("Tests for StaticFactory type and its " + "base classes.")] public class StaticFactoryTests : FactoryTests { [Test, Description("Ensures the StaticFactory can return a null " + "value as it's single instance.")] public void NullStaticFactoryTest() { var factory = new StaticFactory(null); var result = factory.Create(); Assert.AreEqual(null, result, "The created instance was not null when it was expected to be."); Assert.Fail(); } protected override IFactory CreateSuccessfulFactory() { return new StaticFactory(_instance); } protected override IFactory CreateFailureFactory() { // This class does not have a fail condition. return null; } protected override string GetProperlyCreatedItem() { return _instance; } String _instance = new string('A', 1); } }