Esempio n. 1
0
 public void ResolveOverMaxSizeWillThrow(PooledContainer sut)
 {
     // Fixture setup
     sut.MaxSize = 1;
     sut.ResolveProductManagementService();
     // Exercise system and verify outcome
     Assert.Throws <InvalidOperationException>(() => sut.ResolveProductManagementService());
     // Teardown
 }
Esempio n. 2
0
        public void ResolveTwiceWillReturnDifferentInstances(PooledContainer sut)
        {
            // Fixture setup
            sut.MaxSize = 10;
            var unexpected = sut.ResolveProductManagementService();
            // Exercise system
            var result = sut.ResolveProductManagementService();

            // Verify outcome
            Assert.NotSame(unexpected, result);
            // Teardown
        }
Esempio n. 3
0
        public void ResolvingServicesAndReleasingItAndThenResolvingTwiceShouldThrow(PooledContainer sut)
        {
            // Fixture setup
            sut.MaxSize = 1;

            var s = sut.ResolveProductManagementService();

            sut.Release(s);
            sut.ResolveProductManagementService();
            // Exercise system and verify outcome
            Assert.Throws <InvalidOperationException>(() => sut.ResolveProductManagementService());
            // Teardown
        }
Esempio n. 4
0
        public void ResolveTwiceWillReturnResultsWithDifferentRepositories(PooledContainer sut)
        {
            // Fixture setup
            sut.MaxSize = 2;
            var other = sut.ResolveProductManagementService();
            // Exercise system
            var result = sut.ResolveProductManagementService();
            // Verify outcome
            var srvc1 = Assert.IsAssignableFrom <ProductManagementService>(other);
            var srvc2 = Assert.IsAssignableFrom <ProductManagementService>(result);

            Assert.NotSame(srvc1.Repository, srvc2.Repository);
            // Teardown
        }
Esempio n. 5
0
        public void RepeatedlyResolvingAndRemovingMustBePossible(PooledContainer sut)
        {
            // Fixture setup
            sut.MaxSize = 1;

            // Exercise system
            Assert.DoesNotThrow(() =>
            {
                sut.Release(sut.ResolveProductManagementService());
                sut.Release(sut.ResolveProductManagementService());
                sut.Release(sut.ResolveProductManagementService());
            });
            // Verify outcome
            // Teardown
        }
Esempio n. 6
0
        public void ResolveWillReturnCorrectType(PooledContainer sut)
        {
            // Fixture setup
            // Exercise system
            var result = sut.ResolveProductManagementService();

            // Verify outcome
            Assert.IsAssignableFrom <ProductManagementService>(result);
            // Teardown
        }
Esempio n. 7
0
        public void ResolveWillReturnResultWithCorrectRepository(PooledContainer sut)
        {
            // Fixture setup
            // Exercise system
            var result = sut.ResolveProductManagementService();
            // Verify outcome
            var actual = Assert.IsAssignableFrom <ProductManagementService>(result);

            Assert.IsAssignableFrom <XferProductRepository>(actual.Repository);
            // Teardown
        }