public async Task Given_An_Invalid_ArchetypeCardInformationConsumer_Errors_List_Should_Not_Be_Null_Or_Empty() { // Arrange var archetypeCardInformationConsumer = new ArchetypeCardInformationConsumer(); _validator.Validate(Arg.Any <ArchetypeCardInformationConsumer>()) .Returns(new ArchetypeCardInformationConsumerValidator().Validate(archetypeCardInformationConsumer)); // Act var result = await _sut.Handle(archetypeCardInformationConsumer, CancellationToken.None); // Assert result.Errors.Should().NotBeNullOrEmpty(); }
public async Task Given_An_Invalid_ArchetypeCardInformationConsumer_IsSuccessful_Should_Be_False() { // Arrange var archetypeCardInformationConsumer = new ArchetypeCardInformationConsumer(); _validator.Validate(Arg.Any <ArchetypeCardInformationConsumer>()) .Returns(new ArchetypeCardInformationConsumerValidator().Validate(archetypeCardInformationConsumer)); // Act var result = await _sut.Handle(archetypeCardInformationConsumer, CancellationToken.None); // Assert result.IsSuccessful.Should().BeFalse(); }
public async Task Given_A_Valid_ArchetypeCardInformationConsumer_Should_Execute_Process_Method_Once() { // Arrange var archetypeCardInformationConsumer = new ArchetypeCardInformationConsumer { Message = "{\"Id\":703544,\"CorrelationId\":\"3e2bf3ca-d903-440c-8cd5-be61c95ae1fc\",\"Title\":\"Tenyi\",\"Url\":\"https://yugioh.fandom.com/wiki/Tenyi\"}" }; _validator.Validate(Arg.Any <ArchetypeCardInformationConsumer>()) .Returns(new ArchetypeCardInformationConsumerValidator().Validate(archetypeCardInformationConsumer)); _archetypeCardProcessor.Process(Arg.Any <ArchetypeCardMessage>()).Returns(new ArchetypeDataTaskResult <ArchetypeCardMessage>()); // Act await _sut.Handle(archetypeCardInformationConsumer, CancellationToken.None); // Assert await _archetypeCardProcessor.Received(1).Process(Arg.Any <ArchetypeCardMessage>()); }
public async Task Given_A_Valid_ArchetypeCardInformationConsumer_IsSuccessful_Should_Be_True() { // Arrange var archetypeCardInformationConsumer = new ArchetypeCardInformationConsumer { Message = "{\"Id\":703544,\"CorrelationId\":\"3e2bf3ca-d903-440c-8cd5-be61c95ae1fc\",\"Title\":\"Tenyi\",\"Url\":\"https://yugioh.fandom.com/wiki/Tenyi\"}" }; _validator.Validate(Arg.Any <ArchetypeCardInformationConsumer>()) .Returns(new ArchetypeCardInformationConsumerValidator().Validate(archetypeCardInformationConsumer)); _archetypeCardProcessor.Process(Arg.Any <Article>()).Returns(new ArticleTaskResult()); // Act var result = await _sut.Handle(archetypeCardInformationConsumer, CancellationToken.None); // Assert result.IsSuccessful.Should().BeTrue(); }
public async Task Given_A_Valid_ArchetypeCardInformationConsumer_If_Not_Processed_Successfully_Errors_Should_Not_Be_Null_Or_Empty() { // Arrange var archetypeCardInformationConsumer = new ArchetypeCardInformationConsumer { Message = "{\"Id\":703544,\"CorrelationId\":\"3e2bf3ca-d903-440c-8cd5-be61c95ae1fc\",\"Title\":\"Tenyi\",\"Url\":\"https://yugioh.fandom.com/wiki/Tenyi\"}" }; _validator.Validate(Arg.Any <ArchetypeCardInformationConsumer>()) .Returns(new ArchetypeCardInformationConsumerValidator().Validate(archetypeCardInformationConsumer)); _archetypeCardProcessor.Process(Arg.Any <ArchetypeCardMessage>()).Returns(new ArchetypeDataTaskResult <ArchetypeCardMessage> { Errors = new List <string> { "Something went horribly wrong" } }); // Act var result = await _sut.Handle(archetypeCardInformationConsumer, CancellationToken.None); // Assert result.Errors.Should().NotBeNullOrEmpty(); }