public static Configuration BuildWithNoSetOptions() { var configurationBuilder = new PizzaConfigurationBuilder(); var configuration = configurationBuilder.Build(); return(configuration); }
private void ReadMeExample() { //Get our configuration for a pizza var configurationBuilder = new PizzaConfigurationBuilder(); var configuration = configurationBuilder.Build(); //Set our options var optionsSetter = new ConfigurationItemOptionsSetter(); optionsSetter.SetOrUnSet(configuration.ConfigurationItems, "Size", "Large", true); optionsSetter.SetOrUnSet(configuration.ConfigurationItems, "Crust", "Thick", true); optionsSetter.SetOrUnSet(configuration.ConfigurationItems, "Toppings", "Extra Cheese", true); optionsSetter.SetOrUnSet(configuration.ConfigurationItems, "Toppings", "Pepperoni", true); //Make sure the configuration is correct var checker = new ConfigurationRulesChecker(); List <string> errors; checker.Check(configuration, out errors); if (errors.Any()) { return; } //Export the results to JSON var exporter = new ConfigurationExporter(); var output = exporter.ExportToJson(configuration); }
public static Configuration BuildCompleteInstance() { var configurationBuilder = new PizzaConfigurationBuilder(); var configuration = configurationBuilder.Build(); var optionsSetter = new ConfigurationItemOptionsSetter(); optionsSetter.SetOrUnSet(configuration.ConfigurationItems, "Size", "Large", true); optionsSetter.SetOrUnSet(configuration.ConfigurationItems, "Crust", "Thick", true); optionsSetter.SetOrUnSet(configuration.ConfigurationItems, "Toppings", "Extra Cheese", true); optionsSetter.SetOrUnSet(configuration.ConfigurationItems, "Toppings", "Pepperoni", true); return(configuration); }
public static Configuration BuildCompleteInstance() { var configurationBuilder = new PizzaConfigurationBuilder(); var configuration = configurationBuilder.Build(); var optionsSetter = new ConfigurationItemOptionsSetter(); optionsSetter.SetOrUnSet(configuration.ConfigurationItems, "Size", "Large", true); optionsSetter.SetOrUnSet(configuration.ConfigurationItems, "Crust", "Thick", true); optionsSetter.SetOrUnSet(configuration.ConfigurationItems, "Toppings", "Extra Cheese", true); optionsSetter.SetOrUnSet(configuration.ConfigurationItems, "Toppings", "Pepperoni", true); return configuration; }
public static Configuration BuildWithNoSetOptions() { var configurationBuilder = new PizzaConfigurationBuilder(); var configuration = configurationBuilder.Build(); return configuration; }
private void ReadMeExample() { //Get our configuration for a pizza var configurationBuilder = new PizzaConfigurationBuilder(); var configuration = configurationBuilder.Build(); //Set our options var optionsSetter = new ConfigurationItemOptionsSetter(); optionsSetter.SetOrUnSet(configuration.ConfigurationItems, "Size", "Large", true); optionsSetter.SetOrUnSet(configuration.ConfigurationItems, "Crust", "Thick", true); optionsSetter.SetOrUnSet(configuration.ConfigurationItems, "Toppings", "Extra Cheese", true); optionsSetter.SetOrUnSet(configuration.ConfigurationItems, "Toppings", "Pepperoni", true); //Make sure the configuration is correct var checker = new ConfigurationRulesChecker(); List<string> errors; checker.Check(configuration, out errors); if (errors.Any()) { return; } //Export the results to JSON var exporter = new ConfigurationExporter(); var output = exporter.ExportToJson(configuration); }