コード例 #1
0
        public void WhenThereIsADefaultConstructorAndAnotherWithOneArgument_ItUsesTheDefaultConstructor()
        {
            var gen = Gen.Create <DefaultConstructorAndAnotherWithOneArgument>();

            var instance = gen.SampleOne(seed: 0);

            instance.Should().NotBeNull();
            instance.Property.Should().NotBeNull();
        }
コード例 #2
0
        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'");
        }
コード例 #3
0
        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();
        }