Beispiel #1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new LocationMapper();
            var model  = LocationsMockingSetup.DoMockingSetupForLocationModel(1);
            var entity = LocationsMockingSetup.DoMockingSetupForLocation(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
Beispiel #2
0
        public void Verify_MapToModelLite_AssignsLiteOnlyLocationProperties()
        {
            // Arrange
            var mapper = new LocationMapper();
            var entity = LocationsMockingSetup.DoMockingSetupForLocation();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            Assert.Equal(entity.Object.StartYear, model.StartYear);
            // Related Objects
            Assert.Equal(entity.Object.FirstIssueAppearanceId, model.FirstIssueAppearanceId);
            Assert.Equal(entity.Object.PrimaryImageFileId, model.PrimaryImageFileId);
        }
Beispiel #3
0
        public void Verify_MapToModelListingExtension_CallsMapToModel()
        {
            // Arrange
            var mockMapper = new Mock <LocationMapper>();

            mockMapper.Setup(x => x.MapToModelListing(It.IsAny <ILocation>(), It.IsAny <int>()));
            var mockEntity = LocationsMockingSetup.DoMockingSetupForLocation(1);

            LocationMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockEntity.Object.MapToModelListing();
            // Assert
            mockMapper.Verify(x => x.MapToModelListing(It.IsAny <ILocation>(), It.IsAny <int>()), Times.Once);
        }
Beispiel #4
0
        public void Verify_AreEqualExtension_CallsAreEqual()
        {
            // Arrange
            var mockMapper = new Mock <LocationMapper>();

            mockMapper.Setup(x => x.AreEqual(It.IsAny <ILocationModel>(), It.IsAny <ILocation>()));
            LocationMapperExtensions.OverrideMapper(mockMapper.Object);
            var mockModel  = LocationsMockingSetup.DoMockingSetupForLocationModel(1);
            var mockEntity = LocationsMockingSetup.DoMockingSetupForLocation(1);

            // Act
            mockModel.Object.AreEqual(mockEntity.Object);
            // Assert
            mockMapper.Verify(x => x.AreEqual(It.IsAny <ILocationModel>(), It.IsAny <ILocation>()), Times.Once);
        }
Beispiel #5
0
        public void Verify_MapToModel_AssignsLocationProperties()
        {
            // Arrange
            var mapper = new LocationMapper();
            var entity = LocationsMockingSetup.DoMockingSetupForLocation();
            // Act
            var model = mapper.MapToModel(entity.Object);

            // Assert
            Assert.Equal(entity.Object.StartYear, model.StartYear);
            // Related Objects
            Assert.Equal(entity.Object.FirstIssueAppearanceId, model.FirstIssueAppearanceId);
            Assert.Equal(entity.Object.PrimaryImageFileId, model.PrimaryImageFileId);
            // Associated Objects
            Assert.Equal(entity.Object.LocationAliases?.Count, model.LocationAliases?.Count);
            Assert.Equal(entity.Object.LocationAppearedInIssues?.Count, model.LocationAppearedInIssues?.Count);
            Assert.Equal(entity.Object.LocationIssues?.Count, model.LocationIssues?.Count);
            Assert.Equal(entity.Object.LocationMovies?.Count, model.LocationMovies?.Count);
            Assert.Equal(entity.Object.LocationStoryArcs?.Count, model.LocationStoryArcs?.Count);
            Assert.Equal(entity.Object.LocationVolumes?.Count, model.LocationVolumes?.Count);
        }