public void Verify_Add_Should_AddTheEntityToTheContext()
 {
     // Arrange
     Mock<IDbSet<LocationMovie>> mockSetLocationMovies;
     var mockContext = LocationMoviesMockingSetup.DoMockingSetupForContext(false, out mockSetLocationMovies);
     var repository = new LocationMoviesRepository(mockContext.Object);
     var locationMovies = new LocationMovie { Active = true, CustomKey = "SALVATORE-RAA", };
     // Act
     repository.Add(locationMovies);
     // Assert
     mockSetLocationMovies.Verify(x => x.Add(locationMovies), Times.Once);
 }
Ejemplo n.º 2
0
        public void Verify_Add_Should_AddTheEntityToTheContext()
        {
            // Arrange
            Mock <IDbSet <LocationMovie> > mockSetLocationMovies;
            var mockContext    = LocationMoviesMockingSetup.DoMockingSetupForContext(false, out mockSetLocationMovies);
            var repository     = new LocationMoviesRepository(mockContext.Object);
            var locationMovies = new LocationMovie {
                Active = true, CustomKey = "SALVATORE-RAA",
            };

            // Act
            repository.Add(locationMovies);
            // Assert
            mockSetLocationMovies.Verify(x => x.Add(locationMovies), Times.Once);
        }
        public void Verify_MapToEntity_WithExistingEntity_AssignsLocationMovieProperties()
        {
            // Arrange
            var mapper = new LocationMovieMapper();
            var model  = LocationMoviesMockingSetup.DoMockingSetupForLocationMovieModel();
            // Act
            ILocationMovie existingEntity = new LocationMovie {
                Id = 1
            };

            mapper.MapToEntity(model.Object, ref existingEntity);
            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.LocationId, existingEntity.LocationId);
            Assert.Equal(model.Object.MovieId, existingEntity.MovieId);
            // Associated Objects
            // <None>
        }
 public void Verify_MapToEntity_WithExistingEntity_AssignsLocationMovieProperties()
 {
     // Arrange
     var mapper = new LocationMovieMapper();
     var model = LocationMoviesMockingSetup.DoMockingSetupForLocationMovieModel();
     // Act
     ILocationMovie existingEntity = new LocationMovie { Id = 1 };
     mapper.MapToEntity(model.Object, ref existingEntity);
     // Assert
     // <None>
     // Related Objects
     Assert.Equal(model.Object.LocationId, existingEntity.LocationId);
     Assert.Equal(model.Object.MovieId, existingEntity.MovieId);
     // Associated Objects
     // <None>
 }