public void CanAddRemoveFactoryImageProviders()
        {
            var services = new ServiceCollection();
            IImageSharpBuilder builder = services.AddImageSharp();

            builder.AddProvider(_ => new MockImageProvider());
            Assert.Single(services, IsService <IImageProvider, MockImageProvider>);
            Assert.Single(services, IsServiceImplementationFactory <IImageProvider, MockImageProvider>);

            builder.RemoveProvider <MockImageProvider>();
            Assert.DoesNotContain(services, IsService <IImageProvider, MockImageProvider>);
        }
        public void CanAddRemoveImageProviders()
        {
            var services = new ServiceCollection();

            IImageSharpBuilder builder = services.AddImageSharp()
                                         .AddProvider <MockImageProvider>();

            Assert.Contains(services, x => x.ImplementationType == typeof(MockImageProvider));

            builder.RemoveProvider <MockImageProvider>();

            Assert.DoesNotContain(services, x => x.ImplementationType == typeof(MockImageProvider));
        }
        public void CanInsertRemoveImageProviders()
        {
            var services = new ServiceCollection();
            IImageSharpBuilder builder = services.AddImageSharp();

            builder.InsertProvider <MockImageProvider>(0);
            Assert.Single(services, IsService <IImageProvider, MockImageProvider>);
            Assert.Single(services, IsServiceImplementationType <IImageProvider, MockImageProvider>);

            IReadOnlyList <ServiceDescriptor> providers = GetCollection <IImageProvider>(services);

            Assert.Equal(2, providers.Count);
            Assert.True(IsService <IImageProvider, MockImageProvider>(providers[0]));

            builder.RemoveProvider <MockImageProvider>();
            Assert.DoesNotContain(services, IsService <IImageProvider, MockImageProvider>);
        }
        public void CanAddRemoveImageProviders()
        {
            void RemoveServices(IServiceCollection services)
            {
                IImageSharpBuilder builder = services.AddImageSharp()
                                             .AddProvider <MockImageProvider>();

                Assert.Contains(services, x => x.ImplementationType == typeof(MockImageProvider));

                builder.RemoveProvider <MockImageProvider>();

                Assert.DoesNotContain(services, x => x.ImplementationType == typeof(MockImageProvider));
            }

            using (TestServer server = ImageSharpTestServer.Create(ImageSharpTestServer.DefaultConfig, RemoveServices))
            {
            }
        }