Ejemplo n.º 1
0
        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 An_Option_Is_Set()
        {
            var configuration = PizzaConfigurationBuilder.BuildWithNoSetOptions();

            var optionsSetter = new ConfigurationItemOptionsSetter();

            var size = configuration.ConfigurationItems.FirstOrDefault(i => i.Name.Equals("Size"));

            Assert.IsNotNull(size);

            var largeOption =
                size.ConfigurationItemOptions.FirstOrDefault(
                    o => o.Name.Equals("Large", StringComparison.OrdinalIgnoreCase));

            Assert.IsNotNull(largeOption);

            Assert.IsFalse(largeOption.IsSelected);

            optionsSetter.SetOrUnSet(configuration.ConfigurationItems, "Size", "Large", true);

            Assert.IsTrue(largeOption.IsSelected);
        }