public void ResolveOverMaxSizeWillThrow(PooledContainer sut)
 {
     // Fixture setup
     sut.MaxSize = 1;
     sut.ResolveProductManagementService();
     // Exercise system and verify outcome
     Assert.Throws<InvalidOperationException>(() => sut.ResolveProductManagementService());
     // Teardown
 }
 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
 }
 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
 }
 public void ResolveWillReturnCorrectType(PooledContainer sut)
 {
     // Fixture setup
     // Exercise system
     var result = sut.ResolveProductManagementService();
     // Verify outcome
     Assert.IsAssignableFrom<ProductManagementService>(result);
     // Teardown
 }
 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
 }
        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
        }
        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
        }