Exemple #1
0
        public void SingletonRegistrations_ShouldBeEquivalent()
        {
            var container  = new TestContainer();
            var singleton1 = container.CreateISingletonClass();
            var singleton2 = container.CreateISingletonClass();

            singleton1.Should().Be(singleton2);
        }
Exemple #2
0
        public void Factory_SingletonInstanceShouldBeSingletonAcrossContainer()
        {
            var container      = new TestContainer();
            var factory        = container.CreateIExampleFactory();
            var singleton      = factory.CreateSingletonClass();
            var otherSingleton = container.CreateISingletonClass();

            singleton.Should().Be(otherSingleton);
        }