public async Task ProfferServicesAsync_WhenServiceProviderIsNull_Throws()
        {
            var exception = await Assert.ThrowsAnyAsync <Exception>(
                async() => await NuGetBrokeredServiceFactory.ProfferServicesAsync(serviceProvider: null));

            ExceptionUtility.AssertMicrosoftAssumesException(exception);
        }
        public async Task ProfferServicesAsync_WithAuthorizingBrokeredServiceFactoryService_ProffersService(
            ServiceRpcDescriptor serviceDescriptor,
            Type serviceType)
        {
            using (await NuGetBrokeredServiceFactory.ProfferServicesAsync(this))
            {
                Assert.True(
                    _authorizingServiceFactories.TryGetValue(
                        serviceDescriptor,
                        out AuthorizingBrokeredServiceFactory factory));

                using (var authorizationServiceClient = new AuthorizationServiceClient(new MockAuthorizationService()))
                {
                    object service = await factory(
                        serviceDescriptor.Moniker,
                        default(ServiceActivationOptions),
                        new MockServiceBroker(),
                        authorizationServiceClient,
                        CancellationToken.None);

                    using (service as IDisposable)
                    {
                        Assert.IsType(serviceType, service);
                    }
                }
            }
        }
 public async Task ProfferServicesAsync_WithValidArgument_ProffersAllServices()
 {
     using (await NuGetBrokeredServiceFactory.ProfferServicesAsync(this))
     {
         Assert.Equal(ServicesAndFactories.Count(), _serviceFactories.Count);
         Assert.Equal(ServicesAndAuthorizingFactories.Count(), _authorizingServiceFactories.Count);
     }
 }