public async Task <IActionResult> Get(int page = 1, int size = 25, string order = "{}", string keyword = null, string filter = "{}")
        {
            VerifyUser();

            GetAllGarmentSubconCuttingsQuery query = new GetAllGarmentSubconCuttingsQuery(page, size, order, keyword, filter);
            var viewModel = await Mediator.Send(query);

            return(Ok(viewModel.data, info: new
            {
                page,
                size,
                viewModel.count
            }));
        }
コード例 #2
0
        public async Task Handle_Get_All_Success()
        {
            // Arrange
            GetAllGarmentSubconCuttingsQueryHandler unitUnderTest = CreateUnitUnderTest();
            GetAllGarmentSubconCuttingsQuery        query         = new GetAllGarmentSubconCuttingsQuery(1, 25, "{}", null, "{}");
            CancellationToken cancellationToken = CancellationToken.None;

            _mockGarmentSubconCuttingRepository
            .Setup(s => s.Query)
            .Returns(new List <GarmentSubconCuttingReadModel>().AsQueryable());

            _mockGarmentSubconCuttingRepository
            .Setup(s => s.Find(It.IsAny <IQueryable <GarmentSubconCuttingReadModel> >()))
            .Returns(new List <GarmentSubconCutting>
            {
                new GarmentSubconCutting(Guid.NewGuid(), "RONo", new SizeId(1), "SizeName", 100, new ProductId(1), "ProductCode", "ProductName", new GarmentComodityId(1), "ComodityCode", "ComodityName", "DesignColor", "Remark", 100)
            });

            // Act
            var result = await unitUnderTest.Handle(query, cancellationToken);

            // Assrt
            result.Should().NotBeNull();
        }