Exemplo n.º 1
0
        public void EditWeekCount_ExceptionCaught_LogsAndRethrowsException()
        {
            // Arrange
            var dbContext  = A.Fake <ProFootballEntities>();
            var repository = new WeekCountRepository(dbContext);

            var weekCount = new WeekCount();

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

            // Act & Assert
            Assert.Throws <Exception>(() => repository.EditEntity(weekCount));
        }
Exemplo n.º 2
0
        public void EditWeekCount_HappyPath()
        {
            // Arrange
            var dbContext  = A.Fake <ProFootballEntities>();
            var repository = new WeekCountRepository(dbContext);

            var weekCount = new WeekCount();

            // Act
            repository.EditEntity(weekCount);

            // Assert
            A.CallTo(() => dbContext.SetModified(weekCount)).MustHaveHappenedOnceExactly();
        }
Exemplo n.º 3
0
        public void EditWeekCount()
        {
            // Arrange
            var repository = new WeekCountRepository();

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

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

            var weekCount = new WeekCount
            {
                SeasonID = 2018
            };

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

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