Exemplo n.º 1
0
        public void ServiceMustGet()
        {
            var service = new ProxyService(this.context);
            var result  = service.Get();

            Assert.NotNull(result);
        }
Exemplo n.º 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));
        }
Exemplo n.º 4
0
 public override Task <Proxy> Get(Proxy request, ServerCallContext context)
 {
     return(Task.FromResult((Proxy)proxyService.Get(request)));
 }
Exemplo n.º 5
0
 public IActionResult Get(Guid id)
 {
     return(Ok(proxyService.Get(id)));
 }
Exemplo n.º 6
0
 public object Get(string url)
 {
     return(Content(_service.Get(url), "application/json"));
 }