Пример #1
0
        public async Task Given_An_AllFormats_Query_Should_Return_All_Formats()
        {
            // Arrange
            const int expected = 2;

            _formatService.AllFormats().Returns(new List <Format>
            {
                new Format
                {
                    Id      = 2342,
                    Name    = "Test Format",
                    Acronym = "TF",
                    Banlist = new List <Banlist>
                    {
                        new Banlist
                        {
                            Id          = 8987,
                            FormatId    = 709808,
                            BanlistCard = new List <BanlistCard> {
                                new BanlistCard
                                {
                                    BanlistId = 234223,
                                    CardId    = 2394,
                                    Limit     = new Limit
                                    {
                                        Name = "Unlimited"
                                    }
                                }
                            }
                        }
                    }
                },
                new Format
                {
                    Id      = 23424,
                    Name    = "Test Format 2",
                    Acronym = "TF",
                    Banlist = new List <Banlist>
                    {
                        new Banlist
                        {
                            Id          = 8987,
                            FormatId    = 709808,
                            BanlistCard = new List <BanlistCard> {
                                new BanlistCard
                                {
                                    BanlistId = 234223,
                                    CardId    = 2394,
                                    Limit     = new Limit
                                    {
                                        Name = "Unlimited"
                                    }
                                }
                            }
                        }
                    }
                }
            });

            // Act
            var result = await _sut.Handle(new AllFormatsQuery(), CancellationToken.None);

            // Assert
            result.Should().HaveCount(expected);
        }
Пример #2
0
        public async Task <IEnumerable <FormatOutputModel> > Handle(AllFormatsQuery request, CancellationToken cancellationToken)
        {
            var formats = await _formatService.AllFormats();

            return(formats.MapToOutputModels());
        }