/// <summary> /// SetUp the default build properties. /// </summary> /// <param name="buildData">The incoming build data.</param> /// <returns>A new <see cref="BuildDataDictionary"/>, merged with the input <paramref name="buildData"/>.</returns> private static BuildDataDictionary SetUpBuildProperties(IBuildDataDictionary buildData) { var props = new BuildDataDictionary(); // ReadOnlyCollection foreach (var category in buildData.Data()) { foreach (var item in category.Value) { props.AddDataItem(category.Key, item.Key, item.Value); } // props.AddDataItem(item.Key, item,); } props.AddDataItem("DasGuuuut", new EmptyBuildParameters()); props.AddDataItem("EinTest", new StringConstantBuildParameter("Der Parameter!")); // Todo: !!! return(props); }
/// <summary> /// Get the parameters for the specified builder type, possibly creating it, if there /// is not yet one in the build data collection. /// </summary> /// <param name="builderType">Type of the builder to request a set of sample data for.</param> /// <param name="paraType">Type of the parameter class.</param> /// <param name="properties">The global properties storage.</param> /// <returns> /// A new instance of a matching parameter data set for the specified builder. /// </returns> /// <exception cref="KeyNotFoundException">The given <paramref name="builderType"/> was not present in the lookup.</exception> public IReadOnlyDictionary <string, IBuilderData> GetMultiParameters(Type builderType, Type paraType, IBuildDataDictionary properties) { Guard.NotNull(() => properties, properties); Guard.CanBeAssigned(() => paraType, paraType, typeof(IMultiBuildParameters)); //Guard.IsAssignableFrom<IMultiBuildParameters>(() => paraType, paraType); IReadOnlyDictionary <string, IBuilderData> category; var catfound = properties.Data().TryGetValue("Multi." + builderType.FullName, out category); if (catfound) { } return(category); //var paraInstance = Activator.CreateInstance(paraType); //var setupPara = (IMemberBuildParameters)paraInstance; //properties.AddDataItem(string.Empty + builderType.FullName, setupPara); //return setupPara; }
/// <summary> /// Get the parameters for the specified builder type, possibly creating it, if there /// is not yet one in the build data collection. /// </summary> /// <param name="key">The unique identifier of the parameter data set.</param> /// <param name="builderType">Type of the builder to request a set of sample data for.</param> /// <param name="paraType">Type of the parameter class.</param> /// <param name="properties">The global properties storage.</param> /// <returns> /// A new instance of a matching parameter data set for the specified builder. /// </returns> /// <exception cref="KeyNotFoundException">The given <paramref name="builderType"/> was not present in the lookup.</exception> public IMultiBuildParameters GetMultiParameter(Guid key, Type builderType, Type paraType, IBuildDataDictionary properties) { Guard.NotNull(() => properties, properties); Guard.CanBeAssigned(() => paraType, paraType, typeof(IMultiBuildParameters)); IBuilderData result; if (key == null || key == Guid.Empty) { key = Guid.NewGuid(); } else { IReadOnlyDictionary <string, IBuilderData> category; var catfound = properties.Data().TryGetValue("Multi." + builderType.FullName, out category); if (catfound) { var found = category.TryGetValue(key.ToString(), out result); if (found) { return(result as IMultiBuildParameters); } } } var paraInstance = Activator.CreateInstance(paraType); var setupPara = (IMultiBuildParameters)paraInstance; properties.AddDataItem("Multi." + builderType.FullName, key.ToString(), setupPara); setupPara.Id = key; return(setupPara); //var paraInstance = Activator.CreateInstance(paraType); //var setupPara = (IMemberBuildParameters)paraInstance; //properties.AddDataItem(string.Empty + builderType.FullName, setupPara); //return setupPara; }
/// <summary> /// Get the parameters for the specified builder type, possibly creating it, if there /// is not yet one in the build data collection. /// </summary> /// <param name="key">The unique identifier of the parameter data set.</param> /// <param name="builderType">Type of the builder to request a set of sample data for.</param> /// <param name="paraType">Type of the parameter class.</param> /// <param name="properties">The global properties storage.</param> /// <returns> /// A new instance of a matching parameter data set for the specified builder. /// </returns> /// <exception cref="KeyNotFoundException">The given <paramref name="builderType"/> was not present in the lookup.</exception> public IMultiBuildParameters GetMultiParameter(Guid key, Type builderType, Type paraType, IBuildDataDictionary properties) { Guard.NotNull(() => properties, properties); Guard.CanBeAssigned(()=> paraType, paraType, typeof(IMultiBuildParameters)); IBuilderData result; if (key == null || key == Guid.Empty) { key = Guid.NewGuid(); } else { IReadOnlyDictionary<string, IBuilderData> category; var catfound = properties.Data().TryGetValue("Multi." + builderType.FullName, out category); if (catfound) { var found = category.TryGetValue(key.ToString(), out result); if (found) { return result as IMultiBuildParameters; } } } var paraInstance = Activator.CreateInstance(paraType); var setupPara = (IMultiBuildParameters)paraInstance; properties.AddDataItem("Multi." + builderType.FullName, key.ToString(), setupPara); setupPara.Id = key; return setupPara; //var paraInstance = Activator.CreateInstance(paraType); //var setupPara = (IMemberBuildParameters)paraInstance; //properties.AddDataItem(string.Empty + builderType.FullName, setupPara); //return setupPara; }
/// <summary> /// Get the parameters for the specified builder type, possibly creating it, if there /// is not yet one in the build data collection. /// </summary> /// <param name="builderType">Type of the builder to request a set of sample data for.</param> /// <param name="paraType">Type of the parameter class.</param> /// <param name="properties">The global properties storage.</param> /// <returns> /// A new instance of a matching parameter data set for the specified builder. /// </returns> /// <exception cref="KeyNotFoundException">The given <paramref name="builderType"/> was not present in the lookup.</exception> public IReadOnlyDictionary<string, IBuilderData> GetMultiParameters(Type builderType, Type paraType, IBuildDataDictionary properties) { Guard.NotNull(() => properties, properties); Guard.CanBeAssigned(() => paraType, paraType, typeof(IMultiBuildParameters)); //Guard.IsAssignableFrom<IMultiBuildParameters>(() => paraType, paraType); IReadOnlyDictionary<string, IBuilderData> category; var catfound = properties.Data().TryGetValue("Multi." + builderType.FullName, out category); if (catfound) { } return category; //var paraInstance = Activator.CreateInstance(paraType); //var setupPara = (IMemberBuildParameters)paraInstance; //properties.AddDataItem(string.Empty + builderType.FullName, setupPara); //return setupPara; }