Ejemplo n.º 1
0
        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);
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
 }