public async Task Given_A_UserId_If_User_is_Not_Found_DeckSearch_Should_Be_Empty() { // Arrange var query = new DecksByUserIdQuery { UserId = Guid.NewGuid().ToString() }; _deckService.Search(Arg.Any <DeckSearchByUserIdCriteria>()).Returns(new DeckSearchResult { Decks = new List <DeckDetail>() }); // Act var result = await _sut.Handle(query, CancellationToken.None); // Assert result.Decks.Should().BeNull(); }
public async Task Given_A_UserId_If_User_is_Found_And_Has_Decks_Should_Invoke_Search_Once() { // Arrange var query = new DecksByUserIdQuery { UserId = Guid.NewGuid().ToString() }; _deckService.Search(Arg.Any <DeckSearchByUserIdCriteria>()).Returns(new DeckSearchResult { Decks = new List <DeckDetail> { new DeckDetail { Id = 234242, Name = "Fire Fist" } } }); // Act await _sut.Handle(query, CancellationToken.None); // Assert await _deckService.Received(1).Search(Arg.Any <DeckSearchByUserIdCriteria>()); }
public async Task Given_A_UserId_If_User_is_Found_And_Has_Decks_DeckSearch_Should_Not_Empty() { // Arrange var query = new DecksByUserIdQuery { UserId = Guid.NewGuid().ToString() }; _deckService.Search(Arg.Any <DeckSearchByUserIdCriteria>()).Returns(new DeckSearchResult { Decks = new List <DeckDetail> { new DeckDetail { Id = 234242, Name = "Fire Fist" } } }); // Act var result = await _sut.Handle(query, CancellationToken.None); // Assert result.Decks.Should().NotBeEmpty().And.HaveCount(1); }