コード例 #1
0
        public void CanAddRemoveAllFactoryCommandConverters()
        {
            var services = new ServiceCollection();
            IImageSharpBuilder builder = services.AddImageSharp();

            builder.AddConverter(_ => new MockCommandConverter());
            Assert.Single(services, IsService <ICommandConverter, MockCommandConverter>);
            Assert.Single(services, IsServiceImplementationFactory <ICommandConverter, MockCommandConverter>);

            builder.ClearConverters();
            Assert.DoesNotContain(services, IsService <ICommandConverter>);
        }
コード例 #2
0
        public void CanAddRemoveAllCommandConverters()
        {
            var services = new ServiceCollection();

            IImageSharpBuilder builder = services.AddImageSharp()
                                         .AddConverter <MockCommandConverter>();

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

            builder.ClearConverters();

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