public void Verify_Add_Should_AddTheEntityToTheContext()
 {
     // Arrange
     Mock<IDbSet<LocationVolume>> mockSetLocationVolumes;
     var mockContext = LocationVolumesMockingSetup.DoMockingSetupForContext(false, out mockSetLocationVolumes);
     var repository = new LocationVolumesRepository(mockContext.Object);
     var locationVolumes = new LocationVolume { Active = true, CustomKey = "SALVATORE-RAA", };
     // Act
     repository.Add(locationVolumes);
     // Assert
     mockSetLocationVolumes.Verify(x => x.Add(locationVolumes), Times.Once);
 }
コード例 #2
0
        public void Verify_Add_Should_AddTheEntityToTheContext()
        {
            // Arrange
            Mock <IDbSet <LocationVolume> > mockSetLocationVolumes;
            var mockContext     = LocationVolumesMockingSetup.DoMockingSetupForContext(false, out mockSetLocationVolumes);
            var repository      = new LocationVolumesRepository(mockContext.Object);
            var locationVolumes = new LocationVolume {
                Active = true, CustomKey = "SALVATORE-RAA",
            };

            // Act
            repository.Add(locationVolumes);
            // Assert
            mockSetLocationVolumes.Verify(x => x.Add(locationVolumes), Times.Once);
        }
        public void Verify_MapToEntity_WithExistingEntity_AssignsLocationVolumeProperties()
        {
            // Arrange
            var mapper = new LocationVolumeMapper();
            var model  = LocationVolumesMockingSetup.DoMockingSetupForLocationVolumeModel();
            // Act
            ILocationVolume existingEntity = new LocationVolume {
                Id = 1
            };

            mapper.MapToEntity(model.Object, ref existingEntity);
            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.LocationId, existingEntity.LocationId);
            Assert.Equal(model.Object.VolumeId, existingEntity.VolumeId);
            // Associated Objects
            // <None>
        }
 public void Verify_MapToEntity_WithExistingEntity_AssignsLocationVolumeProperties()
 {
     // Arrange
     var mapper = new LocationVolumeMapper();
     var model = LocationVolumesMockingSetup.DoMockingSetupForLocationVolumeModel();
     // Act
     ILocationVolume existingEntity = new LocationVolume { Id = 1 };
     mapper.MapToEntity(model.Object, ref existingEntity);
     // Assert
     // <None>
     // Related Objects
     Assert.Equal(model.Object.LocationId, existingEntity.LocationId);
     Assert.Equal(model.Object.VolumeId, existingEntity.VolumeId);
     // Associated Objects
     // <None>
 }