public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse() { // Arrange var mapper = new ObjectMovieMapper(); var model = ObjectMoviesMockingSetup.DoMockingSetupForObjectMovieModel(1); var entity = ObjectMoviesMockingSetup.DoMockingSetupForObjectMovie(2); // Act var result = mapper.AreEqual(model.Object, entity.Object); // Assert Assert.False(result); }
public void Verify_MapToEntityExtension_CallsMapToEntity() { // Arrange var mockMapper = new Mock <ObjectMovieMapper>(); mockMapper.Setup(x => x.MapToEntity(It.IsAny <IObjectMovieModel>(), It.IsAny <int>())); var mockModel = ObjectMoviesMockingSetup.DoMockingSetupForObjectMovieModel(1); ObjectMovieMapperExtensions.OverrideMapper(mockMapper.Object); // Act mockModel.Object.MapToEntity(); // Assert mockMapper.Verify(x => x.MapToEntity(It.IsAny <IObjectMovieModel>(), It.IsAny <int>()), Times.Once); }
public void Verify_AreEqualExtension_CallsAreEqual() { // Arrange var mockMapper = new Mock <ObjectMovieMapper>(); mockMapper.Setup(x => x.AreEqual(It.IsAny <IObjectMovieModel>(), It.IsAny <IObjectMovie>())); ObjectMovieMapperExtensions.OverrideMapper(mockMapper.Object); var mockModel = ObjectMoviesMockingSetup.DoMockingSetupForObjectMovieModel(1); var mockEntity = ObjectMoviesMockingSetup.DoMockingSetupForObjectMovie(1); // Act mockModel.Object.AreEqual(mockEntity.Object); // Assert mockMapper.Verify(x => x.AreEqual(It.IsAny <IObjectMovieModel>(), It.IsAny <IObjectMovie>()), Times.Once); }
public void Verify_MapToEntity_AssignsObjectMovieProperties() { // Arrange var mapper = new ObjectMovieMapper(); var model = ObjectMoviesMockingSetup.DoMockingSetupForObjectMovieModel(); // Act var entity = mapper.MapToEntity(model.Object); // Assert // <None> // Related Objects Assert.Equal(model.Object.ObjectId, entity.ObjectId); Assert.Equal(model.Object.MovieId, entity.MovieId); // Associated Objects // <None> }
public void Verify_MapToSearchModel_AssignsObjectMovieSearchProperties() { // Arrange var mapper = new ObjectMovieMapper(); var model = ObjectMoviesMockingSetup.DoMockingSetupForObjectMovieModel(); // Act var searchModel = mapper.MapToSearchModel(model.Object); // Assert Assert.Equal(model.Object.ObjectId, searchModel.ObjectId); Assert.Equal(model.Object.Object?.CustomKey, searchModel.ObjectCustomKey); Assert.Equal(model.Object.Object?.ApiDetailUrl, searchModel.ObjectApiDetailUrl); Assert.Equal(model.Object.Object?.SiteDetailUrl, searchModel.ObjectSiteDetailUrl); Assert.Equal(model.Object.Object?.Name, searchModel.ObjectName); Assert.Equal(model.Object.Object?.ShortDescription, searchModel.ObjectShortDescription); Assert.Equal(model.Object.Object?.Description, searchModel.ObjectDescription); 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); }