public async Task Handle_NonGenericResultBehavior_NoValidationErrors_Should_Return_Success() { // Arrange var validatorsWithoutErrors = _nonGenericResultBehavior .GetValidatorsWithNoErrorResults(); _nonGenericResultBehavior.AddValidators(validatorsWithoutErrors); var successHandler = _nonGenericResultBehavior.HandlerDelegate(new Success()); // Act var result = await _nonGenericResultBehavior .Behavior .Handle(new FakeQuery(), CancellationToken.None, successHandler); // Assert result.Should().Be(Success.Empty); }
public async Task Handle_GenericResultBehavior_NoValidationErrors_Should_Return_Success() { // Arrange var validatorsWithoutErrors = _genericResultBehavior .GetValidatorsWithNoErrorResults(); _genericResultBehavior.AddValidators(validatorsWithoutErrors); var fakeData = _genericResultBehavior.FakeData; var successHandler = _genericResultBehavior.HandlerDelegate(new Success <FakeData>(fakeData)); // Act var result = await _genericResultBehavior .Behavior .Handle(new FakeGenericQuery(), CancellationToken.None, successHandler); // Assert result .Should().BeOfType <Success <FakeData> >() .Subject.Data .Should().Be(fakeData); }