Esempio n. 1
0
        public void Verify_Get_ByKey_Should_ReturnTheCorrectPowerAlias()
        {
            // Arrange
            Mock <IDbSet <PowerAlias> > mockSetPowerAliases;
            var mockContext = PowerAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetPowerAliases);
            var repository  = new PowerAliasesRepository(mockContext.Object);
            // Act
            var powerAliases = repository.Get("KING-STEPHEN");

            // Assert
            Assert.Equal("/TEST/KING-STEPHEN", powerAliases.ApiDetailUrl);
        }
 public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
 {
     // Arrange
     Mock<IDbSet<PowerAlias>> mockSetPowerAliases;
     var mockContext = PowerAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetPowerAliases);
     var repository = new PowerAliasesRepository(mockContext.Object);
     var powerAliases = repository.Get(1);
     // Act
     repository.Deactivate(powerAliases);
     // Assert
     Assert.Equal(false, powerAliases.Active);
 }
Esempio n. 3
0
        public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
        {
            // Arrange
            Mock <IDbSet <PowerAlias> > mockSetPowerAliases;
            var mockContext  = PowerAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetPowerAliases);
            var repository   = new PowerAliasesRepository(mockContext.Object);
            var powerAliases = repository.Get(1);

            // Act
            repository.Deactivate(powerAliases);
            // Assert
            Assert.Equal(false, powerAliases.Active);
        }
Esempio n. 4
0
        public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
        {
            // Arrange
            Mock <IDbSet <PowerAlias> > mockSetPowerAliases;
            var mockContext  = PowerAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetPowerAliases);
            var repository   = new PowerAliasesRepository(mockContext.Object);
            var powerAliases = repository.Get(1);

            // Act
            repository.Remove(powerAliases);
            // Assert
            mockSetPowerAliases.Verify(x => x.Remove((PowerAlias)powerAliases), Times.Once);
        }
Esempio n. 5
0
        public void Verify_Update_Should_SetTheEntityStateToModified()
        {
            // Arrange
            Mock <IDbSet <PowerAlias> > mockSetPowerAliases;
            var mockContext  = PowerAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetPowerAliases);
            var repository   = new PowerAliasesRepository(mockContext.Object);
            var powerAliases = repository.Get(1);

            powerAliases.ApiDetailUrl = "/TEST";
            // Act
            repository.Update(powerAliases);
            // Assert
            mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once);
        }
 public void Verify_Get_ByID_Should_ReturnTheCorrectPowerAlias()
 {
     // Arrange
     Mock<IDbSet<PowerAlias>> mockSetPowerAliases;
     var mockContext = PowerAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetPowerAliases);
     var repository = new PowerAliasesRepository(mockContext.Object);
     // Act
     var powerAliases = repository.Get(1);
     // Assert
                 Assert.Equal("/TEST/KING-STEPHEN", powerAliases.ApiDetailUrl);
 }
 public void Verify_Update_Should_SetTheEntityStateToModified()
 {
     // Arrange
     Mock<IDbSet<PowerAlias>> mockSetPowerAliases;
     var mockContext = PowerAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetPowerAliases);
     var repository = new PowerAliasesRepository(mockContext.Object);
     var powerAliases = repository.Get(1);
     powerAliases.ApiDetailUrl = "/TEST";
     // Act
     repository.Update(powerAliases);
     // Assert
     mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once);
 }
 public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
 {
     // Arrange
     Mock<IDbSet<PowerAlias>> mockSetPowerAliases;
     var mockContext = PowerAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetPowerAliases);
     var repository = new PowerAliasesRepository(mockContext.Object);
     var powerAliases = repository.Get(1);
     // Act
     repository.Remove(powerAliases);
     // Assert
     mockSetPowerAliases.Verify(x => x.Remove((PowerAlias)powerAliases), Times.Once);
 }