Beispiel #1
0
        public void Verify_Get_ByKey_Should_ReturnTheCorrectVolumeAlias()
        {
            // Arrange
            Mock <IDbSet <VolumeAlias> > mockSetVolumeAliases;
            var mockContext = VolumeAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetVolumeAliases);
            var repository  = new VolumeAliasesRepository(mockContext.Object);
            // Act
            var volumeAliases = repository.Get("KING-STEPHEN");

            // Assert
            Assert.Equal("/TEST/KING-STEPHEN", volumeAliases.ApiDetailUrl);
        }
 public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
 {
     // Arrange
     Mock<IDbSet<VolumeAlias>> mockSetVolumeAliases;
     var mockContext = VolumeAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetVolumeAliases);
     var repository = new VolumeAliasesRepository(mockContext.Object);
     var volumeAliases = repository.Get(1);
     // Act
     repository.Deactivate(volumeAliases);
     // Assert
     Assert.Equal(false, volumeAliases.Active);
 }
Beispiel #3
0
        public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity()
        {
            // Arrange
            Mock <IDbSet <VolumeAlias> > mockSetVolumeAliases;
            var mockContext   = VolumeAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetVolumeAliases);
            var repository    = new VolumeAliasesRepository(mockContext.Object);
            var volumeAliases = repository.Get(1);

            // Act
            repository.Deactivate(volumeAliases);
            // Assert
            Assert.Equal(false, volumeAliases.Active);
        }
Beispiel #4
0
        public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
        {
            // Arrange
            Mock <IDbSet <VolumeAlias> > mockSetVolumeAliases;
            var mockContext   = VolumeAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetVolumeAliases);
            var repository    = new VolumeAliasesRepository(mockContext.Object);
            var volumeAliases = repository.Get(1);

            // Act
            repository.Remove(volumeAliases);
            // Assert
            mockSetVolumeAliases.Verify(x => x.Remove((VolumeAlias)volumeAliases), Times.Once);
        }
Beispiel #5
0
        public void Verify_Update_Should_SetTheEntityStateToModified()
        {
            // Arrange
            Mock <IDbSet <VolumeAlias> > mockSetVolumeAliases;
            var mockContext   = VolumeAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetVolumeAliases);
            var repository    = new VolumeAliasesRepository(mockContext.Object);
            var volumeAliases = repository.Get(1);

            volumeAliases.ApiDetailUrl = "/TEST";
            // Act
            repository.Update(volumeAliases);
            // Assert
            mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once);
        }
 public void Verify_Get_ByID_Should_ReturnTheCorrectVolumeAlias()
 {
     // Arrange
     Mock<IDbSet<VolumeAlias>> mockSetVolumeAliases;
     var mockContext = VolumeAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetVolumeAliases);
     var repository = new VolumeAliasesRepository(mockContext.Object);
     // Act
     var volumeAliases = repository.Get(1);
     // Assert
                 Assert.Equal("/TEST/KING-STEPHEN", volumeAliases.ApiDetailUrl);
 }
 public void Verify_Update_Should_SetTheEntityStateToModified()
 {
     // Arrange
     Mock<IDbSet<VolumeAlias>> mockSetVolumeAliases;
     var mockContext = VolumeAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetVolumeAliases);
     var repository = new VolumeAliasesRepository(mockContext.Object);
     var volumeAliases = repository.Get(1);
     volumeAliases.ApiDetailUrl = "/TEST";
     // Act
     repository.Update(volumeAliases);
     // Assert
     mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once);
 }
 public void Verify_Remove_Should_RemoveTheEntityFromTheContext()
 {
     // Arrange
     Mock<IDbSet<VolumeAlias>> mockSetVolumeAliases;
     var mockContext = VolumeAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetVolumeAliases);
     var repository = new VolumeAliasesRepository(mockContext.Object);
     var volumeAliases = repository.Get(1);
     // Act
     repository.Remove(volumeAliases);
     // Assert
     mockSetVolumeAliases.Verify(x => x.Remove((VolumeAlias)volumeAliases), Times.Once);
 }