Exemplo n.º 1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new ObjectAliasMapper();
            var model  = ObjectAliasesMockingSetup.DoMockingSetupForObjectAliasModel(1);
            var entity = ObjectAliasesMockingSetup.DoMockingSetupForObjectAlias(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
Exemplo n.º 2
0
        public void Verify_MapToModelLite_AssignsLiteOnlyObjectAliasProperties()
        {
            // Arrange
            var mapper = new ObjectAliasMapper();
            var entity = ObjectAliasesMockingSetup.DoMockingSetupForObjectAlias();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.ObjectId, model.ObjectId);
        }
Exemplo n.º 3
0
        public void Verify_MapToEntityExtension_CallsMapToEntity()
        {
            // Arrange
            var mockMapper = new Mock <ObjectAliasMapper>();

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <IObjectAliasModel>(), It.IsAny <int>()));
            var mockModel = ObjectAliasesMockingSetup.DoMockingSetupForObjectAliasModel(1);

            ObjectAliasMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <IObjectAliasModel>(), It.IsAny <int>()), Times.Once);
        }
Exemplo n.º 4
0
        public void Verify_MapToEntity_AssignsObjectAliasProperties()
        {
            // Arrange
            var mapper = new ObjectAliasMapper();
            var model  = ObjectAliasesMockingSetup.DoMockingSetupForObjectAliasModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.ObjectId, entity.ObjectId);
            // Associated Objects
            // <None>
        }
Exemplo n.º 5
0
        public void Verify_MapToSearchModel_AssignsObjectAliasSearchProperties()
        {
            // Arrange
            var mapper = new ObjectAliasMapper();
            var model  = ObjectAliasesMockingSetup.DoMockingSetupForObjectAliasModel();
            // Act
            var searchModel = mapper.MapToSearchModel(model.Object);

            // Assert
            Assert.Equal(model.Object.ObjectId, searchModel.ObjectId);
            Assert.Equal(model.Object.Object?.CustomKey, searchModel.ObjectCustomKey);
            Assert.Equal(model.Object.Object?.ApiDetailUrl, searchModel.ObjectApiDetailUrl);
            Assert.Equal(model.Object.Object?.SiteDetailUrl, searchModel.ObjectSiteDetailUrl);
            Assert.Equal(model.Object.Object?.Name, searchModel.ObjectName);
            Assert.Equal(model.Object.Object?.ShortDescription, searchModel.ObjectShortDescription);
            Assert.Equal(model.Object.Object?.Description, searchModel.ObjectDescription);
        }