Ejemplo n.º 1
0
        public async Task ShouldReturnMatchListItems()
        {
            //Arrange
            IMatchListItemsService matchListItemService = new MatchListItemsService();

            MatchListItem matchListItem = new MatchListItem
            {
                Id       = Guid.NewGuid().ToString(),
                Url      = Guid.NewGuid().ToString(),
                Name     = "Game",
                Password = "******",
            };

            matchListItemService.AddMatchListItem(matchListItem);

            var handler = new GetAllMatchListItemsQueryHandler(matchListItemService);

            //Act
            List <MatchListItem> matchListItems = await handler.Handle(new GetAllMatchListItemsQuery(), CancellationToken.None);

            //Assert
            matchListItems.Should().NotBeNull();
            matchListItems.Should().HaveCount(1);
            matchListItems.First().Should().Be(matchListItem);
        }
        public async Task ShouldReturnEmptyWhenListIsEmpty()
        {
            //Arrange
            var handler = new GetAllMatchListItemsQueryHandler(new MatchListItemsService());

            //Act
            List <MatchListItem> result = await handler.Handle(new GetAllMatchListItemsQuery(), CancellationToken.None);

            //Assert
            result.Should().BeEmpty();
        }