public async Task Given_An_ArchetypeMessage_If_Archetype_Is_Not_Found_Should_Invoke_Add_Method() { // Arrange var archetypeMessage = new ArchetypeMessage(); // Act await _sut.Process(archetypeMessage); // Assert await _archetypeService.Received(1).Add(Arg.Any <Archetype>()); }
public async Task Given_An_Archetype_Article_Should_Execute_ArchetypeByName() { // Arrange var article = new UnexpandedArticle { Title = "Blue-Eyes", Url = "/wiki/Blue-Eyes" }; _config.WikiaDomainUrl.Returns("http://yugioh.wikia.com"); _archetypeWebPage.Cards(Arg.Any <Uri>()).Returns(new List <string> { "Blue-Eyes White Dragon" }); _archetypeService.Add(Arg.Any <AddArchetypeCommand>()).Returns(new Archetype()); // Act await _sut.ProcessItem(article); // Assert await _archetypeService.Received(1).ArchetypeById(Arg.Any <int>()); }
public async Task Given_An_ArchetypeCardMessage_Should_Always_Invoke_ArchetypeByName_Method_Once() { // Arrange var archetypeCardMessage = new ArchetypeCardMessage { ArchetypeName = "Blue-Eyes White Dragon" }; _archetypeService.ArchetypeByName(Arg.Any <string>()).Returns(new Archetype()); // Act await _sut.Process(archetypeCardMessage); // Assert await _archetypeService.Received(1).ArchetypeByName(Arg.Any <string>()); }
public async Task Given_A_CardsByArchetype_Article_Should_Execute_ArchetypeByName() { // Arrange var article = new UnexpandedArticle { Title = "Clear Wing", Url = "/wiki/List_of_\"Clear_Wing\"_cards" }; _config.WikiaDomainUrl.Returns("http://yugioh.wikia.com"); _archetypeService.ArchetypeByName(Arg.Any <string>()).Returns((Archetype)null); _archetypeService.Add(Arg.Any <AddArchetypeCommand>()).Returns((Archetype)null); // Act await _sut.ProcessItem(article); // Assert await _archetypeService.Received(1).ArchetypeByName(Arg.Any <string>()); }
public async Task Given_A_PageSize_Should_Invoke_MostRecentArchetypes_Once() { // Arrange var query = new MostRecentArchetypesQuery(); _archetypeService.MostRecentArchetypes(Arg.Any <int>()).Returns(new MostRecentArchetypesResult { Archetypes = new List <ArchetypeSearch> { new ArchetypeSearch() } }); // Act await _sut.Handle(query, CancellationToken.None); // Assert await _archetypeService.Received(1).MostRecentArchetypes(Arg.Any <int>()); }