public async Task AddAsync_GivenDuplicatedKeySeason_ShouldThrowException() { // Given var dbContext = InMemoryDbProvider.GetDbContext(); var repository = new SeasonRepository(dbContext); await repository.AddAsync(new SeasonBuilder().WithId(1).Build()); // When Func <Task> func = repository.Awaiting(x => x.AddAsync(new SeasonBuilder().WithId(1).Build())); // Then func.Should().Throw <Exception>(); }