public void WhenThereIsADefaultConstructorAndAnotherWithOneArgument_ItUsesTheDefaultConstructor() { var gen = Gen.Create <DefaultConstructorAndAnotherWithOneArgument>(); var instance = gen.SampleOne(seed: 0); instance.Should().NotBeNull(); instance.Property.Should().NotBeNull(); }
public void ItErrorsWhenThereIsNoPublicConstructor() { var gen = Gen.Create <ClassWithNoPublicConstructor>(); Action action = () => gen.SampleOne(seed: 0); action.Should() .Throw <Exceptions.GenErrorException>() .WithMessage("Error while running generator ReflectedGen: could not resolve type '*ClassWithNoPublicConstructor'"); }
public void WhenThereIsAConstructorWithOneArgumentAndAnotherWithTwoArguments_ItUsesTheConstructorWithTwoArguments() { var gen = Gen.Create <ConstructorWithOneArgumentAndAnotherWithTwoArguments>(); var instance = gen.SampleOne(seed: 0); instance.Should().NotBeNull(); instance.Property1.Should().NotBeNull(); instance.Property2.Should().NotBeNull(); }