コード例 #1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new ProfileMapper();
            var model  = ProfilesMockingSetup.DoMockingSetupForProfileModel(1);
            var entity = ProfilesMockingSetup.DoMockingSetupForProfile(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
コード例 #2
0
 public void Verify_MapToModelLite_AssignsLiteOnlyProfileProperties()
 {
     // Arrange
     var mapper = new ProfileMapper();
     var entity = ProfilesMockingSetup.DoMockingSetupForProfile();
     // Act
     var model = mapper.MapToModelLite(entity.Object);
     // Assert
     // <None>
     // Related Objects
     // <None>
 }
コード例 #3
0
        public void Verify_MapToModelListingExtension_CallsMapToModel()
        {
            // Arrange
            var mockMapper = new Mock <ProfileMapper>();

            mockMapper.Setup(x => x.MapToModelListing(It.IsAny <IProfile>(), It.IsAny <int>()));
            var mockEntity = ProfilesMockingSetup.DoMockingSetupForProfile(1);

            ProfileMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockEntity.Object.MapToModelListing();
            // Assert
            mockMapper.Verify(x => x.MapToModelListing(It.IsAny <IProfile>(), It.IsAny <int>()), Times.Once);
        }
コード例 #4
0
        public void Verify_MapToModel_AssignsProfileProperties()
        {
            // Arrange
            var mapper = new ProfileMapper();
            var entity = ProfilesMockingSetup.DoMockingSetupForProfile();
            // Act
            var model = mapper.MapToModel(entity.Object);

            // Assert
            // <None>
            // 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 <ProfileMapper>();

            mockMapper.Setup(x => x.AreEqual(It.IsAny <IProfileModel>(), It.IsAny <IProfile>()));
            ProfileMapperExtensions.OverrideMapper(mockMapper.Object);
            var mockModel  = ProfilesMockingSetup.DoMockingSetupForProfileModel(1);
            var mockEntity = ProfilesMockingSetup.DoMockingSetupForProfile(1);

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