Exemplo n.º 1
0
        public async Task DownloadImageReturns500WhenExceptionIsNotKnown()
        {
            var imageStoreMock = new Mock <IImageStore>();

            imageStoreMock.Setup(store => store.Download(_testImageUpload.ImageId)).ThrowsAsync(new Exception("Test Exception"));

            var           loggerStub = new ImagesControllerLoggerStub();
            var           controller = new ImagesController(imageStoreMock.Object, loggerStub, new TelemetryClient());
            IActionResult result     = await controller.DownloadImage(_testImageUpload.ImageId);

            AssertUtils.HasStatusCode(HttpStatusCode.InternalServerError, result);
            Assert.Contains(LogLevel.Error, loggerStub.LogEntries.Select(entry => entry.Level));
        }