public async System.Threading.Tasks.Task GetFilterParameters_CallsApi() { // arrange string endpoint = "endPoint"; configuration[EndPoints.Api.GetFilterParameters].Returns(endpoint); FilterParametersDto parameters = new FilterParametersDto() { Countries = new List <CountryDto>(), ItemTypes = new List <ItemTypeDto>(), OrderPriorities = new List <OrderPriorityDto>(), Regions = new List <RegionDto>(), SalesChannels = new List <SalesChannelDto>() }; GetSalesRequestDto requestDto = GetSalesRequestDtoBuilder.Build(); httpClient.GetAsync <FilterParametersDto>(endpoint).Returns(parameters); // act await saleService.GetFilterParameters(requestDto); // assert await httpClient.Received(1).GetAsync <FilterParametersDto>(endpoint); }
public async System.Threading.Tasks.Task GetFilterParameters_ArgsOk_CallsService() { // arrange GetSalesRequestDto requestDto = GetSalesRequestDtoBuilder.Build(); // act await saleController.GetFilterParameters(requestDto); // assert await saleService.Received(1).GetFilterParameters(requestDto); }
public async System.Threading.Tasks.Task GetLastPageIndexAsync_ArgsOk_CallsService() { // arrange GetSalesRequestDto requestDto = GetSalesRequestDtoBuilder.Build(); // act await saleController.GetLastPageIndexAsync(requestDto); // assert await saleService.Received(1).GetLastPageIndex(requestDto); }
public void GetFilterParameters_NoArgs_CallsService() { // arrange GetSalesRequestDto requestDto = GetSalesRequestDtoBuilder.Build(); // act saleController.GetFilterParameters(requestDto); // assert saleService.Received(1).GetFilterParameters(requestDto); }
public void GetLastPageIndex_ArgsOk_CallsService() { // arrange GetSalesRequestDto requestDto = GetSalesRequestDtoBuilder.Build(); // act saleController.GetLastPageIndex(requestDto); // assert saleService.Received(1).GetLastPageIndex(requestDto); }
public void GetFilterParameters_ArgsOk_CallsRepository() { // arrange GetSalesRequestDto requestDto = GetSalesRequestDtoBuilder.Build(); // act var result = saleService.GetFilterParameters(requestDto); // assert unitOfWork.Sales.Received(1).GetFilterParameters(requestDto); }
public void GetLastPageIndex_ArgsOk_CallsRepository() { // arrange GetSalesRequestDto requestDto = GetSalesRequestDtoBuilder.Build(); // act saleService.GetLastPageIndex(requestDto); // assert unitOfWork.Sales.Received(1).GetLastPageIndex(requestDto); }
public void AddAllAsync_ArgsOk_CallsRepository() { // arrange GetSalesRequestDto requestDto = GetSalesRequestDtoBuilder.Build(); IEnumerable <SaleDto> salesDto = SaleDtoBuilder.BuildList(2); // act saleService.AddAllAsync(salesDto); // assert unitOfWork.Sales.Received(1).AddAllAsync(Arg.Any <IEnumerable <Sale> >()); }
public async System.Threading.Tasks.Task GetSalesAsync_ArgsOk_CallsApi() { // arrange string endpoint = "endPoint"; configuration[EndPoints.Api.GetSales].Returns(endpoint); GetSalesRequestDto requestDto = GetSalesRequestDtoBuilder.Build(); // act await saleService.GetSalesAsync(requestDto); // assert await httpClient.Received(1).GetAsync <IEnumerable <SaleDto> >(endpoint); }
public void GetFilteredSales_ArgsOk_CallsRepository() { // arrange GetSalesRequestDto requestDto = GetSalesRequestDtoBuilder.Build(); IEnumerable <SaleDto> salesDto = SaleDtoBuilder.BuildList(2); List <Sale> sales = new List <Sale>() { new Sale() }; mapper.Map <IEnumerable <SaleDto> >(Arg.Any <IEnumerable <Sale> >()).Returns(salesDto); unitOfWork.Sales.GetFilteredSales(requestDto).Returns(sales); // act saleService.GetFilteredSales(requestDto); // assert unitOfWork.Sales.Received(1).GetFilteredSales(requestDto); }