public async Task Given_An_Invalid_BanlistInformationTask_Should_Return_Errors() { // Arrange var task = new BanlistInformationTask(); // Act var result = await _sut.Handle(task, CancellationToken.None); // Assert result.Errors.Should().NotBeEmpty(); }
public void Given_An_Invalid_BanlistInformationTask_PageSize_Validation_Should_Fail(int pageSize) { // Arrange var inputModel = new BanlistInformationTask { PageSize = pageSize }; // Act Action act = () => _sut.ShouldHaveValidationErrorFor(ci => ci.PageSize, inputModel); // Assert act.Invoke(); }
public void Given_An_Invalid_BanlistInformationTask_Category_Validation_Should_Fail(string category) { // Arrange var inputModel = new BanlistInformationTask { Category = category }; // Act Action act = () => _sut.ShouldHaveValidationErrorFor(ci => ci.Category, inputModel); // Assert act.Invoke(); }
public async Task Given_An_Invalid_BanlistInformationTask_Should_Not_Execute_BanlistTask() { // Arrange var task = new BanlistInformationTask(); _articleCategoryProcessor.Process(Arg.Any <string>(), Arg.Any <int>()).Returns(new ArticleBatchTaskResult()); // Act await _sut.Handle(task, CancellationToken.None); // Assert await _articleCategoryProcessor.DidNotReceive().Process(Arg.Any <string>(), Arg.Any <int>()); }
public async Task Given_A_BanlistInformationTask_If_Validation_Is_Succesful_Should_Be_true() { // Arrange var banlistInformationTask = new BanlistInformationTask { Category = "banlist", PageSize = 8 }; _validator.Validate(Arg.Any <BanlistInformationTask>()).Returns(new BanlistInformationTaskValidator().Validate(banlistInformationTask)); // Act var result = await _sut.Handle(banlistInformationTask, CancellationToken.None); // Assert result.IsSuccessful.Should().BeTrue(); }
public async Task Given_A_BanlistInformationTask_If_Validation_Is_Succesful_Should_Invoke_BanlistProcessor_Process_Method_Twice() { // Arrange const int expected = 2; var banlistInformationTask = new BanlistInformationTask { Category = "banlist", PageSize = 8 }; _validator.Validate(Arg.Any <BanlistInformationTask>()).Returns(new BanlistInformationTaskValidator().Validate(banlistInformationTask)); // Act await _sut.Handle(banlistInformationTask, CancellationToken.None); // Assert await _banlistProcessor.Received(expected).Process(Arg.Any <BanlistType>()); }