title: What unit tests would be better or redudant
body: <p>I started to learn a new topic for me - unit testing. Ffter writing a few tests, I began to wonder what else can be written and whether it will not be redundant. If you write code examples it would be even better for me, thank you.</p>
  <p>For example do i need to write same <code>Assert.ThrowsAsync&lt;NullReferenceException&gt;</code> test for method <code>ChooseFilmToWatchWithChilds</code> or it will be redundant</p>
  <pre><code>/// &lt;summary&gt;
  /// Check if database returns null
  /// &lt;/summary&gt;
  [Fact]
  public void NoFilmsInDatabase_ExceptionReturns()
  {
      Assert.ThrowsAsync&lt;NullReferenceException&gt;(
          async () =&gt; { await _homeFilmHandler.IndicateFavouritesOfOurFilms(); });
  }
  </code></pre>
  <p>Like this</p>
  <pre><code>/// &lt;summary&gt;
  /// Check if database returns null
  /// &lt;/summary&gt;
  [Fact]
  public void NoFilmsInDatabaseChooseFilmToWatchWithChilds_ExceptionReturns()
  { 
      Assert.ThrowsAsync&lt;NullReferenceException&gt;(
          async () =&gt; { await _homeFilmHandler.ChooseFilmToWatchWithChilds(); });
  }
  </code></pre>
  <p><strong>Implementation class</strong></p>
  <pre><code>using VideoArchive.Contracts.Abstractions.Data;
  using VideoArchive.Contracts.Abstractions.FilmServices;
  using VideoArchive.Contracts.Abstractions.Integrations;
  using VideoArchive.Contracts.Models;
  using VideoArchive.Contracts.Models.Home;
  
  namespace VideoArchive.Implementations.FilmServices
  {
  
      public class HomeFilmHandler : IHomeFilmHandler
      {
          #region Constructors and DI
  
          private readonly IFakeDatabaseService _fakeDatabaseService;
          private readonly IFakeInegrationService _fakeInegrationService;
          private readonly IMapper _mapper;
  
          public HomeFilmHandler(
              IFakeDatabaseService fakeDatabaseService,
              IFakeInegrationService fakeInegrationService,
              IMapper mapper)
          {
              _fakeDatabaseService = fakeDatabaseService;
              _fakeInegrationService = fakeInegrationService;
              _mapper = mapper;
          }
  
          #endregion
  
          public async Task&lt;HomeFilm&gt; ChooseFilmToWatchWithChilds()
          {
              var allFilms = await _fakeDatabaseService.GetAllFilms();
  
              var filmToWatch = allFilms
                  .Where(film =&gt; film.IsFavorite)
                  .OrderByDescending(film =&gt; film.TimesWatched);
  
              foreach (var film in filmToWatch)
              {
                  if (_fakeInegrationService.GetAgeRestrictions(_mapper.Map&lt;Film&gt;(film)) &lt;= 6)
                  {
                      return film;
                  }
              }
  
              return await Task.FromResult&lt;HomeFilm&gt;(null);
          }
  
  
          public async Task IndicateFavouritesOfOurFilms()
          {
              var allFilms = await _fakeDatabaseService.GetAllFilms();
  
              if (!allFilms.Any() || allFilms == null)
              {
                  throw new NullReferenceException();
              }
  
              IndicateFilms(allFilms);
          }
  
          private async void IndicateFilms(List&lt;HomeFilm&gt; films)
          {
              foreach (var film in films)
              {
                  if (film.TimesWatched &gt;= 5)
                  {
                      film.IsFavorite = true;
                      await _fakeDatabaseService.UpdateFilm(film, film.Id);
                  }
              }
          }
      }
  } 
  </code></pre>
  <p><strong>TestsClass</strong></p>
  <pre><code>using AutoMapper;
  using VideoArchive.Contracts.Abstractions.Data;
  using VideoArchive.Contracts.Abstractions.Integrations;
  using VideoArchive.Contracts.Models.Home;
  using VideoArchive.Implementations.FilmServices;
  using Moq;
  using Xunit;
  
  namespace VideoArchive.Tests
  {
      public class HomeFilmHandlerTests
      {
          private readonly Fixture _fixture = new Fixture();
          private readonly Mock&lt;IFakeDatabaseService&gt; _fakeDatabaseService = new Mock&lt;IFakeDatabaseService&gt;();
          private readonly Mock&lt;IFakeInegrationService&gt; _fakeIntegrationService = new Mock&lt;IFakeInegrationService&gt;();
          private readonly Mock&lt;IMapper&gt; _mapper = new Mock&lt;IMapper&gt;();
          private readonly List&lt;HomeFilm&gt; _homeFilms;
  
          private readonly HomeFilmHandler _homeFilmHandler;
  
          public HomeFilmHandlerTests()
          {
              _homeFilms = _fixture.CreateMany&lt;HomeFilm&gt;().ToList();
  
              _fakeDatabaseService
                  .Setup(service =&gt; service
                      .GetAllFilms())
                  .ReturnsAsync(_homeFilms);
              _fakeDatabaseService
                  .Setup(service =&gt; service
                      .UpdateFilm(It.IsAny&lt;HomeFilm&gt;(), It.IsAny&lt;int&gt;()));
              _fakeIntegrationService
                  .Setup(service =&gt; service
                      .GetAgeRestrictions(It.IsAny&lt;HomeFilm&gt;()));
  
              _homeFilmHandler = new HomeFilmHandler(
                  _fakeDatabaseService.Object,
                  _fakeIntegrationService.Object,
                  _mapper.Object);
          }
  
          [Fact]
          public void NoFilmsInDatabase_ExceptionReturns()
          {
              Assert.ThrowsAsync&lt;NullReferenceException&gt;(async () =&gt; { await _homeFilmHandler.IndicateFavouritesOfOurFilms(); });
          }
  
          [Fact]
          public async void FilmsAreIndicatedRightTimes_UpdateFilmCalled()
          {
              var filmCountThatNeededToIndicate =
                  _homeFilms.Where(film =&gt; film.TimesWatched &gt;= 5).Count();
  
              await _homeFilmHandler.IndicateFavouritesOfOurFilms();
  
              _fakeDatabaseService.Verify(
                  service =&gt; service.UpdateFilm(It.IsAny&lt;HomeFilm&gt;(), It.IsAny&lt;int&gt;()),
                  Times.Exactly(filmCountThatNeededToIndicate));
          }
  
          [Fact]
          public void FilmWithChild()
          {
              //Write test here
          }
      }
  } 
  </code></pre>
  <p><strong>FakeDatabaseService</strong></p>
  <pre><code>using AutoFixture;
  using VideoArchive.Contracts.Abstractions.Data;
  using VideoArchive.Contracts.Models.Home;
  
  namespace VideoArchive.Implementations.Data.Fake
  {
      /// &lt;summary&gt;
      /// Fake service imitating databaseService
      /// &lt;/summary&gt;
      public class FakeDatabaseService : IFakeDatabaseService
      {
          private readonly Fixture Fixture = new Fixture();
  
          public async Task&lt;List&lt;HomeFilm&gt;&gt; GetAllFilms()
          {
              return Fixture.CreateMany&lt;HomeFilm&gt;().ToList();
          }
  
          public async Task&lt;HomeFilm&gt; GetFilmById(int id)
          {
              return Fixture.Build&lt;HomeFilm&gt;().With(film =&gt; film.Id, id).Create();
          }
  
          public async Task UpdateFilm(HomeFilm film, int id)
          {
              // Logic to updating film
          }
      }
  }
  </code></pre>
  <p><strong>FakeInegrationService</strong></p>
  <pre><code>namespace VideoArchive.Contracts.Abstractions.Integrations
  {
  
      public interface IFakeIntegrationService
      {
          public int GetAgeRestrictions(IFilm film);
      }
  }
  </code></pre>