Пример #1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new LocationAppearedInIssueMapper();
            var model  = LocationAppearedInIssuesMockingSetup.DoMockingSetupForLocationAppearedInIssueModel(1);
            var entity = LocationAppearedInIssuesMockingSetup.DoMockingSetupForLocationAppearedInIssue(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
Пример #2
0
        public void Verify_MapToEntityExtension_CallsMapToEntity()
        {
            // Arrange
            var mockMapper = new Mock <LocationAppearedInIssueMapper>();

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <ILocationAppearedInIssueModel>(), It.IsAny <int>()));
            var mockModel = LocationAppearedInIssuesMockingSetup.DoMockingSetupForLocationAppearedInIssueModel(1);

            LocationAppearedInIssueMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <ILocationAppearedInIssueModel>(), It.IsAny <int>()), Times.Once);
        }
Пример #3
0
        public void Verify_MapToModelLite_AssignsLiteOnlyLocationAppearedInIssueProperties()
        {
            // Arrange
            var mapper = new LocationAppearedInIssueMapper();
            var entity = LocationAppearedInIssuesMockingSetup.DoMockingSetupForLocationAppearedInIssue();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.LocationId, model.LocationId);
            Assert.Equal(entity.Object.AppearedInIssueId, model.AppearedInIssueId);
        }
Пример #4
0
        public void Verify_MapToEntity_AssignsLocationAppearedInIssueProperties()
        {
            // Arrange
            var mapper = new LocationAppearedInIssueMapper();
            var model  = LocationAppearedInIssuesMockingSetup.DoMockingSetupForLocationAppearedInIssueModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.LocationId, entity.LocationId);
            Assert.Equal(model.Object.AppearedInIssueId, entity.AppearedInIssueId);
            // Associated Objects
            // <None>
        }
Пример #5
0
        public void Verify_MapToSearchModel_AssignsLocationAppearedInIssueSearchProperties()
        {
            // Arrange
            var mapper = new LocationAppearedInIssueMapper();
            var model  = LocationAppearedInIssuesMockingSetup.DoMockingSetupForLocationAppearedInIssueModel();
            // Act
            var searchModel = mapper.MapToSearchModel(model.Object);

            // Assert
            Assert.Equal(model.Object.LocationId, searchModel.LocationId);
            Assert.Equal(model.Object.Location?.CustomKey, searchModel.LocationCustomKey);
            Assert.Equal(model.Object.Location?.ApiDetailUrl, searchModel.LocationApiDetailUrl);
            Assert.Equal(model.Object.Location?.SiteDetailUrl, searchModel.LocationSiteDetailUrl);
            Assert.Equal(model.Object.Location?.Name, searchModel.LocationName);
            Assert.Equal(model.Object.Location?.ShortDescription, searchModel.LocationShortDescription);
            Assert.Equal(model.Object.Location?.Description, searchModel.LocationDescription);
            Assert.Equal(model.Object.AppearedInIssueId, searchModel.AppearedInIssueId);
            Assert.Equal(model.Object.AppearedInIssue?.CustomKey, searchModel.AppearedInIssueCustomKey);
            Assert.Equal(model.Object.AppearedInIssue?.ApiDetailUrl, searchModel.AppearedInIssueApiDetailUrl);
            Assert.Equal(model.Object.AppearedInIssue?.SiteDetailUrl, searchModel.AppearedInIssueSiteDetailUrl);
            Assert.Equal(model.Object.AppearedInIssue?.Name, searchModel.AppearedInIssueName);
            Assert.Equal(model.Object.AppearedInIssue?.ShortDescription, searchModel.AppearedInIssueShortDescription);
            Assert.Equal(model.Object.AppearedInIssue?.Description, searchModel.AppearedInIssueDescription);
        }