/// <summary> /// Gets the forbidden names for the given object, from the local list the objects name is removed. /// This is done to ensure that an already added objects name is not considered as forbidden, for the object itself. /// </summary> /// <param name="objectBase">The object base for which we get the forbidden Names.</param> /// <returns> The forbidden names.</returns> public IEnumerable <string> GetForbiddenNamesWithoutSelf(T objectBase) { var unallowedNames = GetUnallowedNames(objectBase).ToList(); // only remove objects name here to be sure that the same name is not used for a complicating object anywhere else unallowedNames.Remove(objectBase.Name); return(unallowedNames.Union(_interactionTask.ForbiddenNamesFor(objectBase))); }
protected override void Context() { _interactionTaskContext = A.Fake <IInteractionTaskContext>(); _interactionTask = A.Fake <IInteractionTask>(); A.CallTo(() => _interactionTaskContext.InteractionTask).Returns(_interactionTask); _builder = new ApplicationBuilder(); sut = new EditTasksForEventGroupBuilder <IApplicationBuilder>(_interactionTaskContext); A.CallTo(() => _interactionTask.ForbiddenNamesFor(_builder)).Returns(new List <string> { _builderName }); }
public IEnumerable <string> GetForbiddenNames(T objectBase, IEnumerable <IObjectBase> existingObjectsInParent) { var unallowedNames = GetUnallowedNames(objectBase, existingObjectsInParent).ToList(); return(unallowedNames.Union(_interactionTask.ForbiddenNamesFor(objectBase))); }