public void Verify_MapToSearchModel_AssignsImageFileSearchProperties() { // Arrange var mapper = new ImageFileMapper(); var model = ImageFilesMockingSetup.DoMockingSetupForImageFileModel(); // Act var searchModel = mapper.MapToSearchModel(model.Object); // Assert }
public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse() { // Arrange var mapper = new ImageFileMapper(); var model = ImageFilesMockingSetup.DoMockingSetupForImageFileModel(1); var entity = ImageFilesMockingSetup.DoMockingSetupForImageFile(2); // Act var result = mapper.AreEqual(model.Object, entity.Object); // Assert Assert.False(result); }
public void Verify_MapToSearchModelExtension_CallsMapToModel() { // Arrange var mockMapper = new Mock <ImageFileMapper>(); mockMapper.Setup(x => x.MapToSearchModel(It.IsAny <IImageFileModel>())); var mockModel = ImageFilesMockingSetup.DoMockingSetupForImageFileModel(1); ImageFileMapperExtensions.OverrideMapper(mockMapper.Object); // Act mockModel.Object.MapToSearchModel(); // Assert mockMapper.Verify(x => x.MapToSearchModel(It.IsAny <IImageFileModel>()), Times.Once); }
public void Verify_AreEqualExtension_CallsAreEqual() { // Arrange var mockMapper = new Mock <ImageFileMapper>(); mockMapper.Setup(x => x.AreEqual(It.IsAny <IImageFileModel>(), It.IsAny <IImageFile>())); ImageFileMapperExtensions.OverrideMapper(mockMapper.Object); var mockModel = ImageFilesMockingSetup.DoMockingSetupForImageFileModel(1); var mockEntity = ImageFilesMockingSetup.DoMockingSetupForImageFile(1); // Act mockModel.Object.AreEqual(mockEntity.Object); // Assert mockMapper.Verify(x => x.AreEqual(It.IsAny <IImageFileModel>(), It.IsAny <IImageFile>()), Times.Once); }
public void Verify_MapToEntity_WithExistingEntity_AssignsImageFileProperties() { // Arrange var mapper = new ImageFileMapper(); var model = ImageFilesMockingSetup.DoMockingSetupForImageFileModel(); // Act IImageFile existingEntity = new ImageFile { Id = 1 }; mapper.MapToEntity(model.Object, ref existingEntity); // Assert // <None> // Related Objects // <None> // Associated Objects model.VerifyGet(x => x.Characters, Times.Once); //Assert.Equal(model.Object.Characters?.Count, existingEntity.Characters?.Count); model.VerifyGet(x => x.Chats, Times.Once); //Assert.Equal(model.Object.Chats?.Count, existingEntity.Chats?.Count); model.VerifyGet(x => x.Concepts, Times.Once); //Assert.Equal(model.Object.Concepts?.Count, existingEntity.Concepts?.Count); model.VerifyGet(x => x.Episodes, Times.Once); //Assert.Equal(model.Object.Episodes?.Count, existingEntity.Episodes?.Count); model.VerifyGet(x => x.Issues, Times.Once); //Assert.Equal(model.Object.Issues?.Count, existingEntity.Issues?.Count); model.VerifyGet(x => x.Locations, Times.Once); //Assert.Equal(model.Object.Locations?.Count, existingEntity.Locations?.Count); model.VerifyGet(x => x.Movies, Times.Once); //Assert.Equal(model.Object.Movies?.Count, existingEntity.Movies?.Count); model.VerifyGet(x => x.Objects, Times.Once); //Assert.Equal(model.Object.Objects?.Count, existingEntity.Objects?.Count); model.VerifyGet(x => x.People, Times.Once); //Assert.Equal(model.Object.People?.Count, existingEntity.People?.Count); model.VerifyGet(x => x.Promos, Times.Once); //Assert.Equal(model.Object.Promos?.Count, existingEntity.Promos?.Count); model.VerifyGet(x => x.Publishers, Times.Once); //Assert.Equal(model.Object.Publishers?.Count, existingEntity.Publishers?.Count); model.VerifyGet(x => x.StoryArcs, Times.Once); //Assert.Equal(model.Object.StoryArcs?.Count, existingEntity.StoryArcs?.Count); model.VerifyGet(x => x.Teams, Times.Once); //Assert.Equal(model.Object.Teams?.Count, existingEntity.Teams?.Count); model.VerifyGet(x => x.Videos, Times.Once); //Assert.Equal(model.Object.Videos?.Count, existingEntity.Videos?.Count); model.VerifyGet(x => x.Volumes, Times.Once); //Assert.Equal(model.Object.Volumes?.Count, existingEntity.Volumes?.Count); }