public void Verify_Get_ByKey_Should_ReturnTheCorrectPower() { // Arrange Mock <IDbSet <Power> > mockSetPowers; var mockContext = PowersMockingSetup.DoMockingSetupForContext(true, out mockSetPowers); var repository = new PowersRepository(mockContext.Object); // Act var powers = repository.Get("KING-STEPHEN"); // Assert Assert.Equal("/TEST/KING-STEPHEN", powers.ApiDetailUrl); }
public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity() { // Arrange Mock<IDbSet<Power>> mockSetPowers; var mockContext = PowersMockingSetup.DoMockingSetupForContext(true, out mockSetPowers); var repository = new PowersRepository(mockContext.Object); var powers = repository.Get(1); // Act repository.Deactivate(powers); // Assert Assert.Equal(false, powers.Active); }
public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity() { // Arrange Mock <IDbSet <Power> > mockSetPowers; var mockContext = PowersMockingSetup.DoMockingSetupForContext(true, out mockSetPowers); var repository = new PowersRepository(mockContext.Object); var powers = repository.Get(1); // Act repository.Deactivate(powers); // Assert Assert.Equal(false, powers.Active); }
public void Verify_Remove_Should_RemoveTheEntityFromTheContext() { // Arrange Mock <IDbSet <Power> > mockSetPowers; var mockContext = PowersMockingSetup.DoMockingSetupForContext(true, out mockSetPowers); var repository = new PowersRepository(mockContext.Object); var powers = repository.Get(1); // Act repository.Remove(powers); // Assert mockSetPowers.Verify(x => x.Remove((Power)powers), Times.Once); }
public void Verify_Update_Should_SetTheEntityStateToModified() { // Arrange Mock <IDbSet <Power> > mockSetPowers; var mockContext = PowersMockingSetup.DoMockingSetupForContext(true, out mockSetPowers); var repository = new PowersRepository(mockContext.Object); var powers = repository.Get(1); powers.ApiDetailUrl = "/TEST"; // Act repository.Update(powers); // Assert mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once); }
public void Verify_Get_ByID_Should_ReturnTheCorrectPower() { // Arrange Mock<IDbSet<Power>> mockSetPowers; var mockContext = PowersMockingSetup.DoMockingSetupForContext(true, out mockSetPowers); var repository = new PowersRepository(mockContext.Object); // Act var powers = repository.Get(1); // Assert Assert.Equal("/TEST/KING-STEPHEN", powers.ApiDetailUrl); }
public void Verify_Update_Should_SetTheEntityStateToModified() { // Arrange Mock<IDbSet<Power>> mockSetPowers; var mockContext = PowersMockingSetup.DoMockingSetupForContext(true, out mockSetPowers); var repository = new PowersRepository(mockContext.Object); var powers = repository.Get(1); powers.ApiDetailUrl = "/TEST"; // Act repository.Update(powers); // Assert mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once); }
public void Verify_Remove_Should_RemoveTheEntityFromTheContext() { // Arrange Mock<IDbSet<Power>> mockSetPowers; var mockContext = PowersMockingSetup.DoMockingSetupForContext(true, out mockSetPowers); var repository = new PowersRepository(mockContext.Object); var powers = repository.Get(1); // Act repository.Remove(powers); // Assert mockSetPowers.Verify(x => x.Remove((Power)powers), Times.Once); }