public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse() { // Arrange var mapper = new ConceptMapper(); var model = ConceptsMockingSetup.DoMockingSetupForConceptModel(1); var entity = ConceptsMockingSetup.DoMockingSetupForConcept(2); // Act var result = mapper.AreEqual(model.Object, entity.Object); // Assert Assert.False(result); }
public void Verify_MapToModelLite_AssignsLiteOnlyConceptProperties() { // Arrange var mapper = new ConceptMapper(); var entity = ConceptsMockingSetup.DoMockingSetupForConcept(); // Act var model = mapper.MapToModelLite(entity.Object); // Assert Assert.Equal(entity.Object.StartYear, model.StartYear); // Related Objects Assert.Equal(entity.Object.PrimaryImageFileId, model.PrimaryImageFileId); Assert.Equal(entity.Object.FirstIssueAppearanceId, model.FirstIssueAppearanceId); }
public void Verify_MapToModelListingExtension_CallsMapToModel() { // Arrange var mockMapper = new Mock <ConceptMapper>(); mockMapper.Setup(x => x.MapToModelListing(It.IsAny <IConcept>(), It.IsAny <int>())); var mockEntity = ConceptsMockingSetup.DoMockingSetupForConcept(1); ConceptMapperExtensions.OverrideMapper(mockMapper.Object); // Act mockEntity.Object.MapToModelListing(); // Assert mockMapper.Verify(x => x.MapToModelListing(It.IsAny <IConcept>(), It.IsAny <int>()), Times.Once); }
public void Verify_AreEqualExtension_CallsAreEqual() { // Arrange var mockMapper = new Mock <ConceptMapper>(); mockMapper.Setup(x => x.AreEqual(It.IsAny <IConceptModel>(), It.IsAny <IConcept>())); ConceptMapperExtensions.OverrideMapper(mockMapper.Object); var mockModel = ConceptsMockingSetup.DoMockingSetupForConceptModel(1); var mockEntity = ConceptsMockingSetup.DoMockingSetupForConcept(1); // Act mockModel.Object.AreEqual(mockEntity.Object); // Assert mockMapper.Verify(x => x.AreEqual(It.IsAny <IConceptModel>(), It.IsAny <IConcept>()), Times.Once); }
public void Verify_MapToModel_AssignsConceptProperties() { // Arrange var mapper = new ConceptMapper(); var entity = ConceptsMockingSetup.DoMockingSetupForConcept(); // Act var model = mapper.MapToModel(entity.Object); // Assert Assert.Equal(entity.Object.StartYear, model.StartYear); // Related Objects Assert.Equal(entity.Object.PrimaryImageFileId, model.PrimaryImageFileId); Assert.Equal(entity.Object.FirstIssueAppearanceId, model.FirstIssueAppearanceId); // Associated Objects Assert.Equal(entity.Object.ConceptAliases?.Count, model.ConceptAliases?.Count); Assert.Equal(entity.Object.ConceptIssuesAppearedIn?.Count, model.ConceptIssuesAppearedIn?.Count); Assert.Equal(entity.Object.ConceptIssues?.Count, model.ConceptIssues?.Count); Assert.Equal(entity.Object.ConceptMovies?.Count, model.ConceptMovies?.Count); Assert.Equal(entity.Object.ConceptVolumes?.Count, model.ConceptVolumes?.Count); }