コード例 #1
0
        public TestDataGeneratorConstraintsSpeck()
        {
            Specify(x =>
                    TestDataGenerator.Create <ClassWithConstraints> (MaxRecursionDepth, null))
            .Case("should fill", _ => _
                  .Given(NullModifierContext())
                  .It("long name considering MinLength attribute", x =>
                      x.Result.LongName.Length.Should().BeGreaterOrEqualTo(10000))
                  .It("short name considering MaxLength attribute", x => x.Result.ShortName.Length.Should().BeLessOrEqualTo(1))
                  .It("medium name considering Min and MaxLength attribute", x => x.Result.MediumName.Length.Should().BeInRange(10, 20))
                  .It("ranged name considering StringLength attribute", x => x.Result.RangedName.Length.Should().BeInRange(10, 100))
                  .It("ranged number considering Range attribute", x => x.Result.RangedNumber.Should().BeInRange(10, 100))
                  .It("required prop considering Required attribute", x => x.Result.RequiredProp.Should().NotBeNull())
                  .It("other prop considering no attribute", x => x.Result.OtherProp.Should().BeNull()));

            Specify(x =>
                    TestDataGenerator.Create <ClassWithInvalidStringLengthConstraint> (MaxRecursionDepth, null))
            .Case("should raise argument out of range exception", _ => _
                  .Given(BaseDomainContext())
                  .ItThrows(typeof(NotSupportedException), "Could not auto-fill Farada.TestDataGeneration.IntegrationTests.TestDomain.ClassWithInvalidStringLengthConstraint (member InvalidRangedName). Please provide a value provider")
                  .ItThrowsContainsInner(typeof(ArgumentOutOfRangeException),
                                         "On the member System.String InvalidRangedName the StringLength attribute has an invalid range"));

            Specify(x =>
                    TestDataGenerator.Create <ClassWithInvalidRangeConstraint> (MaxRecursionDepth, null))
            .Case("should raise argument exception", _ => _
                  .Given(BaseDomainContext())
                  .ItThrows(typeof(NotSupportedException), "Could not auto-fill Farada.TestDataGeneration.IntegrationTests.TestDomain.ClassWithInvalidRangeConstraint (member InvalidRangedNumber). Please provide a value provider")
                  .ItThrowsContainsInner(typeof(ArgumentOutOfRangeException),
                                         "On the member System.Int32 InvalidRangedNumber the Range attribute has an invalid range"));
        }
コード例 #2
0
        public TestDataGeneratorReflectiveFillingSpeck()
        {
            Specify(x =>
                    //here we use the Type based approached (compatible with System.Reflection).
                    TestDataGenerator.Create(typeof(Universe), MaxRecursionDepth, null)
                    )
            .Case("should fill normal property", _ => _
                  .Given(SimpleStringContext())
                  .It("fills properties via reflection",
                      //we have to cast the result, as it is reflection based...
                      x => ((Universe)x.Result).Galaxy1.StarSystem1.Planet1.President.Name.Should().Be("SomeString")));

            Specify(x =>
                    TestDataGenerator.Create(typeof(ClassWithNullableInt), MaxRecursionDepth, null)
                    )
            .Case("should fill nullable property", _ => _
                  .Given(NullableIntContext())
                  .It("fills properties via reflection",
                      //we have to cast the result, as it is reflection based...
                      x => ((ClassWithNullableInt)x.Result).NullableInt.Should().Be(4)))
            .Case("should fill nullable property with null", _ => _
                  .Given(NullableIntNullContext())
                  .It("fills properties via reflection",
                      //we have to cast the result, as it is reflection based...
                      x => ((ClassWithNullableInt)x.Result).NullableInt.Should().Be(null)));
        }
