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

            var season = new Season();

            A.CallTo(() => dbContext.SetModified(A <Season> .Ignored)).Throws <Exception>();

            // Act & Assert
            Assert.Throws <Exception>(() => repository.EditEntity(season));
        }
Esempio n. 2
0
        public void EditSeason_HappyPath()
        {
            // Arrange
            var dbContext  = A.Fake <ProFootballEntities>();
            var repository = new SeasonRepository(dbContext);

            var season = new Season();

            // Act
            repository.EditEntity(season);

            // Assert
            A.CallTo(() => dbContext.SetModified(season)).MustHaveHappenedOnceExactly();
        }
        public void EditSeason()
        {
            // Arrange
            var repository = new SeasonRepository();

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

            A.CallTo(() => dbContext.SetModified(A <Season> .Ignored)).DoesNothing();

            var season = new Season
            {
                ID = 2017
            };

            // Act
            repository.EditEntity(dbContext, season);

            // Assert
            A.CallTo(() => dbContext.SetModified(season)).MustHaveHappenedOnceExactly();
        }