public async Task <IEnumerable <InventoryRst> > Handle(GetAllInventoryMsg request, CancellationToken cancellationToken)
        {
            var results = (await this.repository.Get(new Specification <Domain.Inventories.Models.Inventory>(s => true),
                                                     request.PageNo, request.PageSize))
                          .Select(o => new InventoryRst(o));

            return(results);
        }
Exemplo n.º 2
0
        public async Task GetAllInventory()
        {
            var msg    = new GetAllInventoryMsg(1, 1);
            var expect = new List <InventoryRst> {
                new InventoryRst(this.inventory)
            };

            this.mockRepository.Get(Arg.Any <Specification <Inventory> >(), 1, 1)
            .Returns(new List <Inventory>()
            {
                this.inventory
            });

            var svc    = new GetAllInventorySvc(this.mockRepository);
            var actual = await svc.Handle(msg, new CancellationToken());

            actual.Should().BeEquivalentTo(expect.AsEnumerable());
        }