December 2019
Intermediate to advanced
510 pages
11h 33m
English
Let's proceed by creating a new testing class in our Catalog.Infrastructure.Tests project called ItemRepositoryTests:
using Xunit;namespace Catalog.Infrastructure.Tests{ public class ItemRepositoryTests { [Fact] public void should_get_data() { Assert.True(true); } }}
The Xunit framework identifies test classes using the Fact attribute. Every class that contains a method that has the Fact attribute or, as we'll see later in this section, the Theory attribute, will be considered as a test by the unit test runner.
Let's continue by adding our first test method. This checks the GetAsync method of the ItemRepository class:
using System.Threading.Tasks;using Microsoft.EntityFrameworkCore;using Shouldly;using Catalog ...