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)); } }
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)); } }
public IMoBiCommand EditOperator <T>(CriteriaOperator newOperator, TagConditionCommandParameters <T> tagConditionCommandParameters) where T : class, IObjectBase { return(new EditOperatorCommand <T>(newOperator, tagConditionCommandParameters).Run(_context)); }
public IMoBiCommand EditTag <T>(string newTag, string oldTag, TagConditionCommandParameters <T> tagConditionCommandParameters) where T : class, IObjectBase { return(new EditTagCommand <T>(newTag, oldTag, tagConditionCommandParameters).Run(_context)); }
public IMoBiCommand AddTagCondition <T>(string tag, TagType tagType, TagConditionCommandParameters <T> tagConditionCommandParameters) where T : class, IObjectBase { return(getAddCommand(tag, tagType, tagConditionCommandParameters).Run(_context)); }