Beispiel #1
0
 protected override void Context()
 {
     _context         = A.Fake <IMoBiContext>();
     _buildingBlock   = A.Fake <IBuildingBlock>();
     _observerBuilder = new ContainerObserverBuilder();
     sut = new TagTask(_context);
     _commandParameters = new TagConditionCommandParameters <IObserverBuilder>
     {
         BuildingBlock = _buildingBlock,
         DescriptorCriteriaRetriever = x => x.ContainerCriteria,
         TaggedObject = _observerBuilder
     };
 }
        private void checkDescriptorCriteria <T>(T taggedObject, Func <T, DescriptorCriteria> descriptorCriteriaRetriever) where T : class, IObjectBase
        {
            foreach (var tagCondition in descriptorCriteriaRetriever(taggedObject).OfType <ITagCondition>())
            {
                if (!string.Equals(tagCondition.Tag, _oldName))
                {
                    continue;
                }

                var commandParameters = new TagConditionCommandParameters <T> {
                    TaggedObject = taggedObject, BuildingBlock = _buildingBlock, DescriptorCriteriaRetriever = descriptorCriteriaRetriever
                };
                _changes.Add(taggedObject, _buildingBlock, new EditTagCommand <T>(_newName, _oldName, commandParameters));
            }
        }
Beispiel #3
0
        private IMoBiCommand getRemoveCommand <T>(string tag, TagType tagType, TagConditionCommandParameters <T> tagConditionCommandParameters) where T : class, IObjectBase
        {
            switch (tagType)
            {
            case TagType.MatchAll:
                return(new RemoveMatchAllConditionCommand <T>(tagConditionCommandParameters));

            case TagType.Match:
                return(new RemoveMatchTagConditionCommand <T>(tag, tagConditionCommandParameters));

            case TagType.NotMatch:
                return(new RemoveNotMatchTagConditionCommand <T>(tag, tagConditionCommandParameters));

            case TagType.InContainer:
                return(new RemoveInContainerConditionCommand <T>(tag, tagConditionCommandParameters));

            case TagType.NotInContainer:
                return(new RemoveNotInContainerConditionCommand <T>(tag, tagConditionCommandParameters));

            default:
                throw new ArgumentOutOfRangeException(nameof(tagType));
            }
        }
Beispiel #4
0
 public IMoBiCommand EditOperator <T>(CriteriaOperator newOperator, TagConditionCommandParameters <T> tagConditionCommandParameters) where T : class, IObjectBase
 {
     return(new EditOperatorCommand <T>(newOperator, tagConditionCommandParameters).Run(_context));
 }
Beispiel #5
0
 public IMoBiCommand EditTag <T>(string newTag, string oldTag, TagConditionCommandParameters <T> tagConditionCommandParameters) where T : class, IObjectBase
 {
     return(new EditTagCommand <T>(newTag, oldTag, tagConditionCommandParameters).Run(_context));
 }
Beispiel #6
0
 public IMoBiCommand AddTagCondition <T>(string tag, TagType tagType, TagConditionCommandParameters <T> tagConditionCommandParameters) where T : class, IObjectBase
 {
     return(getAddCommand(tag, tagType, tagConditionCommandParameters).Run(_context));
 }