public void Verify_Add_Should_AddTheEntityToTheContext()
 {
     // Arrange
     Mock<IDbSet<VolumeConcept>> mockSetVolumeConcepts;
     var mockContext = VolumeConceptsMockingSetup.DoMockingSetupForContext(false, out mockSetVolumeConcepts);
     var repository = new VolumeConceptsRepository(mockContext.Object);
     var volumeConcepts = new VolumeConcept { Active = true, CustomKey = "SALVATORE-RAA", };
     // Act
     repository.Add(volumeConcepts);
     // Assert
     mockSetVolumeConcepts.Verify(x => x.Add(volumeConcepts), Times.Once);
 }
        public void Verify_Add_Should_AddTheEntityToTheContext()
        {
            // Arrange
            Mock <IDbSet <VolumeConcept> > mockSetVolumeConcepts;
            var mockContext    = VolumeConceptsMockingSetup.DoMockingSetupForContext(false, out mockSetVolumeConcepts);
            var repository     = new VolumeConceptsRepository(mockContext.Object);
            var volumeConcepts = new VolumeConcept {
                Active = true, CustomKey = "SALVATORE-RAA",
            };

            // Act
            repository.Add(volumeConcepts);
            // Assert
            mockSetVolumeConcepts.Verify(x => x.Add(volumeConcepts), Times.Once);
        }
Exemplo n.º 3
0
        public void Verify_MapToEntity_WithExistingEntity_AssignsVolumeConceptProperties()
        {
            // Arrange
            var mapper = new VolumeConceptMapper();
            var model  = VolumeConceptsMockingSetup.DoMockingSetupForVolumeConceptModel();
            // Act
            IVolumeConcept existingEntity = new VolumeConcept {
                Id = 1
            };

            mapper.MapToEntity(model.Object, ref existingEntity);
            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.VolumeId, existingEntity.VolumeId);
            Assert.Equal(model.Object.ConceptId, existingEntity.ConceptId);
            // Associated Objects
            // <None>
        }
 public void Verify_MapToEntity_WithExistingEntity_AssignsVolumeConceptProperties()
 {
     // Arrange
     var mapper = new VolumeConceptMapper();
     var model = VolumeConceptsMockingSetup.DoMockingSetupForVolumeConceptModel();
     // Act
     IVolumeConcept existingEntity = new VolumeConcept { Id = 1 };
     mapper.MapToEntity(model.Object, ref existingEntity);
     // Assert
     // <None>
     // Related Objects
     Assert.Equal(model.Object.VolumeId, existingEntity.VolumeId);
     Assert.Equal(model.Object.ConceptId, existingEntity.ConceptId);
     // Associated Objects
     // <None>
 }