public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse() { // Arrange var mapper = new MovieWriterMapper(); var model = MovieWritersMockingSetup.DoMockingSetupForMovieWriterModel(1); var entity = MovieWritersMockingSetup.DoMockingSetupForMovieWriter(2); // Act var result = mapper.AreEqual(model.Object, entity.Object); // Assert Assert.False(result); }
public void Verify_MapToEntityExtension_CallsMapToEntity() { // Arrange var mockMapper = new Mock <MovieWriterMapper>(); mockMapper.Setup(x => x.MapToEntity(It.IsAny <IMovieWriterModel>(), It.IsAny <int>())); var mockModel = MovieWritersMockingSetup.DoMockingSetupForMovieWriterModel(1); MovieWriterMapperExtensions.OverrideMapper(mockMapper.Object); // Act mockModel.Object.MapToEntity(); // Assert mockMapper.Verify(x => x.MapToEntity(It.IsAny <IMovieWriterModel>(), It.IsAny <int>()), Times.Once); }
public void Verify_MapToEntity_AssignsMovieWriterProperties() { // Arrange var mapper = new MovieWriterMapper(); var model = MovieWritersMockingSetup.DoMockingSetupForMovieWriterModel(); // Act var entity = mapper.MapToEntity(model.Object); // Assert // <None> // Related Objects Assert.Equal(model.Object.MovieId, entity.MovieId); Assert.Equal(model.Object.WriterId, entity.WriterId); // Associated Objects // <None> }
public void Verify_MapToSearchModel_AssignsMovieWriterSearchProperties() { // Arrange var mapper = new MovieWriterMapper(); var model = MovieWritersMockingSetup.DoMockingSetupForMovieWriterModel(); // Act var searchModel = mapper.MapToSearchModel(model.Object); // Assert Assert.Equal(model.Object.MovieId, searchModel.MovieId); Assert.Equal(model.Object.Movie?.CustomKey, searchModel.MovieCustomKey); Assert.Equal(model.Object.Movie?.ApiDetailUrl, searchModel.MovieApiDetailUrl); Assert.Equal(model.Object.Movie?.SiteDetailUrl, searchModel.MovieSiteDetailUrl); Assert.Equal(model.Object.Movie?.Name, searchModel.MovieName); Assert.Equal(model.Object.Movie?.ShortDescription, searchModel.MovieShortDescription); Assert.Equal(model.Object.Movie?.Description, searchModel.MovieDescription); Assert.Equal(model.Object.WriterId, searchModel.WriterId); Assert.Equal(model.Object.Writer?.CustomKey, searchModel.WriterCustomKey); Assert.Equal(model.Object.Writer?.ApiDetailUrl, searchModel.WriterApiDetailUrl); Assert.Equal(model.Object.Writer?.SiteDetailUrl, searchModel.WriterSiteDetailUrl); Assert.Equal(model.Object.Writer?.Name, searchModel.WriterName); Assert.Equal(model.Object.Writer?.ShortDescription, searchModel.WriterShortDescription); Assert.Equal(model.Object.Writer?.Description, searchModel.WriterDescription); }