コード例 #3
0
        public TestDataGeneratorCustomContextSpeck()
        {
            Specify(x =>
                    TestDataGenerator.Create <int> (MaxRecursionDepth, null))
            .Case("should fill all according to context1", _ => _
                  .Given(CustomContext(20))
                  .It("should fill int", x => x.Result.Should().Be(20)));

            Specify(x =>
                    TestDataGenerator.Create <ClassWithAttribute> (MaxRecursionDepth, null))
            .Case("should fill all according to context2", _ => _
                  .Given(CustomAttributeContext(20))
                  .It("should fill int", x => x.Result.AttributedInt.Should().Be(31)));
        }
コード例 #4
0
 public TestDataGeneratorImmutabilitySpeck()
 {
     Specify(x => TestDataGenerator.Create <ImmutableIce> (MaxRecursionDepth, null))
     .Case("Properties Are Initialized", _ => _
           .Given(ConfigurationContext(cfg =>
                                       cfg.UseDefaults(false)
                                       .For <ImmutableIce> ().AddProvider(new DefaultInstanceValueProvider <ImmutableIce> ())
                                       .Select(ice => ice.Origin).AddProvider(f => "FixedOrigin") //IDEA - ForCtorArg("origin")
                                       .Select(ice => ice.Temperature).AddProvider(f => - 100)))
           .It("initialized first property correctly", x => x.Result.Origin.Should().Be("FixedOrigin"))
           .It("initialized second property correctly", x => x.Result.Temperature.Should().Be(-100)))
     .Case("No value providers defined", _ => _
           .Given(ConfigurationContext(cfg =>
                                       cfg.UseDefaults(false)
                                       .For <ImmutableIce> ().AddProvider(new DefaultInstanceValueProvider <ImmutableIce> ())))
           .ItThrows(typeof(MissingValueProviderException),
                     "No value provider registered for \"Farada.TestDataGeneration.IntegrationTests.TestDomain.ImmutableIce.Origin\""));
 }
コード例 #5
0
        public TestDataGeneratorTypeExtensionSpeck()
        {
            Specify(x =>
                    TestDataGenerator.Create <ClassWithVeryPropertyToArgConversion> (MaxRecursionDepth, null))
            .Case("should fill class according to custom parameter to property conversion", _ => _
                  .Given(ValueProviderCustomConversion())
                  .It("should fill name through argument", x => x.Result.Name.Should().Be("NameThroughValue")));

            Specify(x =>
                    TestDataGenerator.Create <ClassWithAttribute> (MaxRecursionDepth, null))
            .Case("should fill class according to extended attributes", _ => _
                  .Given(ValueProviderWithExtendedAttributes(new ClassWithAttribute.CoolIntAttribute(10)))
                  .It("should fill attributed int through extended attributes", x => x.Result.AttributedInt.Should().Be(21)));

            Specify(x =>
                    TestDataGenerator.Create <ImmutableIce> (MaxRecursionDepth, null))
            .Case("should fill immutable class according to extended attributes", _ => _
                  .Given(ValueProviderForImmutableClassWithExtendedAttributes(new ClassWithAttribute.CoolIntAttribute(100)))
                  .It("should fill temperature through extended attributes", x => x.Result.Temperature.Should().Be(100)));
        }
コード例 #6
0
        public TestDataGeneratorSubTypeSpeck()
        {
            Specify(x =>
                    TestDataGenerator.Create <LandVehicle> (MaxRecursionDepth, null))
            .Case("should fill all according to context1", _ => _
                  .Given(ValueProviderSubTypeContext())
                  .It("should fill tire diameter", x => x.Result.Tire.Diameter.Should().Be(10)));

            Specify(x =>
                    TestDataGenerator.Create <AirVehicle> (MaxRecursionDepth, null))
            .Case("should fill all according to context2", _ => _
                  .Given(ValueProviderSubTypeContext())
                  .It("should fill jet engine fuel per second", x => ((JetEngine)x.Result.Engine).FuelUsePerSecond.Should().Be(20)));

            Specify(x =>
                    TestDataGenerator.Create <LandVehicle> (MaxRecursionDepth, null))
            .Case("should throw when creating LandVehicle", _ => _
                  .Given(VehicleOnlyValueProviderContext())
                  .ItThrows(typeof(MissingValueProviderException), "No value provider registered for \"LandVehicle\""));

            Specify(x =>
                    TestDataGenerator.Create <AirVehicle> (MaxRecursionDepth, null))
            .Case("should throw when creating AirVehicle", _ => _
                  .Given(VehicleOnlyValueProviderContext())
                  .ItThrows(typeof(MissingValueProviderException), "No value provider registered for \"AirVehicle\""));


            Specify(x =>
                    TestDataGenerator.Create <CustomVehicle> (MaxRecursionDepth, null))
            .Case("should fill unwrappable nullabe", _ => _
                  .Given(ValueProviderNullableSubTypeContext(vectorId: "SomeVector"))
                  .It("should fill current direction",
                      x => x.Result.CurrentDirection.Should().Be(new Vector {
                Id = "SomeVector"
            })));
        }
