コード例 #1
0
 public ArtistaQuery(ArtistaService _service)
 {
     Field <ListGraphType <ArtistaType> >(name: "artistas", resolve: context => _service.ListarArtistas());
     Field <ListGraphType <AlbumType> >(name: "albums", resolve: context => _service.ListartAlbums());
     Field <ArtistaType>(name: "artista", arguments:
                         new QueryArguments(new QueryArgument <GuidGraphType> {
         Name = "id"
     }),
                         resolve: context => _service.ArtistaPorId(context.GetArgument <System.Guid>("id")));
     Field <ListGraphType <AlbumType> >(name: "por_artista", arguments:
                                        new QueryArguments(new QueryArgument <GuidGraphType> {
         Name = "id"
     }),
                                        resolve: context => _service.AlbumPorArtista(context.GetArgument <System.Guid>("id")));
 }
コード例 #2
0
        public async Task Test1Async()
        {
            int artistaId             = 69;
            var MoqlibraryRespository = new Mock <IWindAppRepository>();
            var artistaEntity         = new ArtistaEntity()
            {
                Id = 1, edad = 22, nombre = "S-kap", biografia = "mas progresivos que la palabra", imgPath = "http"
            };

            MoqlibraryRespository.Setup(m => m.GetArtistasAsync(artistaId, false)).Returns(Task.FromResult(artistaEntity));

            var myProfile     = new WindAppProfile();
            var configuration = new MapperConfiguration(cfg => cfg.AddProfile(myProfile));
            var mapper        = new Mapper(configuration);

            var artistaService = new ArtistaService(MoqlibraryRespository.Object, mapper);
            //act
            await Assert.ThrowsAsync <NotFoundException>(() => artistaService.ObtenerArtistaAsync(1, false));
        }
コード例 #3
0
 public ArtistaController()
 {
     ArtistaService = new ArtistaService();
 }
コード例 #4
0
 public ArtistasController(ArtistaService artistaService)
 {
     _artistaService = artistaService;
 }