public void Verify_Add_Should_AddTheEntityToTheContext()
 {
     // Arrange
     Mock<IDbSet<EpisodeCharacterDied>> mockSetEpisodeCharactersDied;
     var mockContext = EpisodeCharactersDiedMockingSetup.DoMockingSetupForContext(false, out mockSetEpisodeCharactersDied);
     var repository = new EpisodeCharactersDiedRepository(mockContext.Object);
     var episodeCharactersDied = new EpisodeCharacterDied { Active = true, CustomKey = "SALVATORE-RAA", };
     // Act
     repository.Add(episodeCharactersDied);
     // Assert
     mockSetEpisodeCharactersDied.Verify(x => x.Add(episodeCharactersDied), Times.Once);
 }
Esempio n. 2
0
        public void Verify_Add_Should_AddTheEntityToTheContext()
        {
            // Arrange
            Mock <IDbSet <EpisodeCharacterDied> > mockSetEpisodeCharactersDied;
            var mockContext           = EpisodeCharactersDiedMockingSetup.DoMockingSetupForContext(false, out mockSetEpisodeCharactersDied);
            var repository            = new EpisodeCharactersDiedRepository(mockContext.Object);
            var episodeCharactersDied = new EpisodeCharacterDied {
                Active = true, CustomKey = "SALVATORE-RAA",
            };

            // Act
            repository.Add(episodeCharactersDied);
            // Assert
            mockSetEpisodeCharactersDied.Verify(x => x.Add(episodeCharactersDied), Times.Once);
        }
        public void Verify_MapToEntity_WithExistingEntity_AssignsEpisodeCharacterDiedProperties()
        {
            // Arrange
            var mapper = new EpisodeCharacterDiedMapper();
            var model  = EpisodeCharactersDiedMockingSetup.DoMockingSetupForEpisodeCharacterDiedModel();
            // Act
            IEpisodeCharacterDied existingEntity = new EpisodeCharacterDied {
                Id = 1
            };

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