コード例 #1
0
        public void WebProcessingExtensions_GetBySupportedCommands_Empty()
        {
            var processors = new IImageWebProcessor[]
            {
                new MockWebProcessor()
            };

            CommandCollection commands = new();

            IReadOnlyList <(int Index, IImageWebProcessor Processor)> supportedProcessors = processors.OrderBySupportedCommands(commands);

            Assert.Empty(supportedProcessors);
        }
コード例 #2
0
        public void WebProcessingExtensions_GetBySupportedCommands()
        {
            var processors = new IImageWebProcessor[]
            {
                new QualityWebProcessor(),
                new ResizeWebProcessor(),
                new BackgroundColorWebProcessor(),
                new MockWebProcessor()
            };

            CommandCollection commands = new()
            {
                new(ResizeWebProcessor.Width, null),
                new(QualityWebProcessor.Quality, null),
                new(ResizeWebProcessor.Height, null)
            };

            IReadOnlyList <(int Index, IImageWebProcessor Processor)> supportedProcessors = processors.OrderBySupportedCommands(commands);

            Assert.Equal(2, supportedProcessors.Count);
            Assert.IsType <ResizeWebProcessor>(supportedProcessors[0].Processor);
            Assert.IsType <QualityWebProcessor>(supportedProcessors[1].Processor);
        }