public void CreateService_MultipleCalls_InvokesLambdaEachTime(int times)
        {
            // Arrange

            var serviceProvider = new Mock <IServiceProvider>();

            var count   = 0;
            var factory = new TransientServiceFactory(provider =>
            {
                Assert.Equal(serviceProvider.Object, provider);
                count++;

                return(null);
            });

            factory.Initialize(serviceProvider.Object);

            // Act

            foreach (var _ in Enumerable.Range(1, times))
            {
                factory.CreateService(typeof(object));
            }

            // Assert

            Assert.Equal(times, count);
        }
        public void CreateService_NotInitialized_InvalidOperationException()
        {
            // Arrange

            var factory = new TransientServiceFactory(_ => null);

            // Act

            Assert.Throws <InvalidOperationException>(() => factory.CreateService(typeof(object)));
        }