December 2019
Intermediate to advanced
510 pages
11h 33m
English
As we did with the ItemRepositoryTests class, we can proceed by testing ArtistRepository and GenreRepository using the same approach. In Chapter 8, Building the Data Access Layer, we defined TestDataContextFactory, which is part of the Catalog.Fixtures project. We can use this to instantiate an in-memory database for our test purposes:
using System;using System.Linq;using System.Threading.Tasks;using Catalog.Domain.Entities;using Catalog.Fixtures;using Catalog.Infrastructure.Repositories;using Shouldly;using Xunit;namespace Catalog.Infrastructure.Tests{ public class ArtistRepositoryTests : IClassFixture<CatalogContextFactory> { private readonly CatalogContextFactory _factory; public ArtistRepositoryTests(CatalogContextFactory ...
Read now
Unlock full access