public void Verify_MapToSearchModel_AssignsPromoSearchProperties()
        {
            // Arrange
            var mapper = new PromoMapper();
            var model  = PromosMockingSetup.DoMockingSetupForPromoModel();
            // Act
            var searchModel = mapper.MapToSearchModel(model.Object);

            // Assert
            Assert.Equal(model.Object.PrimaryImageFileId, searchModel.PrimaryImageFileId);
            Assert.Equal(model.Object.PrimaryImageFile?.CustomKey, searchModel.PrimaryImageFileCustomKey);
            Assert.Equal(model.Object.PrimaryImageFile?.ApiDetailUrl, searchModel.PrimaryImageFileApiDetailUrl);
            Assert.Equal(model.Object.PrimaryImageFile?.SiteDetailUrl, searchModel.PrimaryImageFileSiteDetailUrl);
            Assert.Equal(model.Object.PrimaryImageFile?.Name, searchModel.PrimaryImageFileName);
            Assert.Equal(model.Object.PrimaryImageFile?.ShortDescription, searchModel.PrimaryImageFileShortDescription);
            Assert.Equal(model.Object.PrimaryImageFile?.Description, searchModel.PrimaryImageFileDescription);
            Assert.Equal(model.Object.AuthorId, searchModel.AuthorId);
            Assert.Equal(model.Object.Author?.CustomKey, searchModel.AuthorCustomKey);
            Assert.Equal(model.Object.Author?.ApiDetailUrl, searchModel.AuthorApiDetailUrl);
            Assert.Equal(model.Object.Author?.SiteDetailUrl, searchModel.AuthorSiteDetailUrl);
            Assert.Equal(model.Object.Author?.Name, searchModel.AuthorName);
            Assert.Equal(model.Object.Author?.ShortDescription, searchModel.AuthorShortDescription);
            Assert.Equal(model.Object.Author?.Description, searchModel.AuthorDescription);
            Assert.Equal(model.Object.ResourceTypeId, searchModel.ResourceTypeId);
            Assert.Equal(model.Object.ResourceType?.CustomKey, searchModel.ResourceTypeCustomKey);
            Assert.Equal(model.Object.ResourceType?.ApiDetailUrl, searchModel.ResourceTypeApiDetailUrl);
            Assert.Equal(model.Object.ResourceType?.SiteDetailUrl, searchModel.ResourceTypeSiteDetailUrl);
            Assert.Equal(model.Object.ResourceType?.Name, searchModel.ResourceTypeName);
            Assert.Equal(model.Object.ResourceType?.ShortDescription, searchModel.ResourceTypeShortDescription);
            Assert.Equal(model.Object.ResourceType?.Description, searchModel.ResourceTypeDescription);
        }
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new PromoMapper();
            var model  = PromosMockingSetup.DoMockingSetupForPromoModel(1);
            var entity = PromosMockingSetup.DoMockingSetupForPromo(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
        public void Verify_MapToEntityExtension_CallsMapToEntity()
        {
            // Arrange
            var mockMapper = new Mock <PromoMapper>();

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <IPromoModel>(), It.IsAny <int>()));
            var mockModel = PromosMockingSetup.DoMockingSetupForPromoModel(1);

            PromoMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <IPromoModel>(), It.IsAny <int>()), Times.Once);
        }
        public void Verify_AreEqualExtension_CallsAreEqual()
        {
            // Arrange
            var mockMapper = new Mock <PromoMapper>();

            mockMapper.Setup(x => x.AreEqual(It.IsAny <IPromoModel>(), It.IsAny <IPromo>()));
            PromoMapperExtensions.OverrideMapper(mockMapper.Object);
            var mockModel  = PromosMockingSetup.DoMockingSetupForPromoModel(1);
            var mockEntity = PromosMockingSetup.DoMockingSetupForPromo(1);

            // Act
            mockModel.Object.AreEqual(mockEntity.Object);
            // Assert
            mockMapper.Verify(x => x.AreEqual(It.IsAny <IPromoModel>(), It.IsAny <IPromo>()), Times.Once);
        }
        public void Verify_MapToEntity_AssignsPromoProperties()
        {
            // Arrange
            var mapper = new PromoMapper();
            var model  = PromosMockingSetup.DoMockingSetupForPromoModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            Assert.Equal(model.Object.Link, entity.Link);
            // Related Objects
            Assert.Equal(model.Object.PrimaryImageFileId, entity.PrimaryImageFileId);
            Assert.Equal(model.Object.AuthorId, entity.AuthorId);
            Assert.Equal(model.Object.ResourceTypeId, entity.ResourceTypeId);
            // Associated Objects
            // <None>
        }