Beispiel #1
0
            public void Setup()
            {
                Given(Part_is_created);

                When("new Value part is created", () =>
                     newPart = new ValuePart(typeof(string)));
            }
            public void Setup()
            {
                Given(ObjectBuilder_is_created);

                And("parts for lists of customers are specified", () =>
                {
                    part             = new Part(typeof(List <Customer>));
                    var customerPart = new ValuePart(typeof(Customer));
                    customerPart.Describe(m => m.Count = 10);
                    customerPart.AddPart(new PropertyPart("Name", typeof(string))).
                    Describe(m =>
                    {
                        m.Data.Add("HumanName", HumanNameOptions.Name);
                    });

                    var ceoPart = new PropertyPart("CEO", typeof(Employee));
                    ceoPart.AddPart(new PropertyPart("Name", typeof(string))).
                    Describe(metadata =>
                             metadata.Data.Add("HumanName", HumanNameOptions.Name | HumanNameOptions.Surname));
                    customerPart.AddPart(ceoPart);
                    part.AddPart(customerPart);
                });

                When(build_object_graph);
            }
            public void Setup()
            {
                Given(ObjectBuilder_is_created);

                And("part for list of objects is specified", () =>
                {
                    part = new Part(typeof(List <Customer>));
                    var customer1Part = new ValuePart(typeof(Customer));
                    customer1Part.AddPart(new PropertyPart("CEO", typeof(Employee)));
                    var employeesPart = new PropertyPart("Employees", typeof(ObservableCollection <Employee>));
                    var employeePart  = new ValuePart(typeof(Employee));
                    employeePart.AddPart(new PropertyPart("Boss", typeof(Employee)));

                    employeesPart.AddPart(employeePart);
                    customer1Part.AddPart(employeesPart);

                    part.AddPart(customer1Part);
                    part.AddPart(new ValuePart(typeof(Customer)));
                });

                When(build_object_graph);
            }
 public TextValue(string value)
 {
     this.value = value;
     this.parts = ValuePart.From(value);
 }
Beispiel #5
0
        public void ReadValuePart(string value)
        {
            var part = new ValuePart(value);

            Assert.Equal(value, part.Text);
        }