main
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using Machine.Specifications;
5using solidware.financials.service.domain.property_bag;
6
7namespace specs.unit.service.domain.property_bag
8{
9 public class PropertyBagSpecs
10 {
11 public abstract class concern
12 {
13 Establish context = () =>
14 {
15 sut = Bag.For<TargetType>();
16 };
17
18 static protected PropertyBag sut;
19 }
20
21 [Concern(typeof (PropertyBag))]
22 public class when_creating_a_property_bag_from_a_known_type : concern
23 {
24 It should_include_each_property_from_the_target_type = () =>
25 {
26 sut.property_named("name").should_not_be_null();
27 };
28
29 Establish c = () => { Console.Out.WriteLine("blah");};
30
31 It should_not_contain_properties_that_are_not_on_the_target_type = () =>
32 {
33 sut.property_named("blah").should_be_an_instance_of<UnknownProperty>();
34 };
35 }
36
37 [Concern(typeof (PropertyBag))]
38 public class when_iterating_through_each_property_in_the_bag : concern
39 {
40 Establish c = () => Console.Out.WriteLine("init when_iterating_through_each_property_in_the_bag");
41
42 It should_contain_a_reference_for_each_property_on_the_target_type = () =>
43 {
44 results.Count().should_be_equal_to(1);
45 };
46
47 Because b = () =>
48 {
49 results = sut.all();
50 };
51
52 static IEnumerable<Property> results;
53 }
54 }
55
56 public class TargetType
57 {
58 public string name { get; set; }
59 }
60}