Esempio n. 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);
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        public void Verify_MapToModelListingExtension_CallsMapToModel()
        {
            // Arrange
            var mockMapper = new Mock <IssueWriterMapper>();

            mockMapper.Setup(x => x.MapToModelListing(It.IsAny <IIssueWriter>(), It.IsAny <int>()));
            var mockEntity = IssueWritersMockingSetup.DoMockingSetupForIssueWriter(1);

            IssueWriterMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockEntity.Object.MapToModelListing();
            // Assert
            mockMapper.Verify(x => x.MapToModelListing(It.IsAny <IIssueWriter>(), It.IsAny <int>()), Times.Once);
        }
Esempio n. 4
0
        public void Verify_AreEqualExtension_CallsAreEqual()
        {
            // Arrange
            var mockMapper = new Mock <IssueWriterMapper>();

            mockMapper.Setup(x => x.AreEqual(It.IsAny <IIssueWriterModel>(), It.IsAny <IIssueWriter>()));
            IssueWriterMapperExtensions.OverrideMapper(mockMapper.Object);
            var mockModel  = IssueWritersMockingSetup.DoMockingSetupForIssueWriterModel(1);
            var mockEntity = IssueWritersMockingSetup.DoMockingSetupForIssueWriter(1);

            // Act
            mockModel.Object.AreEqual(mockEntity.Object);
            // Assert
            mockMapper.Verify(x => x.AreEqual(It.IsAny <IIssueWriterModel>(), It.IsAny <IIssueWriter>()), Times.Once);
        }