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 }
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 }