Esempio n. 1
0
            public void Setup()
            {
                Given(ObjectBuilder_is_created);

                And("part for a complex object is specified", () =>
                {
                    part = new Part(typeof(Customer));
                    part.AddPart(new PropertyPart("CEO", typeof(Employee)));
                    var employeesProperty = new PropertyPart("Employees", typeof(ObservableCollection <Employee>));
                    part.AddPart(employeesProperty);

                    employeesProperty.AddPart(new ValuePart(typeof(Employee)));
                });

                When(build_object_graph);
            }
Esempio n. 2
0
            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);
            }
Esempio n. 3
0
            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);
            }
Esempio n. 4
0
            public void Setup()
            {
                Given(ObjectBuilder_is_created);
                And("recipe is specified", () =>
                {
                    part = new Part(typeof(List <string>));
                    part.AddPart(new ValuePart(typeof(string))).Describe(metadata =>
                    {
                        metadata.Count = 100;
                    });
                });

                When(build_object_graph);
            }
Esempio n. 5
0
            public void Setup()
            {
                Given(ObjectBuilder_is_created);
                And("recipe is specified", () =>
                {
                    part = new Part(typeof(List <string>));
                    part.AddPart(new ValuePart(typeof(string))).Describe(metadata =>
                    {
                        metadata.Count = 10;
                        metadata.Data.Add("HumanName", HumanNameOptions.Name | HumanNameOptions.Surname);
                    });
                });

                When("build object graph", () =>
                     names = objectBuilder.Build(part) as List <string>);
            }
Esempio n. 6
0
            public void Setup()
            {
                Given(ObjectBuilder_is_created);
                And("recipe is specified", () =>
                {
                    part = new Part(typeof(List <List <string> >));
                    part.AddPart(new ValuePart(typeof(List <string>))).Describe(metadata =>
                    {
                        metadata.Count = 10;
                        metadata.Part.AddPart(new ValuePart(typeof(string))).Describe(m =>
                        {
                            m.Count = 10;
                            m.Data.Add("HumanName", HumanNameOptions.Name);
                        });
                    });
                });

                When(build_object_graph);
            }