Beispiel #1
0
 public void Verify_MapToSearchModel_AssignsProfileSearchProperties()
 {
     // Arrange
     var mapper = new ProfileMapper();
     var model  = ProfilesMockingSetup.DoMockingSetupForProfileModel();
     // Act
     var searchModel = mapper.MapToSearchModel(model.Object);
     // Assert
 }
Beispiel #2
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);
        }
Beispiel #3
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>
 }
Beispiel #4
0
        public void Verify_MapToEntityExtension_CallsMapToEntity()
        {
            // Arrange
            var mockMapper = new Mock <ProfileMapper>();

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <IProfileModel>(), It.IsAny <int>()));
            var mockModel = ProfilesMockingSetup.DoMockingSetupForProfileModel(1);

            ProfileMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <IProfileModel>(), It.IsAny <int>()), Times.Once);
        }
Beispiel #5
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);
        }
Beispiel #6
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);
        }
Beispiel #7
0
        public void Verify_MapToEntity_AssignsProfileProperties()
        {
            // Arrange
            var mapper = new ProfileMapper();
            var model  = ProfilesMockingSetup.DoMockingSetupForProfileModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            // <None>
            // Related Objects
            // <None>
            // Associated Objects
            //Assert.Equal(model.Object.OriginProfiles?.Count, entity.OriginProfiles?.Count);
            model.VerifyGet(x => x.OriginProfiles, Times.Once);
        }