public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock<IDbSet<SeriesLocation>> mockSetSeriesLocations; var mockContext = SeriesLocationsMockingSetup.DoMockingSetupForContext(false, out mockSetSeriesLocations); var repository = new SeriesLocationsRepository(mockContext.Object); var seriesLocations = new SeriesLocation { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(seriesLocations); // Assert mockSetSeriesLocations.Verify(x => x.Add(seriesLocations), Times.Once); }
public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock <IDbSet <SeriesLocation> > mockSetSeriesLocations; var mockContext = SeriesLocationsMockingSetup.DoMockingSetupForContext(false, out mockSetSeriesLocations); var repository = new SeriesLocationsRepository(mockContext.Object); var seriesLocations = new SeriesLocation { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(seriesLocations); // Assert mockSetSeriesLocations.Verify(x => x.Add(seriesLocations), Times.Once); }
public void Verify_MapToEntity_WithExistingEntity_AssignsSeriesLocationProperties() { // Arrange var mapper = new SeriesLocationMapper(); var model = SeriesLocationsMockingSetup.DoMockingSetupForSeriesLocationModel(); // Act ISeriesLocation existingEntity = new SeriesLocation { Id = 1 }; mapper.MapToEntity(model.Object, ref existingEntity); // Assert // <None> // Related Objects Assert.Equal(model.Object.SeriesId, existingEntity.SeriesId); Assert.Equal(model.Object.LocationId, existingEntity.LocationId); // Associated Objects // <None> }