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 void An_InComplete_Instance_Returns_Errors() { var configuration = PizzaConfigurationBuilder.BuildWithNoSetOptions(); var checker = new ConfigurationRulesChecker(); List <string> errors; checker.Check(configuration, out errors); Assert.IsNotEmpty(errors); }
public void A_Complete_Instance_Returns_No_Errors() { var configuration = PizzaConfigurationBuilder.BuildCompleteInstance(); var checker = new ConfigurationRulesChecker(); List <string> errors; checker.Check(configuration, out errors); Assert.IsEmpty(errors); }
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); }