Exemplo n.º 1
0
        public virtual async void TestDelete()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);
            var        client     = new ApiClient(testServer.CreateClient());

            client.SetBearerToken(JWTTestHelper.GenerateBearerToken());
            ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;

            ISpeciesService service = testServer.Host.Services.GetService(typeof(ISpeciesService)) as ISpeciesService;
            var             model   = new ApiSpeciesServerRequestModel();

            model.SetProperties("B");
            CreateResponse <ApiSpeciesServerResponseModel> createdResponse = await service.Create(model);

            createdResponse.Success.Should().BeTrue();

            ActionResponse deleteResult = await client.SpeciesDeleteAsync(2);

            deleteResult.Success.Should().BeTrue();
            ApiSpeciesServerResponseModel verifyResponse = await service.Get(2);

            verifyResponse.Should().BeNull();
        }
Exemplo n.º 2
0
 public ProductController(IProductService iproductservice, IManufacturerService imanufacturerService, ISpeciesService ispec, IWebHostEnvironment iwebhost)
 {
     iProdSrvice     = iproductservice;
     iManuFService   = imanufacturerService;
     iSpecies        = ispec;
     iAppEnvironment = iwebhost;
 }
Exemplo n.º 3
0
        public virtual async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());

            client.SetBearerToken(JWTTestHelper.GenerateBearerToken());
            var mapper = new ApiSpeciesServerModelMapper();
            ApplicationDbContext          context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;
            ISpeciesService               service = testServer.Host.Services.GetService(typeof(ISpeciesService)) as ISpeciesService;
            ApiSpeciesServerResponseModel model   = await service.Get(1);

            ApiSpeciesClientRequestModel request = mapper.MapServerResponseToClientRequest(model);

            request.SetProperties("B");

            UpdateResponse <ApiSpeciesClientResponseModel> updateResponse = await client.SpeciesUpdateAsync(model.Id, request);

            context.Entry(context.Set <Species>().ToList()[0]).Reload();
            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
            updateResponse.Record.Id.Should().Be(1);
            context.Set <Species>().ToList()[0].Name.Should().Be("B");

            updateResponse.Record.Id.Should().Be(1);
            updateResponse.Record.Name.Should().Be("B");
        }
Exemplo n.º 4
0
 public GenusManager(HttpClient httpClient, IHttpContextAccessor httpContextAccessor, ISpeciesService speciesService)
 {
     _httpClient             = httpClient;
     _httpClient.BaseAddress = new Uri(StaticVars.BaseAPIAdress);
     _httpContextAccessor    = httpContextAccessor;
     _speciesService         = speciesService;
 }
Exemplo n.º 5
0
 public RecommendationApiController(
     ISpeciesService speciesService,
     IRegionService regionService,
     IProductionMethodService productionMethodService,
     IRecommendationService recommendationService)
     : base(speciesService, productionMethodService, regionService, recommendationService)
 {
 }
Exemplo n.º 6
0
 public AnalysisController(
     ISpeciesService speciesService,
     IRegionService regionService,
     IProductionMethodService productionMethodService,
     IRecommendationService recommendationService,
     IBodyOfWaterService bodyOfWaterService,
     ICriteria2Service criteriaService)
     : base(speciesService, productionMethodService, regionService, recommendationService, bodyOfWaterService, criteriaService)
 {
 }
Exemplo n.º 7
0
 public ApiControllerBase(
     ISpeciesService speciesService,
     IProductionMethodService productionMethodService,
     IRegionService regionService,
     IRecommendationService recommendationService)
 {
     this.speciesService = speciesService;
     this.productionMethodService = productionMethodService;
     this.regionService = regionService;
     this.recommendationService = recommendationService;
 }
Exemplo n.º 8
0
 public AbstractSpeciesController(
     ApiSettings settings,
     ILogger <AbstractSpeciesController> logger,
     ITransactionCoordinator transactionCoordinator,
     ISpeciesService speciesService,
     IApiSpeciesModelMapper speciesModelMapper
     )
     : base(settings, logger, transactionCoordinator)
 {
     this.SpeciesService     = speciesService;
     this.SpeciesModelMapper = speciesModelMapper;
 }
