Ejemplo n.º 1
0
        public void Verify_Get_ByKey_Should_ReturnTheCorrectCharacterEnemy()
        {
            // Arrange
            Mock <IDbSet <CharacterEnemy> > mockSetCharacterEnemies;
            var mockContext = CharacterEnemiesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterEnemies);
            var repository  = new CharacterEnemiesRepository(mockContext.Object);
            // Act
            var characterEnemies = repository.Get("KING-STEPHEN");

            // Assert
            Assert.Equal("/TEST/KING-STEPHEN", characterEnemies.ApiDetailUrl);
        }
 public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
 {
     // Arrange
     Mock<IDbSet<CharacterEnemy>> mockSetCharacterEnemies;
     var mockContext = CharacterEnemiesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterEnemies);
     var repository = new CharacterEnemiesRepository(mockContext.Object);
     var characterEnemies = repository.Get(1);
     // Act
     repository.Deactivate(characterEnemies);
     // Assert
     Assert.Equal(false, characterEnemies.Active);
 }
Ejemplo n.º 3
0
        public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
        {
            // Arrange
            Mock <IDbSet <CharacterEnemy> > mockSetCharacterEnemies;
            var mockContext      = CharacterEnemiesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterEnemies);
            var repository       = new CharacterEnemiesRepository(mockContext.Object);
            var characterEnemies = repository.Get(1);

            // Act
            repository.Deactivate(characterEnemies);
            // Assert
            Assert.Equal(false, characterEnemies.Active);
        }
Ejemplo n.º 4
0
        public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
        {
            // Arrange
            Mock <IDbSet <CharacterEnemy> > mockSetCharacterEnemies;
            var mockContext      = CharacterEnemiesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterEnemies);
            var repository       = new CharacterEnemiesRepository(mockContext.Object);
            var characterEnemies = repository.Get(1);

            // Act
            repository.Remove(characterEnemies);
            // Assert
            mockSetCharacterEnemies.Verify(x => x.Remove((CharacterEnemy)characterEnemies), Times.Once);
        }
Ejemplo n.º 5
0
        public void Verify_Update_Should_SetTheEntityStateToModified()
        {
            // Arrange
            Mock <IDbSet <CharacterEnemy> > mockSetCharacterEnemies;
            var mockContext      = CharacterEnemiesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterEnemies);
            var repository       = new CharacterEnemiesRepository(mockContext.Object);
            var characterEnemies = repository.Get(1);

            characterEnemies.ApiDetailUrl = "/TEST";
            // Act
            repository.Update(characterEnemies);
            // Assert
            mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once);
        }
 public void Verify_Get_ByID_Should_ReturnTheCorrectCharacterEnemy()
 {
     // Arrange
     Mock<IDbSet<CharacterEnemy>> mockSetCharacterEnemies;
     var mockContext = CharacterEnemiesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterEnemies);
     var repository = new CharacterEnemiesRepository(mockContext.Object);
     // Act
     var characterEnemies = repository.Get(1);
     // Assert
                 Assert.Equal("/TEST/KING-STEPHEN", characterEnemies.ApiDetailUrl);
 }
 public void Verify_Update_Should_SetTheEntityStateToModified()
 {
     // Arrange
     Mock<IDbSet<CharacterEnemy>> mockSetCharacterEnemies;
     var mockContext = CharacterEnemiesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterEnemies);
     var repository = new CharacterEnemiesRepository(mockContext.Object);
     var characterEnemies = repository.Get(1);
     characterEnemies.ApiDetailUrl = "/TEST";
     // Act
     repository.Update(characterEnemies);
     // Assert
     mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once);
 }
 public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
 {
     // Arrange
     Mock<IDbSet<CharacterEnemy>> mockSetCharacterEnemies;
     var mockContext = CharacterEnemiesMockingSetup.DoMockingSetupForContext(true, out mockSetCharacterEnemies);
     var repository = new CharacterEnemiesRepository(mockContext.Object);
     var characterEnemies = repository.Get(1);
     // Act
     repository.Remove(characterEnemies);
     // Assert
     mockSetCharacterEnemies.Verify(x => x.Remove((CharacterEnemy)characterEnemies), Times.Once);
 }