/// <summary> /// Registers a new <see cref="Improvable" /> /// </summary> /// <param name="name">The name of the new improvable</param> /// <param name="recipe">The recipe type to associate with the new improvable</param> /// <param name="repository">The source control repository associated with the improvable</param> /// <param name="path">The path within the Source Control repository to the building artifact</param> public void Register(ImprovableName name, RecipeType recipe, RepositoryFullName repository, Path path) { if (_registered) { throw new ImprovableAlreadyRegistered($"An improvable with the Id '{this.EventSourceId.Value}' has already been registered"); } Apply(new ImprovableRegistered(this.EventSourceId, name, recipe, repository, path)); }
/// <inheritdoc /> public bool Exists(ImprovableName name) { if (_fileSystem.Exists(IMPROVABLES)) { var json = _fileSystem.ReadAllText(IMPROVABLES); var listings = _serializer.FromJson <IEnumerable <ImprovableForListing> >(json); return(listings.Any(_ => _.Name == name)); } else { return(false); } }
bool NotAlreadyBeInUse(ImprovableName name) { return(!_improvableNameExists(name)); }