December 2019
Intermediate to advanced
510 pages
11h 33m
English
As mentioned, the FluentValidation package provides an excellent way to test our validation criteria.
The AddItemRequestValidator and EditItemRequestValidator classes implement elementary checks. Furthermore, it may be useful to cover them with some tests to document the logic implemented in these classes. FluentValidation provides a TestHelper class that provides the assertion conditions necessary to verify the behavior of our validation logic.
Let's see how to do some unit tests for the AddItemRequestValidator class:
using Catalog.Domain.Entities;using Catalog.Domain.Requests.Item;using Catalog.Domain.Requests.Item.Validators;using FluentValidation.TestHelper;using Xunit;namespace Catalog.Domain.Tests.
Read now
Unlock full access