Exemplo n.º 1
0
 public Task <List <ItemGroupDto> > Handle(GetItemGroupQuery request, CancellationToken cancellationToken)
 {
     return(Task.FromResult(Enum.GetValues(typeof(ItemGroup))
                            .Cast <ItemGroup>()
                            .Select(x => new ItemGroupDto {
         Value = (int)x, Name = x.ToString()
     })
                            .ToList()));
 }
Exemplo n.º 2
0
        private async Task <CreateReceiptItemVm> CreateReceiptItemVm(IList <UserDto> users)
        {
            var itemGroupQuery = new GetItemGroupQuery();

            var itemGroups = await Mediator.Send(itemGroupQuery);

            return(new CreateReceiptItemVm
            {
                AddUserModel = new AddUserModel
                {
                    UserSelectListItems = SelectListHandler.CreateFromUsers(users),
                },
                TypesSelectListItems = SelectListHandler.CreateFromItemGroup(itemGroups),
            });
        }
Exemplo n.º 3
0
        public async Task Handle_Query_ShouldReturnObject()
        {
            var query = new GetItemGroupQuery();

            var enumsInArray = Enum.GetValues(typeof(ItemGroup))
                               .Cast <ItemGroup>()
                               .Select(x => new ItemGroupDto {
                Value = (int)x, Name = x.ToString()
            })
                               .ToList();

            var enumsFromQuery = await SendAsync(query);


            enumsFromQuery.Should().BeEquivalentTo(enumsInArray);
        }