コード例 #7
0
        public TestDataGeneratorEdgeCaseSpeck()
        {
            Specify(x => TestDataGenerator.Create <ClassWithList> (MaxRecursionDepth, null))
            .Case("Properties Are Initialized", _ => _
                  .Given(ConfigurationContext(cfg =>
                                              cfg.UseDefaults(false)
                                              .For <ClassWithList> ().AddProvider(new DefaultInstanceValueProvider <ClassWithList> ())
                                              .For <IList <int> > ().AddProvider(f => new List <int> {
                0, 1, 2, 3
            })))
                  .It("initialized first list correctly", x => x.Result.IntegerList.Should().BeEquivalentTo(new[] { 0, 1, 2, 3 })));

            Specify(x =>
                    TestDataGenerator.Create <ClassWithInterfacedMembers> (MaxRecursionDepth, null))
            .Case("Interfaced Properties Are Initialized", _ => _
                  .Given(ConfigurationContext(cfg =>
                                              cfg.UseDefaults(false)
                                              .For <ClassWithInterfacedMembers> ().AddProvider(new DefaultInstanceValueProvider <ClassWithInterfacedMembers> ())
                                              .For <InterfacedClass> ().AddProvider(new DefaultInstanceValueProvider <InterfacedClass> ())
                                              .For <IInterface> ().Select(i => i.Name).AddProvider(ctx => "IInterfaced - Name")
                                              .For <DerivedInterfacedClass> ().Select(d => d.Value).AddProvider(ctx => "My Value")
                                              .For <DerivedInterfacedClass> ().Select(d => d.Name).AddProvider(ctx => "Derived + " + ctx.GetPreviousValue())))
                  .It("initialized interfaced class according to interface registration",
                      x => x.Result.InterfacedClass.Name.Should().Be("IInterfaced - Name"))
                  .It("initialized derived interfaced class according to interface registration",
                      x => x.Result.DerivedInterfacedClass.Name.Should().Be("Derived + IInterfaced - Name"))
                  .It("initialized derived interfaced class value according to it's registration",
                      x => x.Result.DerivedInterfacedClass.Value.Should().Be("My Value")));

            Specify(x => "empty")
            .Case("should throw exception for methods", _ => _
                  .Given(ConfigurationContext(c => c.For <ClassWithVariousMembers> ().Select(y => y.PublicMethod()).AddProvider(dummy => "")))
                  .It("ex", x => CreationException.Should().BeOfType <NotSupportedException> ())
                  .It("ex",
                      x => CreationException.Message.Should().Be("Empty chains / Non-member chains are not supported, please use AddProvider<T>()")))
            .Case("should throw exception for types", _ => _
                  .Given(ConfigurationContext(c => c.For <ClassWithVariousMembers> ().Select(y => y).AddProvider(dummy => null)))
                  .It("ex", x => CreationException.Should().BeOfType <NotSupportedException> ())
                  .It("ex",
                      x => CreationException.Message.Should().Be("Empty chains / Non-member chains are not supported, please use AddProvider<T>()")));


            Specify(x =>
                    TestDataGenerator.Create <ClassWithVariousMembers> (MaxRecursionDepth, null))
            .Case("should throw exception for setting the value of a get only member", _ => _
                  .Given(ConfigurationContext(c => c.For <ClassWithVariousMembers> ().Select(y => y.GetOnlyProperty).AddProvider(dummy => "content")))
                  .It("GetOnlyProperty should be null", x => x.Result.GetOnlyProperty.Should().BeNull()));


            Specify(x =>
                    TestDataGenerator.Create <BaseClassWithProtectedProperty> (MaxRecursionDepth, null))
            .Case("should use value provider for base type OverrideMe property and ignore sub type", _ => _
                  .Given(NewPropertiesContext())
                  .It("it assigns correct value", x => x.Result.OverrideMe.Should().Be("BaseValue")));

            Specify(x =>
                    TestDataGenerator.Create <ClassOveridingPropertyWithNewType> (MaxRecursionDepth, null))
            .Case("should use value provider for sub type and ignore base type", _ => _
                  .Given(NewPropertiesContext())
                  .It("it assigns correct value", x => x.Result.OverrideMe.Should().Be(103)));

            Specify(x =>
                    TestDataGenerator.Create <ClassOveridingPropertyWithNewType> (MaxRecursionDepth, null))
            .Case("should ignore base type and use generic int provider", _ => _
                  .Given(NewPropertiesBaseClassAndFixedInt())
                  .It("it uses generic int provider", x => x.Result.OverrideMe.Should().Be(3)));

            Specify(x =>
                    TestDataGenerator.Create <ClassOveridingPropertyWithNewType> (MaxRecursionDepth, null))
            .Case("when using previous value should ignore base type", _ => _
                  .Given(NewPropertiesContextUsingPreviousValue())
                  .It("it ignores base type and uses generic int provider", x => x.Result.OverrideMe.Should().Be(4)));


            Specify(x =>
                    TestDataGenerator.Create <ClassAddingAttributes> (MaxRecursionDepth, null))
            .Case("should fill property with last added provider", _ => _
                  .Given(AttributeFillerContext())
                  .It("it assigns correct value", x => x.Result.SomeAttributedProperty.Should().Be("Subclass2")));


            Specify(x =>
                    TestDataGenerator.Create <ClassAddingAttributes> (MaxRecursionDepth, null))
            .Case("should fill property with other subclass attribute", _ => _
                  .Given(AttributeConcreteForOtherContext())
                  .It("it assigns correct value", x => x.Result.SomeAttributedProperty.Should().Be("Subclass1")));

            Specify(x =>
                    TestDataGenerator.Create <ClassWithoutAttribute> (MaxRecursionDepth, null))
            .Case("should fill property with previous provider value", _ => _
                  .Given(AttributeMixedContext())
                  .It("it assigns correct value", x => x.Result.PropertyWithoutAttribute.Should().Be("Some value")));

            Specify(x =>
                    TestDataGenerator.Create <ClassWithoutAttribute> (MaxRecursionDepth, null))
            .Case("should throw exception because of missing provider", _ => _
                  .Given(AttributeMixedOtherWayContext())
                  .ItThrows(typeof(NotSupportedException),
                            "Could not auto-fill Farada.TestDataGeneration.IntegrationTests.TestDomain.ClassWithoutAttribute " +
                            "(member PropertyWithoutAttribute). Please provide a value provider")
                  .ItThrowsInner(typeof(MissingValueProviderException),
                                 "Tried to call previous provider on " +
                                 "'Farada.TestDataGeneration.IntegrationTests.TestDomain.ClassWithoutAttribute.PropertyWithoutAttribute'" +
                                 " but no previous provider was registered. Are you missing a value provider registration?"));
        }
