Exemplo n.º 1
0
        public void Verify_Get_ByKey_Should_ReturnTheCorrectPersonAlias()
        {
            // Arrange
            Mock <IDbSet <PersonAlias> > mockSetPersonAliases;
            var mockContext = PersonAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetPersonAliases);
            var repository  = new PersonAliasesRepository(mockContext.Object);
            // Act
            var personAliases = repository.Get("KING-STEPHEN");

            // Assert
            Assert.Equal("/TEST/KING-STEPHEN", personAliases.ApiDetailUrl);
        }
 public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
 {
     // Arrange
     Mock<IDbSet<PersonAlias>> mockSetPersonAliases;
     var mockContext = PersonAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetPersonAliases);
     var repository = new PersonAliasesRepository(mockContext.Object);
     var personAliases = repository.Get(1);
     // Act
     repository.Deactivate(personAliases);
     // Assert
     Assert.Equal(false, personAliases.Active);
 }
Exemplo n.º 3
0
        public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
        {
            // Arrange
            Mock <IDbSet <PersonAlias> > mockSetPersonAliases;
            var mockContext   = PersonAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetPersonAliases);
            var repository    = new PersonAliasesRepository(mockContext.Object);
            var personAliases = repository.Get(1);

            // Act
            repository.Deactivate(personAliases);
            // Assert
            Assert.Equal(false, personAliases.Active);
        }
Exemplo n.º 4
0
        public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
        {
            // Arrange
            Mock <IDbSet <PersonAlias> > mockSetPersonAliases;
            var mockContext   = PersonAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetPersonAliases);
            var repository    = new PersonAliasesRepository(mockContext.Object);
            var personAliases = repository.Get(1);

            // Act
            repository.Remove(personAliases);
            // Assert
            mockSetPersonAliases.Verify(x => x.Remove((PersonAlias)personAliases), Times.Once);
        }
Exemplo n.º 5
0
        public void Verify_Update_Should_SetTheEntityStateToModified()
        {
            // Arrange
            Mock <IDbSet <PersonAlias> > mockSetPersonAliases;
            var mockContext   = PersonAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetPersonAliases);
            var repository    = new PersonAliasesRepository(mockContext.Object);
            var personAliases = repository.Get(1);

            personAliases.ApiDetailUrl = "/TEST";
            // Act
            repository.Update(personAliases);
            // Assert
            mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once);
        }
 public void Verify_Get_ByID_Should_ReturnTheCorrectPersonAlias()
 {
     // Arrange
     Mock<IDbSet<PersonAlias>> mockSetPersonAliases;
     var mockContext = PersonAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetPersonAliases);
     var repository = new PersonAliasesRepository(mockContext.Object);
     // Act
     var personAliases = repository.Get(1);
     // Assert
                 Assert.Equal("/TEST/KING-STEPHEN", personAliases.ApiDetailUrl);
 }
 public void Verify_Update_Should_SetTheEntityStateToModified()
 {
     // Arrange
     Mock<IDbSet<PersonAlias>> mockSetPersonAliases;
     var mockContext = PersonAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetPersonAliases);
     var repository = new PersonAliasesRepository(mockContext.Object);
     var personAliases = repository.Get(1);
     personAliases.ApiDetailUrl = "/TEST";
     // Act
     repository.Update(personAliases);
     // Assert
     mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once);
 }
 public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
 {
     // Arrange
     Mock<IDbSet<PersonAlias>> mockSetPersonAliases;
     var mockContext = PersonAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetPersonAliases);
     var repository = new PersonAliasesRepository(mockContext.Object);
     var personAliases = repository.Get(1);
     // Act
     repository.Remove(personAliases);
     // Assert
     mockSetPersonAliases.Verify(x => x.Remove((PersonAlias)personAliases), Times.Once);
 }