public async Task FindEntityAsync_EntityFoundInDataStore_ReturnsEntity()
        {
            // Arrange
            var repository = new SeasonRepository();

            var dbContext = A.Fake <ProFootballEntities>();
            var id        = 2017;

            Season season = new Season();

            A.CallTo(() => dbContext.Seasons.FindAsync(A <int> .Ignored)).Returns(season);

            // Act
            var result = await repository.FindEntityAsync(dbContext, id);

            // Assert
            A.CallTo(() => dbContext.Seasons.FindAsync(id)).MustHaveHappenedOnceExactly();
            Assert.AreSame(season, result);
        }
        public void FindEntityAsync_InvalidOperationExceptionCaught_ThrowsObjectNotFoundException()
        {
            // Arrange
            var repository = new SeasonRepository();

            var dbContext = A.Fake <ProFootballEntities>();
            var id        = 2017;

            A.CallTo(() => dbContext.Seasons.FindAsync(A <int> .Ignored)).Throws <InvalidOperationException>();

            // Act
            Season result = null;

            Assert.ThrowsAsync <ObjectNotFoundException>(async() =>
            {
                result = await repository.FindEntityAsync(dbContext, id);
            });

            // Assert
            Assert.IsNull(result);
        }
        public void FindEntityAsync_EntityNotFoundInDataStore_ThrowsObjectNotFoundException()
        {
            // Arrange
            var repository = new SeasonRepository();

            var dbContext = A.Fake <ProFootballEntities>();
            var id        = 2017;

            Season season = null;

            A.CallTo(() => dbContext.Seasons.FindAsync(A <int> .Ignored)).Returns(season);

            // Act
            Season result = null;

            Assert.ThrowsAsync <ObjectNotFoundException>(async() =>
            {
                result = await repository.FindEntityAsync(dbContext, id);
            });

            // Assert
            A.CallTo(() => dbContext.Seasons.FindAsync(id)).MustHaveHappenedOnceExactly();
            Assert.IsNull(result);
        }