コード例 #8
0
 public TestDataGeneratorDependendPropertySpeck()
 {
     //Immutable classes
     Specify(x => TestDataGenerator.Create <AirVehicle> ())
     .Case("should fill by metadata", _ => _
           .Given("simple metadata domain", x => TestDataDomainConfiguration = cfg => cfg
                                                                               .For <Engine> ().AddProvider(context => new JetEngine {
         PowerInNewtons = 5
     })
                                                                               .For <AirVehicle> ().WithMetadata(ctx => new { Weight = 15, Color = Color.Red })
                                                                               .Select(a => a.Name).AddProvider(context => $"VehicleX (Color:{context.Metadata.Color}," + $" Weight:{context.Metadata.Weight})"))
           .Given(TestDataGeneratorContext())
           .It("fills name with metadata", x => x.Result.Name.Should().Be("VehicleX (Color:Red, Weight:15)")))
     //
     .Case("should fill by reused metadata", _ => _
           .Given("reused dependency domain", x => TestDataDomainConfiguration = cfg => cfg
                                                                                 .UseRandom(new DefaultRandom(0))
                                                                                 .For <Engine> ().AddProvider(context => new JetEngine {
         PowerInNewtons = 5
     })
                                                                                 .For <AirVehicle> ().WithMetadata(ctx => ctx.Random.Next())
                                                                                 .Select(a => a.Weight).AddProvider(context => context.Metadata)
                                                                                 .Select(a => a.Name).AddProvider(context => $"Vehicle (Weight:{context.Metadata})")
                  )
           .Given(TestDataGeneratorContext())
           .It("fills weight with same metadata", x => x.Result.Weight.Should().Be(1755192844))
           .It("fills name with same metadata", x => x.Result.Name.Should().Be("Vehicle (Weight:1755192844)")))
     //
     .Case("should fill dependend properties", _ => _
           .Given("simple dependency domain", x => TestDataDomainConfiguration = cfg => cfg
                                                                                 .For <Engine> ().AddProvider(context => new JetEngine {
         PowerInNewtons = 5
     })
                                                                                 .For <AirVehicle> ()
                                                                                 .Select(a => a.Weight).AddProvider(context => 10)
                                                                                 .For <AirVehicle> ().WithMetadata(ctx => new { Weight = ctx.Get(a => a.Weight), Color = Color.Green })
                                                                                 .Select(a => a.Name)
                                                                                 .AddProvider(context => $"VehicleX (Color:{context.Metadata.Color}," + $" Weight:{context.Metadata.Weight})"))
           .Given(TestDataGeneratorContext())
           .It("fills weight", x => x.Result.Weight.Should().Be(10))
           .It("fills name with dependencies", x => x.Result.Name.Should().Be("VehicleX (Color:Green, Weight:10)")))
     //
     .Case("should fill pass through properties", _ => _
           .Given("pass through metadata domain", x => TestDataDomainConfiguration = cfg => cfg
                                                                                     .For <Engine> ().AddProvider(context => new JetEngine {
         PowerInNewtons = 5
     })
                                                                                     .For <AirVehicle> ()
                                                                                     .Select(a => a.MainColor).AddProvider(context => Color.Green)
                                                                                     .For <AirVehicle> ().WithMetadata(ctx => ctx)
                                                                                     .Select(a => a.Name).AddProvider(context => $"VehicleX (Color:{context.Metadata.Get (a => a.MainColor)})"))
           .Given(TestDataGeneratorContext())
           .It("fills main color", x => x.Result.MainColor.Should().Be(Color.Green))
           .It("fills name with dependencies", x => x.Result.Name.Should().Be("VehicleX (Color:Green)")))
     //
     .Case("Should throw on missing dependency", _ => _
           .Given("missing dependency domain", x => TestDataDomainConfiguration = cfg => cfg
                                                                                  .For <Engine> ()
                                                                                  .AddProvider(context => new JetEngine {
         PowerInNewtons = 5
     })
                                                                                  //missing dependency: MainColor
                                                                                  .For <AirVehicle> ().WithMetadata(ctx => new { MainColor = ctx.Get(a => a.MainColor) })
                                                                                  .Select(a => a.Name).AddProvider(context => context.Metadata.MainColor.ToString())
                                                                                  .For <AirVehicle> ()
                                                                                  .Select(a => a.MainColor).AddProvider(ctx => Color.White) /*this is too late*/)
           .Given(TestDataGeneratorContext())
           .ItThrows(typeof(ArgumentException),
                     "Could not find key:'AirVehicle.MainColor' in metadata context. " +
                     "Have you registered the dependency before the metadata provider?"))
     //
     .Case("should throw on cycles", _ => _
           .Given("cyclic dependency domain", x => TestDataDomainConfiguration = cfg => cfg
                                                                                 .For <Engine> ().AddProvider(context => new JetEngine())
                                                                                                                                           //cycle: Weight->Weight
                                                                                 .For <AirVehicle> ()
                                                                                 .Select(a => a.MainColor).AddProvider(ctx => Color.White) //colors can't be constructed
                                                                                 .For <AirVehicle> ().WithMetadata(ctx => new { Weight = ctx.Get(a => a.Weight) })
                                                                                 .Select(a => a.Weight).AddProvider(context => context.Metadata.Weight))
           .Given(TestDataGeneratorContext())
           .ItThrows(typeof(ArgumentException), "Could not find key:'AirVehicle.Weight' in metadata context. " +
                     "Have you registered the dependency before the metadata provider?"))
     //
     .Case("should throw on nested dependencies", _ => _
           .Given("nested dependency domain", x => TestDataDomainConfiguration = cfg => cfg
                                                                                 .For <Engine> ()
                                                                                 .AddProvider(context => new JetEngine())
                                                                                 //deep dependency
                                                                                 .For <AirVehicle> ()
                                                                                 .Select(a => a.Engine.PowerInNewtons).AddProvider(context => 10f)
                                                                                 .For <AirVehicle> ().WithMetadata(ctx => ctx.Get(a => a.Engine.PowerInNewtons))
                                                                                 .Select(a => a.Name).AddProvider(context => "don't care"))
           .Given(TestDataGeneratorContext(catchExceptions: true))
           .ItThrows(typeof(ArgumentException),
                     "Could not find key:'AirVehicle.Engine.PowerInNewtons' in metadata context. " +
                     "Have you registered the dependency before the metadata provider?"));
     Specify(x => TestDataGenerator.Create <ImmutableIce> ())
     .Case("should fill ctor args according to metadata", _ => _
           .Given("ctor metadata domain", x => TestDataDomainConfiguration = cfg => cfg
                                                                             .For <ImmutableIce> ().WithMetadata(ctx => 4)
                                                                             .Select(ice => ice.Origin).AddProvider(context => $"Antarctica ({context.Metadata})"))
           .Given(TestDataGeneratorContext())
           .It("fills origin according to metadata", x => x.Result.Origin.Should().Be("Antarctica (4)")))
     //
     .Case("should fill ctor args according to reuused metadata", _ => _
           .Given("reused ctor metadata domain", x => TestDataDomainConfiguration = cfg => cfg
                                                                                    .UseRandom(new DefaultRandom(0))
                                                                                    .For <ImmutableIce> ().WithMetadata(ctx => ctx.Random.Next())
                                                                                    .Select(ice => ice.Temperature).AddProvider(context => context.Metadata)
                                                                                    .Select(ice => ice.Origin).AddProvider(context => $"Antarctica ({context.Metadata})"))
           .Given(TestDataGeneratorContext())
           .It("fills temperature with same metadata", x => x.Result.Temperature.Should().Be(1559595546))
           .It("fills origin with same metadata", x => x.Result.Origin.Should().Be("Antarctica (1559595546)")))
     //
     .Case("should fill dependend ctor args", _ => _
           .Given("ctor dependency domain", x => TestDataDomainConfiguration = cfg => cfg
                                                                               .For <ImmutableIce> ()
                                                                               .Select(ice => ice.Temperature).AddProvider(context => 4)
                                                                               .For <ImmutableIce> ().WithMetadata(ctx => ctx.Get(i => i.Temperature))
                                                                               .Select(ice => ice.Origin).AddProvider(context => $"Antarctica ({context.Metadata})"))
           .Given(TestDataGeneratorContext())
           .It("fills temperature", x => x.Result.Temperature.Should().Be(4))
           .It("fills origin with dependencies", x => x.Result.Origin.Should().Be("Antarctica (4)")))
     //
     .Case("should throw on cycles in ctor args", _ => _
           .Given("cylcic ctor dependency domain", x => TestDataDomainConfiguration = cfg => cfg
                                                                                      //cycle: temperature -> temperature
                                                                                      .For <ImmutableIce> ().WithMetadata(ctx => ctx.Get(ice => ice.Temperature))
                                                                                      .Select(ice => ice.Temperature).AddProvider(context => context.Metadata))
           .Given(TestDataGeneratorContext())
           .ItThrows(typeof(ArgumentException),
                     "Could not find key:'Farada.TestDataGeneration.IntegrationTests.TestDomain.ImmutableIce.Temperature' " +
                     "in metadata context. Have you registered the dependency before the metadata provider?"));
 }
