public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock<IDbSet<ObjectMovie>> mockSetObjectMovies; var mockContext = ObjectMoviesMockingSetup.DoMockingSetupForContext(false, out mockSetObjectMovies); var repository = new ObjectMoviesRepository(mockContext.Object); var objectMovies = new ObjectMovie { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(objectMovies); // Assert mockSetObjectMovies.Verify(x => x.Add(objectMovies), Times.Once); }
public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock <IDbSet <ObjectMovie> > mockSetObjectMovies; var mockContext = ObjectMoviesMockingSetup.DoMockingSetupForContext(false, out mockSetObjectMovies); var repository = new ObjectMoviesRepository(mockContext.Object); var objectMovies = new ObjectMovie { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(objectMovies); // Assert mockSetObjectMovies.Verify(x => x.Add(objectMovies), Times.Once); }
public void Verify_MapToEntity_WithExistingEntity_AssignsObjectMovieProperties() { // Arrange var mapper = new ObjectMovieMapper(); var model = ObjectMoviesMockingSetup.DoMockingSetupForObjectMovieModel(); // Act IObjectMovie existingEntity = new ObjectMovie { Id = 1 }; mapper.MapToEntity(model.Object, ref existingEntity); // Assert // <None> // Related Objects Assert.Equal(model.Object.ObjectId, existingEntity.ObjectId); Assert.Equal(model.Object.MovieId, existingEntity.MovieId); // Associated Objects // <None> }