Esempio n. 1
0
        public void GetSeasons_HappyPath()
        {
            // Arrange
            var dbContext  = A.Fake <ProFootballEntities>();
            var repository = new SeasonRepository(dbContext);

            // Act
            var result = repository.GetEntities();

            // Assert
            Assert.IsInstanceOf <IEnumerable <Season> >(result);
        }
Esempio n. 2
0
        public void GetSeasons_ExceptionCaught_LogsAndRethrowsException()
        {
            // Arrange
            var dbContext  = A.Fake <ProFootballEntities>();
            var repository = new SeasonRepository(dbContext);

            A.CallTo(() => dbContext.Seasons).Throws <Exception>();

            // Act
            IEnumerable <Season> result = null;

            Assert.Throws <Exception>(() => result = repository.GetEntities());

            // Assert
            Assert.IsNull(result);
        }