Exemple #1
0
        public void Verify_Get_ByKey_Should_ReturnTheCorrectStudio()
        {
            // Arrange
            Mock <IDbSet <Studio> > mockSetStudios;
            var mockContext = StudiosMockingSetup.DoMockingSetupForContext(true, out mockSetStudios);
            var repository  = new StudiosRepository(mockContext.Object);
            // Act
            var studios = repository.Get("KING-STEPHEN");

            // Assert
            Assert.Equal("/TEST/KING-STEPHEN", studios.ApiDetailUrl);
        }
 public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
 {
     // Arrange
     Mock<IDbSet<Studio>> mockSetStudios;
     var mockContext = StudiosMockingSetup.DoMockingSetupForContext(true, out mockSetStudios);
     var repository = new StudiosRepository(mockContext.Object);
     var studios = repository.Get(1);
     // Act
     repository.Deactivate(studios);
     // Assert
     Assert.Equal(false, studios.Active);
 }
Exemple #3
0
        public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
        {
            // Arrange
            Mock <IDbSet <Studio> > mockSetStudios;
            var mockContext = StudiosMockingSetup.DoMockingSetupForContext(true, out mockSetStudios);
            var repository  = new StudiosRepository(mockContext.Object);
            var studios     = repository.Get(1);

            // Act
            repository.Deactivate(studios);
            // Assert
            Assert.Equal(false, studios.Active);
        }
Exemple #4
0
        public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
        {
            // Arrange
            Mock <IDbSet <Studio> > mockSetStudios;
            var mockContext = StudiosMockingSetup.DoMockingSetupForContext(true, out mockSetStudios);
            var repository  = new StudiosRepository(mockContext.Object);
            var studios     = repository.Get(1);

            // Act
            repository.Remove(studios);
            // Assert
            mockSetStudios.Verify(x => x.Remove((Studio)studios), Times.Once);
        }
Exemple #5
0
        public void Verify_Update_Should_SetTheEntityStateToModified()
        {
            // Arrange
            Mock <IDbSet <Studio> > mockSetStudios;
            var mockContext = StudiosMockingSetup.DoMockingSetupForContext(true, out mockSetStudios);
            var repository  = new StudiosRepository(mockContext.Object);
            var studios     = repository.Get(1);

            studios.ApiDetailUrl = "/TEST";
            // Act
            repository.Update(studios);
            // Assert
            mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once);
        }
 public void Verify_Get_ByID_Should_ReturnTheCorrectStudio()
 {
     // Arrange
     Mock<IDbSet<Studio>> mockSetStudios;
     var mockContext = StudiosMockingSetup.DoMockingSetupForContext(true, out mockSetStudios);
     var repository = new StudiosRepository(mockContext.Object);
     // Act
     var studios = repository.Get(1);
     // Assert
                 Assert.Equal("/TEST/KING-STEPHEN", studios.ApiDetailUrl);
 }
 public void Verify_Update_Should_SetTheEntityStateToModified()
 {
     // Arrange
     Mock<IDbSet<Studio>> mockSetStudios;
     var mockContext = StudiosMockingSetup.DoMockingSetupForContext(true, out mockSetStudios);
     var repository = new StudiosRepository(mockContext.Object);
     var studios = repository.Get(1);
     studios.ApiDetailUrl = "/TEST";
     // Act
     repository.Update(studios);
     // Assert
     mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once);
 }
 public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
 {
     // Arrange
     Mock<IDbSet<Studio>> mockSetStudios;
     var mockContext = StudiosMockingSetup.DoMockingSetupForContext(true, out mockSetStudios);
     var repository = new StudiosRepository(mockContext.Object);
     var studios = repository.Get(1);
     // Act
     repository.Remove(studios);
     // Assert
     mockSetStudios.Verify(x => x.Remove((Studio)studios), Times.Once);
 }