public async Task Given_CardData_If_Exception_Occurrs_The_Response_Exception_Property_Should_Not_Be_Null() { // Arrange var cardDataConsumer = new CardDataConsumer { Message = "{\"Name\":\"Amazoness Archer\",\"Types\":\"Warrior / Effect\",\"CardType\":\"Monster\",\"Attribute\":\"Earth\",\"Level\":4,\"Rank\":null,\"PendulumScale\":null,\"AtkDef\":\"1400 / 1000\",\"AtkLink\":null,\"CardNumber\":\"91869203\",\"Materials\":null,\"CardEffectTypes\":\"Ignition\",\"Property\":null,\"Description\":\"You can Tribute 2 monsters; inflict 1200 damage to your opponent.\",\"ImageUrl\":\"https://vignette.wikia.nocookie.net/yugioh/images/0/02/AmazonessArcher-LEDU-EN-C-1E.png\",\"LinkArrows\":null,\"MonsterSubCategoriesAndTypes\":[\"Warrior\",\"Effect\"],\"MonsterLinkArrows\":null}" }; _cardService.CardByName(Arg.Any <string>()).Throws(new Exception()); // Act var result = await _sut.Handle(cardDataConsumer, CancellationToken.None); // Assert result.Exception.Should().NotBeNull(); }
public async Task Given_CardData_Should_Execute_CardByName_Method_Once() { // Arrange const int expected = 1; var cardDataConsumer = new CardDataConsumer { Message = "{\"Name\":\"Amazoness Archer\",\"Types\":\"Warrior / Effect\",\"CardType\":\"Monster\",\"Attribute\":\"Earth\",\"Level\":4,\"Rank\":null,\"PendulumScale\":null,\"AtkDef\":\"1400 / 1000\",\"AtkLink\":null,\"CardNumber\":\"91869203\",\"Materials\":null,\"CardEffectTypes\":\"Ignition\",\"Property\":null,\"Description\":\"You can Tribute 2 monsters; inflict 1200 damage to your opponent.\",\"ImageUrl\":\"https://vignette.wikia.nocookie.net/yugioh/images/0/02/AmazonessArcher-LEDU-EN-C-1E.png\",\"LinkArrows\":null,\"MonsterSubCategoriesAndTypes\":[\"Warrior\",\"Effect\"],\"MonsterLinkArrows\":null}" }; _cardCommandMapper.MapToAddCommand(Arg.Any <YugiohCard>()).Returns(new AddCardCommand()); _mediator.Send(Arg.Any <AddCardCommand>()).Returns(new CommandResult { IsSuccessful = true }); // Act var result = await _sut.Handle(cardDataConsumer, CancellationToken.None); // Assert await _cardService.Received(expected).CardByName(Arg.Any <string>()); result.IsSuccessful.Should().BeTrue(); }