Exemplo n.º 9
0
 public SpeciesController(
     ApiSettings settings,
     ILogger <SpeciesController> logger,
     ITransactionCoordinator transactionCoordinator,
     ISpeciesService speciesService,
     IApiSpeciesServerModelMapper speciesModelMapper
     )
     : base(settings, logger, transactionCoordinator)
 {
     this.SpeciesService     = speciesService;
     this.SpeciesModelMapper = speciesModelMapper;
     this.BulkInsertLimit    = 250;
     this.MaxLimit           = 1000;
     this.DefaultLimit       = 250;
 }
Exemplo n.º 10
0
        public async Task <IActionResult> GetSpecies([FromServices] ISpeciesService service, [FromQuery] SpeciesBindingModel model)
        {
            var species = new PaginatedSpecies();

            if (!string.IsNullOrEmpty(model.search))
            {
                species = await service.GetSpeciesByName(model.search, model.page);
            }

            else
            {
                species = await service.GetAllSpecies(model.page);
            }

            return(Ok(species));
        }
Exemplo n.º 11
0
 public ControllerBase(
     ISpeciesService speciesService,
     IProductionMethodService productionMethodService,
     IRegionService regionService,
     IRecommendationService recommendationService,
     IBodyOfWaterService bodyOfWaterService,
     ICriteria2Service criteriaService)
     : this()
 {
     this.speciesService = speciesService;
     this.regionService = regionService;
     this.productionMethodService = productionMethodService;
     this.recommendationService = recommendationService;
     this.bodyOfWaterService = bodyOfWaterService;
     this.criteriaService = criteriaService;
 }
Exemplo n.º 12
0
 public SpeciesViewModel(INavigationService navigationService, IPageDialogService pageDialogService, ISpeciesService speciesService) : base(navigationService, pageDialogService)
 {
     _speciesService = speciesService;
     GetApp();
 }
 public SpeciesController()
 {
     _speciesService = new SpeciesService();
 }
Exemplo n.º 14
0
 public SpeciesController(ISpeciesService speciesService, IMapper mapper)
 {
     this.speciesService = speciesService;
     this.mapper         = mapper;
 }
 public SpeciesController(ISpeciesService speciesService)
 {
     _speciesService = speciesService;
 }
Exemplo n.º 16
0
 public SpeciesController(ISpeciesService speciesService)
 {
     _speciesService = speciesService ?? throw new ArgumentNullException(nameof(speciesService));
 }
Exemplo n.º 17
0
 public PetsController(IPetService petService, IOwnerService ownerService, ISpeciesService speciesService)
 {
     this._ownerService   = ownerService;
     this._petService     = petService;
     this._speciesService = speciesService;
 }
Exemplo n.º 18
0
 public SpeciesApiController(ISpeciesService speciesService)
 {
     this.speciesService = speciesService;
 }
Exemplo n.º 19
0
 public SpeciesController(ISpeciesService _speciesService)
 {
     iSpeciesService = _speciesService;
 }
Exemplo n.º 20
0
 public SpeciesController(ISpeciesService speciesService, IGenusService genusService)
 {
     _speciesService = speciesService;
     _genusService   = genusService;
 }
Exemplo n.º 21
0
 public PetsController(IPetsService pets, ISpeciesService species, IUsersService users)
     : base(users)
 {
     this.pets = pets;
     this.species = species;
 }
Exemplo n.º 22
0
 public PetsController(IPetsService pets, ISpeciesService species)
 {
     this.pets = pets;
     this.species = species;
 }
 public CharacterController(ICharacterService characterService, ISpeciesService speciesService, IUploadService uploadService)
 {
     _characterService = characterService;
     _speciesService   = speciesService;
     _uploadService    = uploadService;
 }
Exemplo n.º 24
0
 public SpeciesViewModel()
 {
     _service = ServiceContainer.Resolve <ISpeciesService>();
 }
Exemplo n.º 25
0
 public SpeciesController(ISpeciesService sp)
 {
     _sp = sp;
 }