Example #1
0
        public void ShouldThrowWhenProvidedUnsupportedProcessingStrategy()
        {
            // Given
            const ProcessingStrategy processingStrategy = (ProcessingStrategy)3;
            var imageProvider                = new Mock <IImageProvider>().Object;
            var imageProcessingChain         = new Mock <IImageProcessingChain>().Object;
            var receiveProcessedImageCommand = new Mock <IReceiveProcessedImageCommand>().Object;
            var factory  = new ProcessingEngineFactory();
            var template = new ProcessingEngineTemplate
            {
                ProcessingStrategy           = processingStrategy,
                ImageProvider                = imageProvider,
                ImageProcessingChain         = imageProcessingChain,
                ReceiveProcessedImageCommand = receiveProcessedImageCommand
            };

            // When
            // Then
            Assert.Throws <ArgumentOutOfRangeException>(() => factory.CreateInstance(template));
        }
Example #2
0
        public void ShouldCreateInstanceOfProcessingEngine(ProcessingStrategy processingStrategy)
        {
            // Given
            var imageProvider                = new Mock <IImageProvider>().Object;
            var imageProcessingChain         = new Mock <IImageProcessingChain>().Object;
            var receiveProcessedImageCommand = new Mock <IReceiveProcessedImageCommand>().Object;
            var factory  = new ProcessingEngineFactory();
            var template = new ProcessingEngineTemplate
            {
                ProcessingStrategy           = processingStrategy,
                ImageProvider                = imageProvider,
                ImageProcessingChain         = imageProcessingChain,
                ReceiveProcessedImageCommand = receiveProcessedImageCommand
            };

            // When
            var engine = factory.CreateInstance(template);

            // Then
            Assert.IsNotNull(engine);
        }