public void Verify_Add_Should_AddTheEntityToTheContext()
 {
     // Arrange
     Mock<IDbSet<VolumeWriter>> mockSetVolumeWriters;
     var mockContext = VolumeWritersMockingSetup.DoMockingSetupForContext(false, out mockSetVolumeWriters);
     var repository = new VolumeWritersRepository(mockContext.Object);
     var volumeWriters = new VolumeWriter { Active = true, CustomKey = "SALVATORE-RAA", };
     // Act
     repository.Add(volumeWriters);
     // Assert
     mockSetVolumeWriters.Verify(x => x.Add(volumeWriters), Times.Once);
 }
        public void Verify_Add_Should_AddTheEntityToTheContext()
        {
            // Arrange
            Mock <IDbSet <VolumeWriter> > mockSetVolumeWriters;
            var mockContext   = VolumeWritersMockingSetup.DoMockingSetupForContext(false, out mockSetVolumeWriters);
            var repository    = new VolumeWritersRepository(mockContext.Object);
            var volumeWriters = new VolumeWriter {
                Active = true, CustomKey = "SALVATORE-RAA",
            };

            // Act
            repository.Add(volumeWriters);
            // Assert
            mockSetVolumeWriters.Verify(x => x.Add(volumeWriters), Times.Once);
        }
コード例 #3
0
        public void Verify_MapToEntity_WithExistingEntity_AssignsVolumeWriterProperties()
        {
            // Arrange
            var mapper = new VolumeWriterMapper();
            var model  = VolumeWritersMockingSetup.DoMockingSetupForVolumeWriterModel();
            // Act
            IVolumeWriter existingEntity = new VolumeWriter {
                Id = 1
            };

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