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); }
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); }
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); }
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); }