public void Verify_Add_Should_AddTheEntityToTheContext()
 {
     // Arrange
     Mock<IDbSet<VolumeAlias>> mockSetVolumeAliases;
     var mockContext = VolumeAliasesMockingSetup.DoMockingSetupForContext(false, out mockSetVolumeAliases);
     var repository = new VolumeAliasesRepository(mockContext.Object);
     var volumeAliases = new VolumeAlias { Active = true, CustomKey = "SALVATORE-RAA", };
     // Act
     repository.Add(volumeAliases);
     // Assert
     mockSetVolumeAliases.Verify(x => x.Add(volumeAliases), Times.Once);
 }
Beispiel #2
0
        public void Verify_Add_Should_AddTheEntityToTheContext()
        {
            // Arrange
            Mock <IDbSet <VolumeAlias> > mockSetVolumeAliases;
            var mockContext   = VolumeAliasesMockingSetup.DoMockingSetupForContext(false, out mockSetVolumeAliases);
            var repository    = new VolumeAliasesRepository(mockContext.Object);
            var volumeAliases = new VolumeAlias {
                Active = true, CustomKey = "SALVATORE-RAA",
            };

            // Act
            repository.Add(volumeAliases);
            // Assert
            mockSetVolumeAliases.Verify(x => x.Add(volumeAliases), Times.Once);
        }
 public void Verify_MapToEntity_WithExistingEntity_AssignsVolumeAliasProperties()
 {
     // Arrange
     var mapper = new VolumeAliasMapper();
     var model = VolumeAliasesMockingSetup.DoMockingSetupForVolumeAliasModel();
     // Act
     IVolumeAlias existingEntity = new VolumeAlias { Id = 1 };
     mapper.MapToEntity(model.Object, ref existingEntity);
     // Assert
     // <None>
     // Related Objects
     Assert.Equal(model.Object.VolumeId, existingEntity.VolumeId);
     // Associated Objects
     // <None>
 }
        public void Verify_MapToEntity_WithExistingEntity_AssignsVolumeAliasProperties()
        {
            // Arrange
            var mapper = new VolumeAliasMapper();
            var model  = VolumeAliasesMockingSetup.DoMockingSetupForVolumeAliasModel();
            // Act
            IVolumeAlias existingEntity = new VolumeAlias {
                Id = 1
            };

            mapper.MapToEntity(model.Object, ref existingEntity);
            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.VolumeId, existingEntity.VolumeId);
            // Associated Objects
            // <None>
        }