コード例 #1
0
        public void ProcessEntity()
        {
            EntityWrapper entity        = new EntityWrapper(new Entity());
            int           passNumber    = 1;
            int           maxPassNumber = 3;

            systemUnderTest = new ObjectTypeCodeProcessor(objectTypeCodeMappingConfig, MockLogger.Object, MockEntityRepo.Object);

            FluentActions.Invoking(() => systemUnderTest.ProcessEntity(entity, passNumber, maxPassNumber))
            .Should()
            .NotThrow();
        }
コード例 #2
0
        public void ProcessEntityEntityWhichHasMapFieldButDoesntHaveOneOfMapValuesShouldNotUpdateTheEntitiesAttributes()
        {
            ObjectTypeCodeMappingConfiguration config = CreateConfiguration("cap_testentity", 10113, "cap_testfield");

            systemUnderTest = new ObjectTypeCodeProcessor(config, MockLogger.Object, MockEntityRepo.Object);

            string expectedFieldName  = "cap_testfield";
            int    expectedFieldValue = 10222;
            Entity entity             = new Entity("cap_testentity");

            entity.Attributes.Add(expectedFieldName, expectedFieldValue);
            EntityWrapper entityWrapper = new EntityWrapper(entity);

            systemUnderTest.ProcessEntity(entityWrapper, 0, 1);

            Assert.AreEqual(expectedFieldValue, entityWrapper.OriginalEntity[expectedFieldName]);
        }
コード例 #3
0
        public void ProcessEntityEntityWhichHasFieldToMapShouldCallTheRepoToGetEntityTypeCode()
        {
            string expectedEntity     = "cap_testentity";
            string expectedFieldName  = "cap_testfield";
            int    expectedFieldValue = 10113;

            var config = CreateConfiguration(expectedEntity, 10113, expectedFieldName);

            systemUnderTest = new ObjectTypeCodeProcessor(config, MockLogger.Object, MockEntityRepo.Object);

            Entity entity = new Entity(expectedEntity);

            entity.Attributes.Add(expectedFieldName, expectedFieldValue);
            EntityWrapper entityWrapper = new EntityWrapper(entity);

            InitRepoToReturnMetaData(expectedEntity);

            systemUnderTest.ProcessEntity(entityWrapper, 0, 1);

            MockEntityRepo.Verify(repo => repo.GetEntityMetadataCache.GetEntityMetadata(expectedEntity), Times.Once);
        }