public void Verify_Get_ByKey_Should_ReturnTheCorrectPromo() { // Arrange Mock <IDbSet <Promo> > mockSetPromos; var mockContext = PromosMockingSetup.DoMockingSetupForContext(true, out mockSetPromos); var repository = new PromosRepository(mockContext.Object); // Act var promos = repository.Get("KING-STEPHEN"); // Assert Assert.Equal("/TEST/KING-STEPHEN", promos.ApiDetailUrl); }
public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity() { // Arrange Mock<IDbSet<Promo>> mockSetPromos; var mockContext = PromosMockingSetup.DoMockingSetupForContext(true, out mockSetPromos); var repository = new PromosRepository(mockContext.Object); var promos = repository.Get(1); // Act repository.Deactivate(promos); // Assert Assert.Equal(false, promos.Active); }
public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity() { // Arrange Mock <IDbSet <Promo> > mockSetPromos; var mockContext = PromosMockingSetup.DoMockingSetupForContext(true, out mockSetPromos); var repository = new PromosRepository(mockContext.Object); var promos = repository.Get(1); // Act repository.Deactivate(promos); // Assert Assert.Equal(false, promos.Active); }
public void Verify_Remove_Should_RemoveTheEntityFromTheContext() { // Arrange Mock <IDbSet <Promo> > mockSetPromos; var mockContext = PromosMockingSetup.DoMockingSetupForContext(true, out mockSetPromos); var repository = new PromosRepository(mockContext.Object); var promos = repository.Get(1); // Act repository.Remove(promos); // Assert mockSetPromos.Verify(x => x.Remove((Promo)promos), Times.Once); }
public void Verify_Update_Should_SetTheEntityStateToModified() { // Arrange Mock <IDbSet <Promo> > mockSetPromos; var mockContext = PromosMockingSetup.DoMockingSetupForContext(true, out mockSetPromos); var repository = new PromosRepository(mockContext.Object); var promos = repository.Get(1); promos.ApiDetailUrl = "/TEST"; // Act repository.Update(promos); // Assert mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once); }
public void Verify_Get_ByID_Should_ReturnTheCorrectPromo() { // Arrange Mock<IDbSet<Promo>> mockSetPromos; var mockContext = PromosMockingSetup.DoMockingSetupForContext(true, out mockSetPromos); var repository = new PromosRepository(mockContext.Object); // Act var promos = repository.Get(1); // Assert Assert.Equal("/TEST/KING-STEPHEN", promos.ApiDetailUrl); }
public void Verify_Update_Should_SetTheEntityStateToModified() { // Arrange Mock<IDbSet<Promo>> mockSetPromos; var mockContext = PromosMockingSetup.DoMockingSetupForContext(true, out mockSetPromos); var repository = new PromosRepository(mockContext.Object); var promos = repository.Get(1); promos.ApiDetailUrl = "/TEST"; // Act repository.Update(promos); // Assert mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once); }
public void Verify_Remove_Should_RemoveTheEntityFromTheContext() { // Arrange Mock<IDbSet<Promo>> mockSetPromos; var mockContext = PromosMockingSetup.DoMockingSetupForContext(true, out mockSetPromos); var repository = new PromosRepository(mockContext.Object); var promos = repository.Get(1); // Act repository.Remove(promos); // Assert mockSetPromos.Verify(x => x.Remove((Promo)promos), Times.Once); }