Пример #1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new IssueWriterMapper();
            var model  = IssueWritersMockingSetup.DoMockingSetupForIssueWriterModel(1);
            var entity = IssueWritersMockingSetup.DoMockingSetupForIssueWriter(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 <IssueWriterMapper>();

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <IIssueWriterModel>(), It.IsAny <int>()));
            var mockModel = IssueWritersMockingSetup.DoMockingSetupForIssueWriterModel(1);

            IssueWriterMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <IIssueWriterModel>(), It.IsAny <int>()), Times.Once);
        }
Пример #3
0
        public void Verify_MapToModelLite_AssignsLiteOnlyIssueWriterProperties()
        {
            // Arrange
            var mapper = new IssueWriterMapper();
            var entity = IssueWritersMockingSetup.DoMockingSetupForIssueWriter();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.IssueId, model.IssueId);
            Assert.Equal(entity.Object.WriterId, model.WriterId);
        }
Пример #4
0
        public void Verify_MapToEntity_AssignsIssueWriterProperties()
        {
            // Arrange
            var mapper = new IssueWriterMapper();
            var model  = IssueWritersMockingSetup.DoMockingSetupForIssueWriterModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.IssueId, entity.IssueId);
            Assert.Equal(model.Object.WriterId, entity.WriterId);
            // Associated Objects
            // <None>
        }
Пример #5
0
        public void Verify_MapToSearchModel_AssignsIssueWriterSearchProperties()
        {
            // Arrange
            var mapper = new IssueWriterMapper();
            var model  = IssueWritersMockingSetup.DoMockingSetupForIssueWriterModel();
            // Act
            var searchModel = mapper.MapToSearchModel(model.Object);

            // Assert
            Assert.Equal(model.Object.IssueId, searchModel.IssueId);
            Assert.Equal(model.Object.Issue?.CustomKey, searchModel.IssueCustomKey);
            Assert.Equal(model.Object.Issue?.ApiDetailUrl, searchModel.IssueApiDetailUrl);
            Assert.Equal(model.Object.Issue?.SiteDetailUrl, searchModel.IssueSiteDetailUrl);
            Assert.Equal(model.Object.Issue?.Name, searchModel.IssueName);
            Assert.Equal(model.Object.Issue?.ShortDescription, searchModel.IssueShortDescription);
            Assert.Equal(model.Object.Issue?.Description, searchModel.IssueDescription);
            Assert.Equal(model.Object.WriterId, searchModel.WriterId);
            Assert.Equal(model.Object.Writer?.CustomKey, searchModel.WriterCustomKey);
            Assert.Equal(model.Object.Writer?.ApiDetailUrl, searchModel.WriterApiDetailUrl);
            Assert.Equal(model.Object.Writer?.SiteDetailUrl, searchModel.WriterSiteDetailUrl);
            Assert.Equal(model.Object.Writer?.Name, searchModel.WriterName);
            Assert.Equal(model.Object.Writer?.ShortDescription, searchModel.WriterShortDescription);
            Assert.Equal(model.Object.Writer?.Description, searchModel.WriterDescription);
        }