public void ShouldHasOnlyOneInstanceOfFactory() { var sfp = new SessionFactoryProvider(); ISessionFactory sf1 = sfp.GetFactory(null); ISessionFactory sf2 = sfp.GetFactory(null); Assert.That(sf1, Is.Not.Null); Assert.That(ReferenceEquals(sf1, sf2)); Assert.That(sfp.Count(), Is.EqualTo(1)); IEnumerator en = ((IEnumerable)sfp).GetEnumerator(); int i = 0; while (en.MoveNext()) { i++; } Assert.That(i, Is.EqualTo(1)); }