コード例 #1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new OriginMapper();
            var model  = OriginsMockingSetup.DoMockingSetupForOriginModel(1);
            var entity = OriginsMockingSetup.DoMockingSetupForOrigin(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
コード例 #2
0
        public void Verify_MapToModelLite_AssignsLiteOnlyOriginProperties()
        {
            // Arrange
            var mapper = new OriginMapper();
            var entity = OriginsMockingSetup.DoMockingSetupForOrigin();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            Assert.Equal(entity.Object.CharacterSet, model.CharacterSet);
            // Related Objects
            // <None>
        }
コード例 #3
0
        public void Verify_MapToModelListingExtension_CallsMapToModel()
        {
            // Arrange
            var mockMapper = new Mock <OriginMapper>();

            mockMapper.Setup(x => x.MapToModelListing(It.IsAny <IOrigin>(), It.IsAny <int>()));
            var mockEntity = OriginsMockingSetup.DoMockingSetupForOrigin(1);

            OriginMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockEntity.Object.MapToModelListing();
            // Assert
            mockMapper.Verify(x => x.MapToModelListing(It.IsAny <IOrigin>(), It.IsAny <int>()), Times.Once);
        }
コード例 #4
0
        public void Verify_MapToModel_AssignsOriginProperties()
        {
            // Arrange
            var mapper = new OriginMapper();
            var entity = OriginsMockingSetup.DoMockingSetupForOrigin();
            // Act
            var model = mapper.MapToModel(entity.Object);

            // Assert
            Assert.Equal(entity.Object.CharacterSet, model.CharacterSet);
            // Related Objects
            // <None>
            // Associated Objects
            Assert.Equal(entity.Object.OriginProfiles?.Count, model.OriginProfiles?.Count);
        }
コード例 #5
0
        public void Verify_AreEqualExtension_CallsAreEqual()
        {
            // Arrange
            var mockMapper = new Mock <OriginMapper>();

            mockMapper.Setup(x => x.AreEqual(It.IsAny <IOriginModel>(), It.IsAny <IOrigin>()));
            OriginMapperExtensions.OverrideMapper(mockMapper.Object);
            var mockModel  = OriginsMockingSetup.DoMockingSetupForOriginModel(1);
            var mockEntity = OriginsMockingSetup.DoMockingSetupForOrigin(1);

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