Get() public méthode

public Get ( string key ) : object
key string
Résultat object
        protected override IEnumerable<CellResult> execute(IWebElement element, StepValues values)
        {
            var handler = ElementHandlers.FindHandler(element);
            handler.EnterData(SearchContext, element, values.Get(Cell.Key));

            return new [] {CellResult.Ok(Cell.Key)};
        }
        public CellResult ProcessStep(StepValues step, ISpecContext context, object target)
        {
            var actual = step.Get(_property.Name);
            _property.SetValue(target, actual);

            return CellResult.Ok(_property.Name);
        }
        public void store_and_retrieve()
        {
            var values = new StepValues("1");

            values.Store("a", 1);
            values.Get("a").ShouldBe(1);
        }
        public void process_delayed_runtime_converters_successfully()
        {
            var context = SpecContext.ForTesting();
            var values = new StepValues("1");

            values.RegisterDelayedConversion("a", "1", new StubRuntimeConverter("1", 1));
            values.RegisterDelayedConversion("b", "2", new StubRuntimeConverter("2", 2));
            values.RegisterDelayedConversion("c", "3", new StubRuntimeConverter("3", 3));

            values.DoDelayedConversions(context);

            values.Get("a").ShouldBe(1);
            values.Get("b").ShouldBe(2);
            values.Get("c").ShouldBe(3);

            ShouldBeTestExtensions.ShouldBe(values.Errors.Any(), false);
        }
        protected override IEnumerable<CellResult> execute(IWebElement element, StepValues values)
        {
            var handler = ElementHandlers.FindHandler(element);
            var expectedValue = values.Get(Cell.Key);

            var matchingHandler = handler as IMatchingHandler ?? new BasicMatchingHandler(handler);
            if (matchingHandler.MatchesData(element, expectedValue))
            {
                return new [] { new CellResult(Cell.Key, ResultStatus.success) };
            }
            else
            {
                return new [] { new CellResult(Cell.Key, ResultStatus.failed){actual = handler.GetData(SearchContext, element)} };
            }
        }
Exemple #6
0
        public void use_a_runtime_converter_against_NULL()
        {
            var conversions = new Conversions();
            conversions.RegisterRuntimeConversion<ColorConverter>();
            var cellHandling = new CellHandling(new EquivalenceChecker(), conversions);

            var cell = new Cell(cellHandling, "color", typeof (Color));

            var values = new StepValues("foo");
            cell.ConvertValues(new Step("foo").With("color", "NULL"), values);

            values.Get("color").ShouldBeNull();
        }
Exemple #7
0
        public void cell_uses_the_default_for_conversion_when_no_value_exists()
        {
            var cell = Cell.For<CellTarget>(x => x.Number);
            cell.DefaultValue = "111";

            var values = new StepValues("foo");
            var step = new Step("key");
            //.With("Number", "a");

            cell.ConvertValues(step, values);

            values.Errors.Any().ShouldBe(false);
            values.Get("Number").ShouldBe(111);
        }