public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock<IDbSet<EpisodeObject>> mockSetEpisodeObjects; var mockContext = EpisodeObjectsMockingSetup.DoMockingSetupForContext(false, out mockSetEpisodeObjects); var repository = new EpisodeObjectsRepository(mockContext.Object); var episodeObjects = new EpisodeObject { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(episodeObjects); // Assert mockSetEpisodeObjects.Verify(x => x.Add(episodeObjects), Times.Once); }
public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock <IDbSet <EpisodeObject> > mockSetEpisodeObjects; var mockContext = EpisodeObjectsMockingSetup.DoMockingSetupForContext(false, out mockSetEpisodeObjects); var repository = new EpisodeObjectsRepository(mockContext.Object); var episodeObjects = new EpisodeObject { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(episodeObjects); // Assert mockSetEpisodeObjects.Verify(x => x.Add(episodeObjects), Times.Once); }
public void Verify_MapToEntity_WithExistingEntity_AssignsEpisodeObjectProperties() { // Arrange var mapper = new EpisodeObjectMapper(); var model = EpisodeObjectsMockingSetup.DoMockingSetupForEpisodeObjectModel(); // Act IEpisodeObject existingEntity = new EpisodeObject { Id = 1 }; mapper.MapToEntity(model.Object, ref existingEntity); // Assert // <None> // Related Objects Assert.Equal(model.Object.EpisodeId, existingEntity.EpisodeId); Assert.Equal(model.Object.ObjectId, existingEntity.ObjectId); // Associated Objects // <None> }