Пример #1
0
        public GetAlbumResponse GetAlbum(GetAlbumRequest request)
        {
            var response = new GetAlbumResponse();

            var album = _albumRepository.FindBy(request.Id);

            response.Album = album.ConvertToAlbumView();

            return(response);
        }
        public void TestFunction()
        {
            // Invoke the lambda function wrapped with Thundra and confirm the greeting was returned.
            var             function = new Function();
            GetAlbumRequest alreq    = new GetAlbumRequest();

            alreq.id = 3;
            var context   = new TestLambdaContext();
            var upperCase = function.DoHandleRequest(alreq, context);

            Assert.Equal("Flower shower", upperCase.Name);
        }
Пример #3
0
        public string GetAlbum(GetAlbumRequest request)
        {
            var album = _dataSource.GetAlbum(request.AlbumId);

            // В т.з. не указано как следует организовать обработку ошибок, по-этому тут в случае если альбом не найден поднимаю исключение
            if (album == null)
            {
                throw new WebException(string.Format("Album with ID='{0} not found.'", request.AlbumId), WebExceptionStatus.UnknownError);
            }

            return(GetResponse(
                       request,
                       () => new GetAlbumResponse
            {
                Album = album
            }));
        }