Пример #1
0
        public void ServiceMustGet()
        {
            var service = new ProxyService(this.context);
            var result  = service.Get();

            Assert.NotNull(result);
        }
Пример #2
0
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <IProxyRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult <Proxy>(null));
            var service = new ProxyService(mock.LoggerMock.Object,
                                           mock.RepositoryMock.Object,
                                           mock.ModelValidatorMockFactory.ProxyModelValidatorMock.Object,
                                           mock.BOLMapperMockFactory.BOLProxyMapperMock,
                                           mock.DALMapperMockFactory.DALProxyMapperMock);

            ApiProxyResponseModel response = await service.Get(default(string));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <string>()));
        }
        public async Task <string> GetMusicDetails()
        {
            var proxy    = new ProxyService(_config["Settings:BaseUrl"]);
            var response = proxy.Get("api/v1/festivals");

            if (!response.IsSuccessStatusCode)
            {
                var asyncResult = response.Content.ReadAsStringAsync().Result;

                Log.Error("MusicService, StatusCode: {0}, Description: {1}, Result: {2}", response.StatusCode, response.ReasonPhrase, asyncResult);
                throw new Exception("Error occured due to " + asyncResult);
            }

            var result = await response.Content.ReadAsStringAsync();

            return(RetrieveRecordDetailsDto(result));
        }
Пример #4
0
 public override Task <Proxy> Get(Proxy request, ServerCallContext context)
 {
     return(Task.FromResult((Proxy)proxyService.Get(request)));
 }
Пример #5
0
 public IActionResult Get(Guid id)
 {
     return(Ok(proxyService.Get(id)));
 }
Пример #6
0
 public object Get(string url)
 {
     return(Content(_service.Get(url), "application/json"));
 }