public void Verify_Add_Should_AddTheEntityToTheContext()
 {
     // Arrange
     Mock<IDbSet<EpisodeConcept>> mockSetEpisodeConcepts;
     var mockContext = EpisodeConceptsMockingSetup.DoMockingSetupForContext(false, out mockSetEpisodeConcepts);
     var repository = new EpisodeConceptsRepository(mockContext.Object);
     var episodeConcepts = new EpisodeConcept { Active = true, CustomKey = "SALVATORE-RAA", };
     // Act
     repository.Add(episodeConcepts);
     // Assert
     mockSetEpisodeConcepts.Verify(x => x.Add(episodeConcepts), Times.Once);
 }
        public void Verify_Add_Should_AddTheEntityToTheContext()
        {
            // Arrange
            Mock <IDbSet <EpisodeConcept> > mockSetEpisodeConcepts;
            var mockContext     = EpisodeConceptsMockingSetup.DoMockingSetupForContext(false, out mockSetEpisodeConcepts);
            var repository      = new EpisodeConceptsRepository(mockContext.Object);
            var episodeConcepts = new EpisodeConcept {
                Active = true, CustomKey = "SALVATORE-RAA",
            };

            // Act
            repository.Add(episodeConcepts);
            // Assert
            mockSetEpisodeConcepts.Verify(x => x.Add(episodeConcepts), Times.Once);
        }
示例#3
0
        public void Verify_MapToEntity_WithExistingEntity_AssignsEpisodeConceptProperties()
        {
            // Arrange
            var mapper = new EpisodeConceptMapper();
            var model  = EpisodeConceptsMockingSetup.DoMockingSetupForEpisodeConceptModel();
            // Act
            IEpisodeConcept existingEntity = new EpisodeConcept {
                Id = 1
            };

            mapper.MapToEntity(model.Object, ref existingEntity);
            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.EpisodeId, existingEntity.EpisodeId);
            Assert.Equal(model.Object.ConceptId, existingEntity.ConceptId);
            // Associated Objects
            // <None>
        }
 public void Verify_MapToEntity_WithExistingEntity_AssignsEpisodeConceptProperties()
 {
     // Arrange
     var mapper = new EpisodeConceptMapper();
     var model = EpisodeConceptsMockingSetup.DoMockingSetupForEpisodeConceptModel();
     // Act
     IEpisodeConcept existingEntity = new EpisodeConcept { Id = 1 };
     mapper.MapToEntity(model.Object, ref existingEntity);
     // Assert
     // <None>
     // Related Objects
     Assert.Equal(model.Object.EpisodeId, existingEntity.EpisodeId);
     Assert.Equal(model.Object.ConceptId, existingEntity.ConceptId);
     // Associated Objects
     // <None>
 }