コード例 #9
0
 T Create <T> ()
 {
     return(TestDataGenerator.Create <T> (MaxRecursionDepth, null));
 }
コード例 #10
0
        public TestDataGeneratorClassFillingSpeck()
        {
            Specify(x =>
                    TestDataGenerator.Create <Universe> (MaxRecursionDepth, null))
            .Case("should fill normal property deep in hierarchy", _ => _
                  .Given(SimpleStringContext(3))
                  .It("fills properties in 1st level deep hierarchy", x => x.Result.Galaxy1.StarSystem1.Planet1.President.Name.Should().Be("SomeString"))
                  .It("fill properties in 2nd level deep hierarchy",
                      x =>
                      x.Result.Galaxy1.StarSystem1.Planet1.President.Atom1.Particle1.QuantumUniverse.Galaxy1.StarSystem1.Planet1.President.Name.Should()
                      .Be("SomeString"))
                  .It("aborts hierarchy filling at 3rd level top element (QuantumUniverse)",
                      x =>
                      x.Result.Galaxy1.StarSystem1.Planet1.President.Atom1.Particle1.QuantumUniverse.Galaxy1.StarSystem1.Planet1.President.Atom1.Particle1
                      .QuantumUniverse.Galaxy1.Should()
                      .BeNull()));

            Specify(x =>
                    TestDataGenerator.Create <LandVehicle> (MaxRecursionDepth, null))
            .Case("should fill properties according to provider chain1", _ => _
                  .Given(PropertyProviderContext())
                  .It("should fill weight", x => x.Result.Weight.Should().Be(100))
                  .It("should fill main color", x => x.Result.MainColor.Should().Be(Color.Red))
                  .It("should fill tire diameter", x => x.Result.Tire.Diameter.Should().Be(3.6))
                  .It("should fill grip", x => x.Result.Tire.Grip.Should().Be(3.6)));

            Specify(x =>
                    TestDataGenerator.Create <AirVehicle> (MaxRecursionDepth, null))
            .Case("should fill properties according to provider chain2", _ => _
                  .Given(PropertyProviderContext())
                  .It("should fill weight as specified", x => x.Result.Weight.Should().Be(5))
                  .It("should fill main color as specified", x => x.Result.MainColor.Should().Be(Color.Green))
                  .It("should fill engine with jetengine", x => x.Result.Engine.Should().BeOfType(typeof(JetEngine)))
                  .It("should fill fuel use per second as specified",
                      x => ((JetEngine)x.Result.Engine).FuelUsePerSecond.Should().Be(1.1f))
                  .It("should fill powerinnewtons as specified", x => x.Result.Engine.PowerInNewtons.Should().Be(5000f)));

            Specify(x =>
                    TestDataGenerator.Create <AirVehicle> (MaxRecursionDepth, null))
            .Case("throws for abstract properties because of default provider chain", _ => _
                  .Given(BaseDomainContext())
                  .ItThrows(typeof(NotSupportedException), "Could not auto-fill AirVehicle (member Engine). Please provide a value provider")
                  .ItThrowsInner(typeof(NotSupportedException),
                                 "No valid ctor found on 'Engine': Classes with non-public constructors and abstract classes are not supported."));


            Specify(x =>
                    TestDataGenerator.Create <LandVehicle> (MaxRecursionDepth, null))
            .Case("should fill properties according to provider chain3", _ => _
                  .Given(HierarchyPropertyProviderContext())
                  //
                  //test simple cases again because of more complex domain
                  .It("should fill weight as specified", x => x.Result.Weight.Should().Be(50))
                  .It("should fill main color as specified", x => x.Result.MainColor.Should().Be(Color.Black))
                  .It("should fill tire diameter as specified", x => x.Result.Tire.Diameter.Should().Be(1.2))
                  .It("should fill grip  as specified", x => x.Result.Tire.Grip.Should().Be(1.2)));

            Specify(x =>
                    TestDataGenerator.CreateMany <AirVehicle> (2, MaxRecursionDepth, null).First())
            .Case("should fill properties according to provider chain4", _ => _
                  .Given(HierarchyPropertyProviderContext())
                  //
                  //test simple cases again because of more complex domain
                  .It("should fill weight as specified", x => x.Result.Weight.Should().Be(50))
                  .It("should fill main color as specified", x => x.Result.MainColor.Should().Be(Color.Black))

                  //start testing concrete domain logic
                  .It("should fill engine with PropellorEngine", x => x.Result.Engine.Should().BeOfType(typeof(PropellorEngine)))
                  .It("should fill fuel use per second as specified",
                      x =>
                      ((PropellorEngine)x.Result.Engine).AverageRotationSpeed.Should().Be(2.1f))
                  .It("should fill PowerInNewtons as specified", x => x.Result.Engine.PowerInNewtons.Should().Be(250f)));

            Specify(x =>
                    TestDataGenerator.CreateMany <AirVehicle> (2, MaxRecursionDepth, null).Last())
            .Case("should fill properties according to provider chain5", _ => _
                  .Given(HierarchyPropertyProviderContext())
                  //
                  //test simple cases again because of more complex domain
                  .It("should fill weight as specified", x => x.Result.Weight.Should().Be(50))
                  .It("should fill main color as specified", x => x.Result.MainColor.Should().Be(Color.Black))

                  //start testing concrete domain logic
                  .It("should fill engine with jetengine", x => x.Result.Engine.Should().BeOfType(typeof(JetEngine)))
                  .It("should fill fuel use per second as specified", x => ((JetEngine)x.Result.Engine).FuelUsePerSecond.Should().Be(2.1f))
                  .It("should fill powerinnewtons as specified", x => x.Result.Engine.PowerInNewtons.Should().Be(1200)));

            Specify(x =>
                    TestDataGenerator.Create <LandVehicle> (MaxRecursionDepth, null))
            .Case("should fill properties according to provider chain6", _ => _
                  .Given(AttributeProviderContext())
                  .It("should fill tire usage", x => x.Result.Tire.TireUsage.Should().Be(100.1d))
                  .It("should fill weight", x => x.Result.Weight.Should().Be(52)));

            Specify(x =>
                    TestDataGenerator.Create <LandVehicle> (MaxRecursionDepth, null))
            .Case("should fill properties according to provider chain7", _ => _
                  .Given(TypeHierarchyChainProviderContext())
                  .It("should fill name", x => x.Result.Name.Should().Be("12345!6!78")));

            Specify(x =>
                    TestDataGenerator.Create <ClassWithMixedMembers> (MaxRecursionDepth, null))
            .Case("should fill mixed properties correctly", _ => _
                  .Given(BaseDomainContext(seed: 0))
                  .It("should fill public property", x => x.Result.PublicProperty.Should().Be("Vigimuhe"))
                  .It("should fill public field", x => x.Result.PublicField.Should().Be("Zaxsewu"))
                  .It("Should not fill private property", x => x.Result.GetPrivateProperty().Should().Be("default"))
                  .It("Should not fill private field", x => x.Result.GetPrivateField().Should().Be("default")));
        }